Sat, 03 Aug 2019 11:15:03 +0200
add missing source changes
--- a/src/main/java/de/unixwork/uwproj/Dependency.java Sat Aug 03 11:02:55 2019 +0200 +++ b/src/main/java/de/unixwork/uwproj/Dependency.java Sat Aug 03 11:15:03 2019 +0200 @@ -18,10 +18,12 @@ public class Dependency { private String name; private String platform; + private String not; private List<Flags> flags = new LinkedList<>(); private List<PkgConfigPackage> pkgconfig = new LinkedList<>(); private List<String> tests = new LinkedList<>(); + private StringBuilder make = new StringBuilder(); private boolean abortOnError = false; @@ -32,12 +34,16 @@ String name = element.getAttribute("name"); String platform = element.getAttribute("platform"); + String not = element.getAttribute("not"); if(name.length() > 0) { d.setName(name); } if(platform.length() > 0) { d.setPlatform(platform); } + if(not.length() > 0) { + d.setNotString(not); + } NodeList nodes = element.getChildNodes(); for(int i=0;i<nodes.getLength();i++) { @@ -53,6 +59,9 @@ d.addPkgconfig(pcp); } else if(n.equals("test")) { d.tests.add(Xml.getContent(elm)); + } else if(n.equals("make")) { + String m = Xml.getContent(elm); + d.addMake(m); } } } @@ -79,6 +88,21 @@ return "platform=\""+platform+'"'; } } + + public void setNotString(String not) { + this.not = not; + } + + public List<String> getNotList() { + List<String> notPlatforms = new LinkedList<>(); + if(not != null) { + String[] n = not.split(","); + for(String s : n) { + notPlatforms.add(s); + } + } + return notPlatforms; + } public void setPlatform(String platform) { this.platform = platform; @@ -119,4 +143,13 @@ public List<String> getTests() { return tests; } + + public void addMake(String m) { + make.append(m.trim()); + make.append('\n'); + } + + public String getMake() { + return make.toString(); + } }
--- a/src/main/java/de/unixwork/uwproj/Target.java Sat Aug 03 11:02:55 2019 +0200 +++ b/src/main/java/de/unixwork/uwproj/Target.java Sat Aug 03 11:15:03 2019 +0200 @@ -31,7 +31,9 @@ Target target = new Target(); String name = element.getAttribute("name"); - target.setName(name); + if(name.length() > 0) { + target.setName(name); + } NodeList nodes = element.getChildNodes(); for(int i=0;i<nodes.getLength();i++) { @@ -66,7 +68,7 @@ } } - if (target.prefix == null) { + if (target.prefix == null && target.name != null) { target.setPrefix(name.toUpperCase()); }
--- a/test/config.mk Sat Aug 03 11:02:55 2019 +0200 +++ b/test/config.mk Sat Aug 03 11:15:03 2019 +0200 @@ -6,12 +6,9 @@ include $(BUILD_ROOT)make/gcc.mk - -DAV_CFLAGS += -I/usr/include/libxml2 -DTEST -DAV_LDFLAGS += -lcurl -lxml2 +CFLAGS += -DLINUX +LDFLAGS += -lpthread -ldl -lm -lldap -CFLAGS += -DDEPTEST +CFLAGS += -I/usr/include/libxml2 +LDFLAGS += -lxml2 -lssl -lcrypto -# Dependency: libxml2 -xml = libxml2 -
--- a/test/configure Sat Aug 03 11:02:55 2019 +0200 +++ b/test/configure Sat Aug 03 11:15:03 2019 +0200 @@ -28,7 +28,6 @@ touch $TEMP_DIR/features # features -FEATURE_DB=on # help text printhelp() @@ -54,12 +53,8 @@ --infodir=DIR info documentation [DATAROOTDIR/info] --mandir=DIR man documentation [DATAROOTDIR/man] -Options: - --toolkit=(gtk3|cli|gtk2|wpf) - Optional Features: - --disable-db - --enable-gui + --enable-pg __EOF__ } @@ -98,16 +93,10 @@ elif [ $ARG = "--help" ]; then printhelp exit 0 - elif [[ $ARG == --toolkit=* ]]; then - OPT_TOOLKIT=${ARG:10} - elif [[ $ARG == --enable-db ]]; then - FEATURE_DB=on - elif [[ $ARG == --disable-db ]]; then - unset FEATURE_DB - elif [[ $ARG == --enable-gui ]]; then - FEATURE_GUI=on - elif [[ $ARG == --disable-gui ]]; then - unset FEATURE_GUI + elif [[ $ARG == --enable-pg ]]; then + FEATURE_PG=on + elif [[ $ARG == --disable-pg ]]; then + unset FEATURE_PG fi done @@ -228,71 +217,20 @@ # DEPENDENCIES # -dependency_qt4() -{ - printf "checking for qt4... " - # dependency qt4 - while true - do - which qmake-qt4 > /dev/null - if [ $? -ne 0 ]; then - break - fi - echo yes - return 0 - done - - echo no - return 1 -} -dependency_curl() +dependency_libpq() { - printf "checking for curl... " - # dependency curl platform="windows" - while true - do - if ! isplatform "windows"; then - break - fi - CFLAGS+="-I/mingw/include" - LDFLAGS+="-lcurl" - echo yes - return 0 - done - - # dependency curl platform="macos" - while true - do - if ! isplatform "macos"; then - break - fi - curl-config --cflags > /dev/null - if [ $? -eq 0 ]; then - CFLAGS+=" `curl-config --cflags`" - else - break - fi - curl-config --ldflags > /dev/null - if [ $? -eq 0 ]; then - LDFLAGS+=" `curl-config --ldflags`" - else - break - fi - echo yes - return 0 - done - - # dependency curl + printf "checking for libpq... " + # dependency libpq while true do if [ -z "PKG_CONFIG" ]; then break fi - if ! pkg-config libcurl ; then + if ! pkg-config libpq ; then break fi - CFLAGS+=" `pkg-config --cflags libcurl`" - LDFLAGS+=" `pkg-config --libs libcurl`" + CFLAGS+=" `pkg-config --cflags libpq`" + LDFLAGS+=" `pkg-config --libs libpq`" echo yes return 0 done @@ -300,104 +238,20 @@ echo no return 1 } -dependency_test() +dependency_openssl() { - printf "checking for test... " - # dependency test platform="bsd" - while true - do - if ! isplatform "bsd"; then - break - fi - if isplatform "macos"; then - break - fi - CFLAGS+="-DBSD" - echo yes - return 0 - done - - # dependency test - while true - do - CFLAGS+="-DTEST" - echo yes - return 0 - done - - echo no - return 1 -} -dependency_sqlite() -{ - printf "checking for sqlite... " - # dependency sqlite + printf "checking for openssl... " + # dependency openssl while true do if [ -z "PKG_CONFIG" ]; then break fi - if ! pkg-config sqlite3 ; then - break - fi - CFLAGS+=" `pkg-config --cflags sqlite3`" - LDFLAGS+=" `pkg-config --libs sqlite3`" - echo yes - return 0 - done - - echo no - return 1 -} -dependency_gtk2() -{ - printf "checking for gtk2... " - # dependency gtk2 - while true - do - if [ -z "PKG_CONFIG" ]; then - break - fi - if ! pkg-config gtk+-2.0 ; then + if ! pkg-config openssl ; then break fi - CFLAGS+=" `pkg-config --cflags gtk+-2.0`" - LDFLAGS+=" `pkg-config --libs gtk+-2.0`" - echo yes - return 0 - done - - echo no - return 1 -} -dependency_gtk3() -{ - printf "checking for gtk3... " - # dependency gtk3 - while true - do - if [ -z "PKG_CONFIG" ]; then - break - fi - if ! pkg-config gtk+-5.0 ; then - break - fi - CFLAGS+=" `pkg-config --cflags gtk+-5.0`" - LDFLAGS+=" `pkg-config --libs gtk+-5.0`" - echo yes - return 0 - done - - echo no - return 1 -} -dependency_deptest() -{ - printf "checking for deptest... " - # dependency deptest - while true - do - CFLAGS+="-DDEPTEST" + CFLAGS+=" `pkg-config --cflags openssl`" + LDFLAGS+=" `pkg-config --libs openssl`" echo yes return 0 done @@ -419,11 +273,6 @@ fi CFLAGS+=" `pkg-config --cflags libxml-2.0`" LDFLAGS+=" `pkg-config --libs libxml-2.0`" - cat >> $TEMP_DIR/make.mk << __EOF__ -# Dependency: libxml2 -xml = libxml2 - -__EOF__ echo yes return 0 done @@ -439,9 +288,49 @@ LDFLAGS= while true do + if ! isplatform "linux"; then + break + fi while true do + CFLAGS+="-DLINUX" + LDFLAGS+="-lpthread -ldl -lm -lldap" + + break + done + + break +done +while true +do + if ! isplatform "bsd"; then + break + fi + if isplatform "macos"; then + break + fi + while true + do + + CFLAGS+="-DBSD" + LDFLAGS+="-lpthread -lm -lldap" + + break + done + + break +done +while true +do + if ! isplatform "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" break done @@ -464,63 +353,6 @@ # # OPTION VALUES # -checkopt_toolkit_gtk3() -{ - VERR=0 - dependency_gtk3 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - CFLAGS+=" -Da=b" - cat >> $TEMP_DIR/make.mk << __EOF__ -UIOBJ += graphics_cairo.o - -__EOF__ - return 0 -} -checkopt_toolkit_cli() -{ - VERR=0 - dependency_curl - if [ $? -ne 0 ]; then - VERR=1 - fi - dependency_test - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - return 0 -} -checkopt_toolkit_gtk2() -{ - VERR=0 - dependency_gtk2 - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - return 0 -} -checkopt_toolkit_wpf() -{ - VERR=0 - dependency_test - if [ $? -ne 0 ]; then - VERR=1 - fi - if [ $VERR -ne 0 ]; then - return 1 - fi - return 0 -} # # TARGETS @@ -529,110 +361,19 @@ CXXFLAGS= LDFLAGS= -# Target: dav +# Target CFLAGS= LDFLAGS= CXXFLAGS= -dependency_curl -if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED+="curl " - ERROR=1 -fi dependency_libxml2 if [ $? -ne 0 ]; then DEPENDENCIES_FAILED+="libxml2 " ERROR=1 fi -dependency_test +dependency_openssl if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED+="test " - ERROR=1 -fi - -# Option: --toolkit -if [ -z $OPT_TOOLKIT ]; then - SAVED_ERROR=$ERROR - SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED - ERROR=0 - while true - do - if isplatform "windows"; then - checkopt_toolkit_wpf - if [ $? -eq 0 ]; then - echo " toolkit: wpf" >> $TEMP_DIR/options - ERROR=0 - break - fi - fi - checkopt_toolkit_gtk3 - if [ $? -eq 0 ]; then - echo " toolkit: gtk3" >> $TEMP_DIR/options - ERROR=0 - break - fi - checkopt_toolkit_gtk2 - if [ $? -eq 0 ]; then - echo " toolkit: gtk2" >> $TEMP_DIR/options - ERROR=0 - break - fi - break - done - if [ $ERROR -ne 0 ]; then - SAVED_ERROR=1 - fi - ERROR=$SAVED_ERROR - DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= -else - if false; then - false - elif [ $OPT_TOOLKIT = "gtk3" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_gtk3 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "cli" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_cli - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "gtk2" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_gtk2 - if [ $? -ne 0 ]; then - ERROR=1 - fi - elif [ $OPT_TOOLKIT = "wpf" ]; then - echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options - checkopt_toolkit_wpf - if [ $? -ne 0 ]; then - ERROR=1 - fi - fi -fi - -echo >> $TEMP_DIR/config.mk -if [[ ! -z ${CFLAGS} ]]; then - echo "DAV_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk -fi -if [[ ! -z ${CXXFLAGS} ]]; then - echo "DAV_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk -fi -if [[ ! -z ${LDFLAGS} ]]; then - echo "DAV_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk -fi - -# Target -CFLAGS= -LDFLAGS= -CXXFLAGS= - -dependency_deptest -if [ $? -ne 0 ]; then - DEPENDENCIES_FAILED+="deptest " + DEPENDENCIES_FAILED+="openssl " ERROR=1 fi @@ -661,8 +402,6 @@ echo "Build Config:" echo " PREFIX: $PREFIX" echo " TOOLCHAIN: $TOOLCHAIN_NAME" -echo "Options:" -cat $TEMP_DIR/options echo cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk rm -Rf $TEMP_DIR
--- a/test/make/project.xml Sat Aug 03 11:02:55 2019 +0200 +++ b/test/make/project.xml Sat Aug 03 11:15:03 2019 +0200 @@ -1,81 +1,67 @@ <?xml version="1.0" encoding="UTF-8"?> <project> - <dependency name="curl" platform="windows"> - <cflags>-I/mingw/include</cflags> - <ldflags>-lcurl</ldflags> - </dependency> - <dependency name="curl" platform="macos"> - <cflags type="exec">curl-config --cflags</cflags> - <ldflags type="exec">curl-config --ldflags</ldflags> - </dependency> - <dependency name="test" platform="bsd" not="macos"> - <cflags>-DBSD</cflags> - </dependency> - <dependency name="curl"> - <pkgconfig>libcurl</pkgconfig> + <!-- platform specific settings --> + <dependency platform="linux"> + <cflags>-DLINUX</cflags> + <ldflags>-lpthread -ldl -lm -lldap</ldflags> + <make> +# platform dependend source files +PLATFORM_DAEMONOBJ = event_linux.o + +# platform dependend vars +OBJ_EXT = .o +LIB_EXT = .so +APP_EXT = + </make> </dependency> - <dependency name="libxml2"> - <pkgconfig>libxml-2.0</pkgconfig> - <make>xml = libxml2</make> - </dependency> - <dependency name="sqlite"> - <pkgconfig>sqlite3</pkgconfig> - </dependency> - <dependency name="test"> - <cflags>-DTEST</cflags> - </dependency> - <dependency name="gtk3"> - <pkgconfig>gtk+-5.0</pkgconfig> - </dependency> - <dependency name="gtk2"> - <pkgconfig>gtk+-2.0</pkgconfig> - </dependency> - <dependency name="qt4"> - <test>which qmake-qt4</test> + + <dependency platform="bsd" not="macos"> + <cflags>-DBSD</cflags> + <ldflags>-lpthread -lm -lldap</ldflags> + <make> +# platform dependend source files +PLATFORM_DAEMONOBJ = event_bsd.o + +# platform dependend vars +OBJ_EXT = .o +LIB_EXT = .so +APP_EXT = + </make> </dependency> - <dependency name="deptest"> - <cflags>-DDEPTEST</cflags> + <dependency platform="solaris"> + <cflags>-DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS</cflags> + <ldflags>-lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap</ldflags> + <make> +# platform dependend source files +PLATFORM_DAEMONOBJ = event_solaris.o + +# platform dependend vars +OBJ_EXT = .o +LIB_EXT = .so +APP_EXT = + </make> </dependency> - - <dependency> - <make>MVAR = 123</make> - <make>MVAR += 123</make> + + <!-- library dependencies --> + <dependency name="libxml2"> + <pkgconfig>libxml-2.0</pkgconfig> </dependency> - <target name="dav"> - <feature name="db" default="on"> - <dependencies>sqlite</dependencies> - <define name="DATABASE"/> - </feature> - <feature name="gui"> - <dependencies>gtk3</dependencies> - <define name="UI" value="GTK3" /> - </feature> - <option arg="toolkit"> - <value str="gtk3"> - <define name="a" value="b" /> - <dependencies>gtk3</dependencies> - <make>UIOBJ += graphics_cairo.o</make> - </value> - <value str="cli"> - <dependencies>curl,test</dependencies> - </value> - <value str="gtk2"> - <dependencies>gtk2</dependencies> - </value> - <value str="wpf"> - <dependencies>test</dependencies> - </value> - <default value="wpf" platform="windows" /> - <default value="gtk3" /> - <default value="gtk2" /> - </option> - <dependencies>curl,libxml2,test</dependencies> - </target> + <dependency name="openssl"> + <pkgconfig>openssl</pkgconfig> + </dependency> + + <!-- optional dependencies --> + <dependency name="libpq"> + <pkgconfig>libpq</pkgconfig> + </dependency> <target> - <dependencies>deptest</dependencies> + <feature name="pg" default="false"> + <dependencies>libpq</dependencies> + </feature> + <dependencies>libxml2,openssl</dependencies> </target> </project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/make/project2.xml Sat Aug 03 11:15:03 2019 +0200 @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <dependency name="curl" platform="windows"> + <cflags>-I/mingw/include</cflags> + <ldflags>-lcurl</ldflags> + </dependency> + <dependency name="curl" platform="macos"> + <cflags type="exec">curl-config --cflags</cflags> + <ldflags type="exec">curl-config --ldflags</ldflags> + </dependency> + <dependency name="test" platform="bsd" not="macos"> + <cflags>-DBSD</cflags> + </dependency> + <dependency name="curl"> + <pkgconfig>libcurl</pkgconfig> + </dependency> + <dependency name="libxml2"> + <pkgconfig>libxml-2.0</pkgconfig> + <make>xml = libxml2</make> + </dependency> + <dependency name="sqlite"> + <pkgconfig>sqlite3</pkgconfig> + </dependency> + <dependency name="test"> + <cflags>-DTEST</cflags> + </dependency> + <dependency name="gtk3"> + <pkgconfig>gtk+-5.0</pkgconfig> + </dependency> + <dependency name="gtk2"> + <pkgconfig>gtk+-2.0</pkgconfig> + </dependency> + <dependency name="qt4"> + <test>which qmake-qt4</test> + </dependency> + + <dependency name="deptest"> + <cflags>-DDEPTEST</cflags> + </dependency> + + <dependency> + <make>MVAR = 123</make> + <make>MVAR += 123</make> + </dependency> + + <target name="dav"> + <feature name="db" default="on"> + <dependencies>sqlite</dependencies> + <define name="DATABASE"/> + </feature> + <feature name="gui"> + <dependencies>gtk3</dependencies> + <define name="UI" value="GTK3" /> + </feature> + <option arg="toolkit"> + <value str="gtk3"> + <define name="a" value="b" /> + <dependencies>gtk3</dependencies> + <make>UIOBJ += graphics_cairo.o</make> + </value> + <value str="cli"> + <dependencies>curl,test</dependencies> + </value> + <value str="gtk2"> + <dependencies>gtk2</dependencies> + </value> + <value str="wpf"> + <dependencies>test</dependencies> + </value> + <default value="wpf" platform="windows" /> + <default value="gtk3" /> + <default value="gtk2" /> + </option> + <dependencies>curl,libxml2,test</dependencies> + </target> + + <target> + <dependencies>deptest</dependencies> + </target> +</project> +