Commit 461fb1133d929cb92d9bd5641df10e87eb70fa90

Thomas de Grivel 2022-05-23T08:45:19

fix compilation on linux

diff --git a/.gitignore b/.gitignore
index 4514d59..c8c3296 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,5 +7,6 @@ config.mk
 /lib/*_type
 /lib/*_type.h
 /lib/.*.log
+/lib/*/.*.log
 *.la
 *.lo
diff --git a/cli/configure b/cli/configure
index e23c626..ab65ac0 100755
--- a/cli/configure
+++ b/cli/configure
@@ -54,7 +54,7 @@ echo "\t${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} \${OBJECTS} \
 
 echo >> ${CONFIG_MK}
 echo "$PROG: $LIBRARY $PROG_OBJECTS" >> ${CONFIG_MK}
-echo "\t${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS} ${PROG_OBJECTS} ${LIBRARY} -o $PROG" >> ${CONFIG_MK}
+echo "\t${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS} ${PROG_OBJECTS} ${LIBRARY} ${LIBS} -o $PROG" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
 echo "install: $LIBRARY $PROG" >> ${CONFIG_MK}
diff --git a/config.subr b/config.subr
index 373cc5e..5bf0d14 100644
--- a/config.subr
+++ b/config.subr
@@ -86,12 +86,12 @@ fi
 echo "PREFIX = $PREFIX" >> ${CONFIG_MK}
 
 if test -z "$OWNER"; then
-    OWNER="$(stat $PREFIX | cut -d\  -f 5)"
+    OWNER="$(stat -t $PREFIX | cut -d\  -f 5)"
 fi
 echo "OWNER = $OWNER" >> ${CONFIG_MK}
 
 if test -z "$GROUP"; then
-    GROUP="$(stat $PREFIX | cut -d\  -f 6)"
+    GROUP="$(stat -t $PREFIX | cut -d\  -f 6)"
 fi
 echo "GROUP = $GROUP" >> ${CONFIG_MK}
 
diff --git a/gtk3/configure b/gtk3/configure
index 69212b7..5c74c8d 100755
--- a/gtk3/configure
+++ b/gtk3/configure
@@ -32,8 +32,11 @@ echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
 LDFLAGS="-pthread"
 echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
 
-LIBS="../librtbuf/librtbuf.la ../cli/librtbuf_cli.la"
+LIBS=""
+LIBS="$LIBS ../librtbuf/librtbuf.la"
+LIBS="$LIBS ../cli/librtbuf_cli.la"
 LIBS="$LIBS $(pkg-config --libs gtk+-3.0)"
+LIBS="$LIBS -lm"
 echo "LIBS = $LIBS" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do
diff --git a/lib/Makefile b/lib/Makefile
index 4857776..136f9e6 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,7 +5,7 @@ all: types libraries subdirs
 clean: subdirs-clean
 	rm -rf .libs *.o *.lo *.la ${CLEANFILES}
 
-install: subdirs-install
+install: libraries-install subdirs-install
 
 .PHONY: all clean libraries subdirs subdirs-clean subdirs-install
 
diff --git a/lib/configure b/lib/configure
index 5e6f3cc..fbf6705 100755
--- a/lib/configure
+++ b/lib/configure
@@ -10,6 +10,7 @@ SOURCES="$(ls *.c | grep -Ev '_type.c$' | tr '\n' ' ')"
 DIRS="$(ls -d */)"
 
 CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D__USE_MISC"
 echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
 
 if [ x"$DEBUG" = x"yes" ]; then
@@ -65,7 +66,7 @@ echo >> ${CONFIG_MK}
 echo "libraries:${LIBRARIES} ${TYPES}" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "install: ${LIBRARIES} subdirs-install" >> ${CONFIG_MK}
+echo "libraries-install: ${LIBRARIES}" >> ${CONFIG_MK}
 for LIB in $LIBRARIES; do
     echo "\t\${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 $LIB \${LIBDIR}" >> ${CONFIG_MK}
 done
diff --git a/lib/signal/configure b/lib/signal/configure
index 2df4b72..026c192 100755
--- a/lib/signal/configure
+++ b/lib/signal/configure
@@ -17,6 +17,7 @@ else
     CFLAGS="-DNDEBUG -O3"
 fi
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c89 -pedantic"
+CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D__USE_MISC"
 echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
 
 LDFLAGS=""
diff --git a/lib/synth/adsr.c b/lib/synth/adsr.c
index 80f7c3e..276491e 100644
--- a/lib/synth/adsr.c
+++ b/lib/synth/adsr.c
@@ -27,7 +27,7 @@
 #include "../synth.h"
 
 s_rtbuf_lib_proc_in rtbuf_synth_adsr_in[] =
-  {RTBUF_MUSIC_NOTE_IN(),
+  {RTBUF_MUSIC_NOTE_IN(""),
    { "attack",  RTBUF_SIGNAL_TYPE, 0.02, 0.0,  2.0, 1.0 },
    { "decay",   RTBUF_SIGNAL_TYPE, 0.01, 0.0,  2.0, 1.0 },
    { "sustain", RTBUF_SIGNAL_TYPE, 0.4,  0.0,  1.0, 1.0 },
diff --git a/librtbuf/configure b/librtbuf/configure
index 15260e5..2581a57 100755
--- a/librtbuf/configure
+++ b/librtbuf/configure
@@ -11,7 +11,9 @@ echo "SOURCES = $SOURCES" >> ${CONFIG_MK}
 OBJECTS="$(c2lo "$SOURCES")"
 echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
 
-CPPFLAGS="$CPPFLAGS -DRTBUF_LIBDIR=\\\"${RTBUF_LIBDIR}\\\" -DVER=\\\"${VER}\\\""
+CPPFLAGS="$CPPFLAGS -DRTBUF_LIBDIR=\\\"${RTBUF_LIBDIR}\\\""
+CPPFLAGS="$CPPFLAGS -DVER=\\\"${VER}\\\""
+CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D__USE_MISC"
 echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
 
 if [ x"$DEBUG" = x"yes" ]; then
@@ -20,14 +22,16 @@ else
     CFLAGS="-DNDEBUG -O3"
 fi
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c89 -pedantic"
+CFLAGS="$CFLAGS $(pkg-config --cflags libbsd-overlay)"
 echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
 
-if [[ -d /opt/homebrew/lib ]]; then
+if test -d /opt/homebrew/lib; then
     LDFLAGS="$LDFLAGS -L/opt/homebrew/lib -lSystem"
 fi
 echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
 
 LIBS=""
+LIBS="$LIBS $(pkg-config --libs libbsd-overlay)"
 echo "LIBS = $LIBS" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do