Commit 37239d0f2785e45bf5a20fbb9b74f8679c33a646

Thomas de Grivel 2021-02-22T09:28:42

wip remove autotools

diff --git a/config.subr b/config.subr
index 004f80c..0424aaa 100644
--- a/config.subr
+++ b/config.subr
@@ -38,6 +38,7 @@ require_pkg_config() {
 }
 
 CONFIG_MK=config.mk
+echo "$PWD/${CONFIG_MK}"
 echo "# config.mk generated by configure" > ${CONFIG_MK}
 
 if test -z "$CC"; then
@@ -49,10 +50,12 @@ if test -z "$CC"; then
 fi
 echo "CC = $CC" >> ${CONFIG_MK}
 
-if test -x /usr/local/bin/libtool; then
-    LIBTOOL=/usr/local/bin/libtool
-else
-    LIBTOOL=libtool
+if test -z "$LIBTOOL"; then
+    if test -x /usr/local/bin/libtool; then
+        LIBTOOL=/usr/local/bin/libtool
+    else
+        LIBTOOL=libtool
+    fi
 fi
 echo "LIBTOOL = $LIBTOOL" >> ${CONFIG_MK}
 
@@ -62,3 +65,26 @@ if test -z "$INSTALL"; then
     fi
 fi
 echo "INSTALL = $INSTALL" >> ${CONFIG_MK}
+
+if test -z "$PREFIX"; then
+    if test -d /usr/local; then
+        PREFIX=/usr/local
+    elif test -d /usr; then
+        PREFIX=/usr
+    elif test -d /opt/local; then
+        PREFIX=/opt/local
+    elif test -d /opt; then
+        PREFIX=/opt
+    fi
+fi
+echo "PREFIX = $PREFIX" >> ${CONFIG_MK}
+
+if test -z "$BINDIR"; then
+    BINDIR=${PREFIX}/bin
+fi
+echo "BINDIR = $BINDIR" >> ${CONFIG_MK}
+
+if test -z "$LIBDIR"; then
+    LIBDIR=${PREFIX}/lib
+fi
+echo "LIBDIR = $LIBDIR" >> ${CONFIG_MK}
diff --git a/configure b/configure
index a47ad90..9d090bd 100755
--- a/configure
+++ b/configure
@@ -3,8 +3,8 @@ set -e
 
 . ./config.subr
 
-(cd librtbuf && pwd && ./configure)
-(cd lib && pwd && ./configure)
-(cd cli && pwd && ./configure)
-(cd gtk3 && pwd && ./configure)
-#(cd test && pwd && ./configure)
+(cd librtbuf && ./configure)
+(cd lib && ./configure)
+(cd cli && ./configure)
+(cd gtk3 && ./configure)
+#(cd test && ./configure)
diff --git a/lib/configure b/lib/configure
index da4706a..8794035 100755
--- a/lib/configure
+++ b/lib/configure
@@ -29,9 +29,6 @@ echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
 LIBS=""
 echo "LIBS = $LIBS" >> ${CONFIG_MK}
 
-LIBDIR=/usr/local/lib
-echo "LIBDIR = $LIBDIR" >> ${CONFIG_MK}
-
 TYPES=
 
 for TYPE_SRC in $TYPE_SOURCES; do
@@ -76,7 +73,13 @@ echo >> ${CONFIG_MK}
 echo "libraries:${LIBRARIES}" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "subdirs:" >> ${CONFIG_MK}
+echo "install: ${LIBRARIES} subdirs-install" >> ${CONFIG_MK}
+for LIB in $LIBRARIES; do
+    echo "\t\${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o root -g wheel -m 0755 $LIB \${LIBDIR}" >> ${CONFIG_MK}
+done
+
+echo >> ${CONFIG_MK}
+echo "subdirs: ${TYPES}" >> ${CONFIG_MK}
 for DIR in $DIRS; do
     echo "\t\${MAKE} -C \${PWD}/$DIR" >> ${CONFIG_MK}
 done
@@ -91,7 +94,10 @@ echo >> ${CONFIG_MK}
 echo "subdirs-install:" >> ${CONFIG_MK}
 for DIR in $DIRS; do
     echo "\t\${MAKE} -C \${PWD}/$DIR install" >> ${CONFIG_MK}
-    (cd $DIR && pwd && ./configure)
+done
+
+for DIR in $DIRS; do
+    (cd $DIR && ./configure)
 done
 
 for TYPE_SRC in $TYPE_SOURCES; do
diff --git a/librtbuf/configure b/librtbuf/configure
index 1b09987..f580756 100755
--- a/librtbuf/configure
+++ b/librtbuf/configure
@@ -44,3 +44,7 @@ done
 echo >> ${CONFIG_MK}
 echo "$LIB: $OBJECTS" >> ${CONFIG_MK}
 echo "\t${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS} $OBJECTS \${LIBS} -o $LIB -rpath ${LIBDIR}" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "install: $LIB" >> ${CONFIG_MK}
+echo "\t\${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o root -g wheel -m 0755 $LIB \${LIBDIR}" >> ${CONFIG_MK}