more buildsystem fixes

Tue, 13 Aug 2019 21:50:16 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 13 Aug 2019 21:50:16 +0200
changeset 207
27f8a41882a7
parent 206
f5bdca63bbe7
child 208
fedd0f957c31

more buildsystem fixes

configure file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
make/toolchain.sh file | annotate | diff | comparison | revisions
--- a/configure	Tue Aug 13 21:13:43 2019 +0200
+++ b/configure	Tue Aug 13 21:50:16 2019 +0200
@@ -186,6 +186,16 @@
     done
     return 1
 }
+isnotplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 # generate config.mk and config.h
 cat > $TEMP_DIR/config.mk << __EOF__
@@ -252,8 +262,8 @@
         if ! $PKG_CONFIG libpq ; then
             break
         fi
-        CFLAGS+=" `$PKG_CONFIG --cflags libpq`"
-        LDFLAGS+=" `$PKG_CONFIG --libs libpq`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libpq`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libpq`"
 		echo yes
         return 0
     done
@@ -273,8 +283,8 @@
         if ! $PKG_CONFIG openssl ; then
             break
         fi
-        CFLAGS+=" `$PKG_CONFIG --cflags openssl`"
-        LDFLAGS+=" `$PKG_CONFIG --libs openssl`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags openssl`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`"
 		echo yes
         return 0
     done
@@ -294,8 +304,8 @@
         if ! $PKG_CONFIG libxml-2.0 ; then
             break
         fi
-        CFLAGS+=" `$PKG_CONFIG --cflags libxml-2.0`"
-        LDFLAGS+=" `$PKG_CONFIG --libs libxml-2.0`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libxml-2.0`"
 		echo yes
         return 0
     done
@@ -311,14 +321,14 @@
 LDFLAGS=
 while true
 do
-    if ! isplatform "linux"; then
+    if isnotplatform "linux"; then
         break
     fi
     while true
     do
         
-        CFLAGS+="-DLINUX"    
-        LDFLAGS+="-lpthread -ldl -lm -lldap"    
+        CFLAGS="CFLAGS -DLINUX"    
+        LDFLAGS="LDFLAGS -lpthread -ldl -lm -lldap"    
 		cat >> $TEMP_DIR/make.mk << __EOF__
 # platform dependend source files
 PLATFORM_DAEMONOBJ = event_linux.o
@@ -337,7 +347,7 @@
 done
 while true
 do
-    if ! isplatform "bsd"; then
+    if isnotplatform "bsd"; then
         break
     fi
     if isplatform "macos"; then
@@ -346,8 +356,8 @@
     while true
     do
         
-        CFLAGS+="-DBSD"    
-        LDFLAGS+="-lpthread -lm -lldap"    
+        CFLAGS="CFLAGS -DBSD"    
+        LDFLAGS="LDFLAGS -lpthread -lm -lldap"    
 		cat >> $TEMP_DIR/make.mk << __EOF__
 # platform dependend source files
 PLATFORM_DAEMONOBJ = event_bsd.o
@@ -366,14 +376,14 @@
 done
 while true
 do
-    if ! isplatform "macos"; then
+    if isnotplatform "macos"; then
         break
     fi
     while true
     do
         
-        CFLAGS+="-DBSD -DOSX"    
-        LDFLAGS+="-lpthread -ldl -lm -lldap"    
+        CFLAGS="CFLAGS -DBSD -DOSX"    
+        LDFLAGS="LDFLAGS -lpthread -ldl -lm -lldap"    
 		cat >> $TEMP_DIR/make.mk << __EOF__
 # platform dependend source files
 PLATFORM_DAEMONOBJ = event_bsd.o
@@ -392,14 +402,14 @@
 done
 while true
 do
-    if ! isplatform "solaris"; then
+    if isnotplatform "solaris"; then
         break
     fi
     while true
     do
         
-        CFLAGS+="-DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"    
-        LDFLAGS+="-lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap"    
+        CFLAGS="CFLAGS -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"    
+        LDFLAGS="LDFLAGS -lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap"    
 		cat >> $TEMP_DIR/make.mk << __EOF__
 # platform dependend source files
 PLATFORM_DAEMONOBJ = event_solaris.o
@@ -447,12 +457,12 @@
 
 dependency_libxml2
 if [ $? -ne 0 ]; then
-	DEPENDENCIES_FAILED+="libxml2 "
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
 	ERROR=1
 fi
 dependency_openssl
 if [ $? -ne 0 ]; then
-	DEPENDENCIES_FAILED+="openssl "
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
 	ERROR=1
 fi
 
--- a/make/configure.vm	Tue Aug 13 21:13:43 2019 +0200
+++ b/make/configure.vm	Tue Aug 13 21:50:16 2019 +0200
@@ -244,6 +244,16 @@
     done
     return 1
 }
+isnotplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 # generate config.mk and config.h
 cat > $TEMP_DIR/config.mk << __EOF__
@@ -334,7 +344,7 @@
     while true
     do
     	#if( $sub.platform )
-    	if ! isplatform "${sub.platform}"; then
+    	if isnotplatform "${sub.platform}"; then
             break
         fi
     	#end
@@ -352,19 +362,19 @@
         if ! $PKG_CONFIG $pkg.getPkgConfigParam() ; then
             break
         fi
-        CFLAGS+=" `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS+=" `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
         #end
         #foreach( $flags in $sub.flags )
         #if( $flags.exec )
         $flags.value > /dev/null
         if [ $? -eq 0 ]; then
-            $flags.varName+=" `$flags.value`"
+            $flags.varName="$flags.varName `$flags.value`"
         else
             break
         fi
         #else
-        $flags.varName+="$flags.value"    
+        $flags.varName="$flags.varName $flags.value"    
         #end
         #end
         #foreach( $test in $sub.tests )
@@ -399,7 +409,7 @@
 while true
 do
 	#if( $dependency.platform )
-    if ! isplatform "${dependency.platform}"; then
+    if isnotplatform "${dependency.platform}"; then
         break
     fi
     #end
@@ -424,21 +434,21 @@
             break
         fi
         echo yes
-        CFLAGS+=" `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS+=" `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
         #end
         
         #foreach( $flags in $dependency.flags )
         #if( $flags.exec )
         $flags.value > /dev/null
         if [ $? -ne 0 ]; then
-            $flags.varName+=" `$flags.value`"
+            $flags.varName="$flags.varName `$flags.value`"
         else
             ERROR=1
             break
         fi
         #else
-        $flags.varName+="$flags.value"    
+        $flags.varName="$flags.varName $flags.value"    
         #end
         #end
 		#if ( $dependency.make.length() > 0 )
@@ -485,7 +495,7 @@
 		return 1
 	fi
 	#foreach( $def in $val.defines )
-		CFLAGS+=" ${def.toFlags()}"
+		CFLAGS="$CFLAGS ${def.toFlags()}"
 	#end
 	#if( $val.hasMake() )
 	cat >> $TEMP_DIR/make.mk << __EOF__
@@ -517,7 +527,7 @@
 #foreach( $dependency in $target.dependencies )
 dependency_$dependency
 if [ $? -ne 0 ]; then
-	DEPENDENCIES_FAILED+="${dependency} "
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
 	ERROR=1
 fi
 #end
--- a/make/toolchain.sh	Tue Aug 13 21:13:43 2019 +0200
+++ b/make/toolchain.sh	Tue Aug 13 21:50:16 2019 +0200
@@ -63,7 +63,7 @@
     return 0
 }
 
-printf "detect toolchain... "
+printf "detect C compiler... "
 
 for COMP in $C_COMPILERS
 do
@@ -152,7 +152,7 @@
 
 TOOLCHAIN_LD=$TOOLCHAIN_CC
 
-if [ -z TOOLCHAIN_NAME ]; then
+if [ -z "$TOOLCHAIN_NAME" ]; then
     TOOLCHAIN_DETECTION_ERROR="error"
 else
     cat >> $TEMP_DIR/config.mk << __EOF__
@@ -164,7 +164,8 @@
 	fi
     echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk
     
-    if [ -e "make/${TOOLCHAIN_NAME}.mk" ]; then 
+	cat "make/${TOOLCHAIN_NAME}.mk" > /dev/null 2>&1
+    if [ $? -eq 0 ]; then 
         echo "include \$(BUILD_ROOT)/make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk
     fi
 fi

mercurial