Mon, 04 Feb 2019 14:46:11 +0100
new build system
--- a/application/Makefile Fri Nov 09 17:11:12 2018 +0100 +++ b/application/Makefile Mon Feb 04 14:46:11 2019 +0100 @@ -26,7 +26,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -BUILD_ROOT = .. +BUILD_ROOT = ../ include ../config.mk CFLAGS += -I../ui/ @@ -38,8 +38,8 @@ all: ../build/bin/mk12 ../build/bin/mk12: $(OBJ) $(BUILD_ROOT)/build/lib/libuitk.a - $(LD) -o ../build/bin/mk12$(APP_EXT) $(OBJ) -L$(BUILD_ROOT)/build/lib -luitk -lucx $(LDFLAGS) + $(LD) -o ../build/bin/mk12$(APP_EXT) $(OBJ) -L$(BUILD_ROOT)/build/lib -luitk -lucx $(LDFLAGS) $(TK_LDFLAGS) ../build/application/%.$(OBJ_EXT): %.c - $(CC) $(CFLAGS) -I../ -o $@ -c $< + $(CC) $(CFLAGS) $(TK_CFLAGS) -I../ -o $@ -c $<
--- a/configure Fri Nov 09 17:11:12 2018 +0100 +++ b/configure Mon Feb 04 14:46:11 2019 +0100 @@ -1,179 +1,665 @@ -#!/bin/bash -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# +#!/bin/sh + +PREFIX=/usr +EPREFIX=$PREFIX + +BINDIR= +SBINDIR= +LIBDIR= +LIBEXECDIR= +DATADIR= +SYSCONFDIR= +SHAREDSTATEDIR= +LOCALSTATEDIR= +INCLUDEDIR= +INFODIR= +MANDIR= OS=`uname -s` OS_VERSION=`uname -r` -PREFIX=/opt/toolkit + +TEMP_DIR=".tmp-`uname -n`" +mkdir -p $TEMP_DIR +if [ $? -ne 0 ]; then + echo "Cannot create tmp dir" + echo "Abort" +fi +touch $TEMP_DIR/options +touch $TEMP_DIR/features + +# features + +# help text +printhelp() +{ + echo "Usage: $0 [OPTIONS]..." + cat << __EOF__ +Installation directories: + --prefix=PREFIX path prefix for architecture-independent files + [/usr] + --exec-prefix=EPREFIX path prefix for architecture-dependent files + [PREFIX] + + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR system configuration files [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --mandir=DIR man documentation [DATAROOTDIR/man] + +Options: + --toolkit=(gtk3|gtk2|gtk2legacy|qt5|qt4|motif) + +__EOF__ +} # -# parse arguments +# parse arguments # for ARG in $@ do if [[ $ARG == --prefix=* ]]; then PREFIX=${ARG:9} - elif [[ $ARG == --toolkit=* ]]; then - # todo: check for invalid toolkit - TOOLKIT=${ARG:10} + elif [[ $ARG = --exec-prefix=* ]]; then + EPREFIX=${ARG:14} + elif [[ $ARG = --bindir=* ]]; then + BINDIR=${ARG:9} + elif [[ $ARG = --sbindir=* ]]; then + SBINDIR=${ARG:10} + elif [[ $ARG = --libdir=* ]]; then + LIBDIR=${ARG:9} + elif [[ $ARG = --libexecdir=* ]]; then + LIBEXECDIR=${ARG:13} + elif [[ $ARG = --datadir=* ]]; then + DATADIR=${ARG:10} + elif [[ $ARG = --sysconfdir=* ]]; then + SYSCONFDIR=${ARG:13} + elif [[ $ARG = --sharedstatedir=* ]]; then + SHAREDSTATEDIR=${ARG:17} + elif [[ $ARG = --localstatedir=* ]]; then + LOCALSTATEDIR=${ARG:16} + elif [[ $ARG = --includedir=* ]]; then + INCLUDEDIR=${ARG:12} + elif [[ $ARG = --infodir=* ]]; then + INFODIR=${ARG:10} + elif [[ $ARG = --mandir=* ]]; then + MANDIR=${ARG:9} elif [ $ARG = "--help" ]; then - # todo: print help text - echo "no help yet" - exit 0 + printhelp + exit 0 + elif [[ $ARG == --toolkit=* ]]; then + OPT_TOOLKIT=${ARG:10} fi done -# -# check_pkgconfig_lib() -# -# arg1: display package name -# arg2: pkg-config package name -# -check_pkgconfig_lib() -{ - printf "checking for " - printf $1 - printf "... " - pkg-config $2 - RESULT=$? - if [ $RESULT -eq 0 ]; then - echo "ok" - else - echo "not found" - echo - echo "missing package" $1 - exit -1 - fi -} - - -# -# check OS and libraries -# - -printf "checking for toolchain... " -if [ $OS = SunOS ]; then - BUILD_CONFIG=suncc - echo "suncc" +# set dir variables +if [ -z $BINDIR ]; then + BINDIR=$EPREFIX/bin +fi +if [ -z $SBINDIR ]; then + SBINDIR=$EPREFIX/sbin +fi +if [ -z $LIBDIR ]; then + LIBDIRDIR=$EPREFIX/lib +fi +if [ -z $LIBEXEC ]; then + LIBExECDIR=$EPREFIX/libexec +fi +if [ -z $DATADIR ]; then + DATADIR=$PREFIX/share +fi +if [ -z $SYSCONFDIR]; then + SYSCONFDIR=$PREFIX/etc +fi +if [ -z $SHAREDSTATEDIR ]; then + SHAREDSTATEDIR=$PREFIX/com +fi +if [ -z $LOCALSTATEDIR ]; then + LOCALSTATEDIR=$PREFIX/var +fi +if [ -z $INCLUDEDIR ]; then + INCLUDEDIR=$PREFIX/include +fi +if [ -z $INFODIR ]; then + INFODIR=$PREFIX/info +fi +if [ -z $MANDIR ]; then + MANDIR=$PREFIX/man fi -if [ $OS = Linux ]; then - BUILD_CONFIG=gcc - echo "gcc" -fi - -if [ $OS = FreeBSD ]; then - BUILD_CONFIG=clang - echo "clang" -fi - -if [ $OS = Darwin ]; then - BUILD_CONFIG=osx - echo "gcc" +which pkg-config > /dev/null +if [ $? -ne 0 ]; then + PKG_CONFIG=pkg-config +else + PKG_CONFIG=false fi -echo $OS | grep -q "MINGW" -if [ $? -eq 0 ]; then - BUILD_CONFIG=mingw - echo "mingw" +# Simple uname based platform detection +# $PLATFORM is used for platform dependent dependency selection +printf "detect platform... " +if [ $OS = SunOS ]; then + PLATFORM="solaris sunos unix svr4" +fi +if [ $OS = Linux ]; then + PLATFORM="linux unix" fi - -if [ -z "BUILD_CONFIG" ]; then - BUILD_CONFIG=gcc - echo "gcc" +if [ $OS = FreeBSD ]; then + PLATFORM="freebsd bsd unix" +fi +if [ $OS = Darwin ]; then + PLATFORM="macos osx bsd unix" +fi +echo $OS | grep "MINGW" > /dev/null +if [ $? -eq 0 ]; then + PLATFORM="windows mingw" fi - -#if [ $OS != Darwin ]; then -# check_pkgconfig_lib "libxml2" "libxml-2.0" -#fi - -if [ -z $TOOLKIT ]; then - printf "checking for gui library... " - if [ $OS = SunOS ]; then - if [ $OS_VERSION = 5.10 ]; then - TOOLKIT=gtk2legacy - else - TOOLKIT=gtk2 - fi - echo "gtk2" - elif [ $OS = Darwin ]; then - TOOLKIT=cocoa - echo "Cocoa" - else - pkg-config gtk+-3.0 - RESULT=$? - if [ $RESULT -eq 0 ]; then - TOOLKIT=gtk3 - echo "gtk3" - else - pkg-config gtk+-2.0 - RESULT=$? - if [ $RESULT -eq 0 ]; then - TOOLKIT=gtk2 - echo "gtk2" - else - which qmake-qt4 > /dev/null - RESULT=$? - if [ $RESULT -eq 0 ]; then - TOOLKIT=qt4 - echo "qt4" - else - echo "not found" - exit 1 - fi - fi - fi - fi +if [ -z "$PLATFORM" ]; then + PLATFORM="unix" fi +for p in $PLATFORM +do + PLATFORM_NAME=$p + break +done +echo $PLATFORM_NAME -# generate config.mk +isplatform() +{ + for p in $PLATFORM + do + if [ $p = $1 ]; then + return 0 + fi + done + return 1 +} -cat > config.mk << __EOF__ +# generate config.mk and config.h +cat > $TEMP_DIR/config.mk << __EOF__ # # config.mk generated by configure # +__EOF__ -PREFIX = ${PREFIX} +echo > $TEMP_DIR/make.mk + +ENV_CFLAGS=$CFLAGS +ENV_LDFLAGS=$LDFLAGS +ENV_CXXFLAGS=$CXXFLAGS + +# Toolchain detection +# this will insert make vars to config.mk +source make/toolchain.sh + +# add user specified flags to config.mk +echo >> $TEMP_DIR/config.mk +if [[ ! -z ${ENV_CFLAGS} ]]; then + echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${ENV_CXXFLAGS} ]]; then + echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${ENV_LDFLAGS} ]]; then + echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk +fi + +# +# DEPENDENCIES +# -include \$(BUILD_ROOT)/make/${BUILD_CONFIG}.mk +dependency_qt4() +{ + printf "checking for qt4... " + # dependency qt4 + while true + do + qmake-qt4 -o - /dev/null | grep DEFINES\ > /dev/null + if [ $? -eq 0 ]; then + CFLAGS+=" `qmake-qt4 -o - /dev/null | grep DEFINES\ `" + else + break + fi + qmake-qt4 -o - /dev/null | grep INCPATH\ > /dev/null + if [ $? -eq 0 ]; then + CFLAGS+=" `qmake-qt4 -o - /dev/null | grep INCPATH\ `" + else + break + fi + > /dev/null + if [ $? -eq 0 ]; then + LDFLAGS+=" ``" + else + break + fi + which qmake-qt4 > /dev/null + if [ $? -ne 0 ]; then + break + fi + echo yes + return 0 + done + + echo no + return 1 +} +dependency_gtk2legacy() +{ + printf "checking for gtk2legacy... " + # dependency gtk2legacy + while true + do + if [ -z "PKG_CONFIG" ]; then + break + fi + if ! pkg-config gtk+-2.0 ; then + break + fi + CFLAGS+=" `pkg-config --cflags gtk+-2.0`" + LDFLAGS+=" `pkg-config --libs gtk+-2.0`" + CFLAGS+="-DUI_GTK2 -DUI_GTK2LEGACY" + LDFLAGS+="-lpthread" + echo yes + return 0 + done + + echo no + return 1 +} +dependency_qt5() +{ + printf "checking for qt5... " + # dependency qt5 + while true + do + qmake-qt5 -o - /dev/null | grep DEFINES\ > /dev/null + if [ $? -eq 0 ]; then + CFLAGS+=" `qmake-qt5 -o - /dev/null | grep DEFINES\ `" + else + break + fi + qmake-qt5 -o - /dev/null | grep INCPATH\ > /dev/null + if [ $? -eq 0 ]; then + CFLAGS+=" `qmake-qt5 -o - /dev/null | grep INCPATH\ `" + else + break + fi + > /dev/null + if [ $? -eq 0 ]; then + LDFLAGS+=" ``" + else + break + fi + which qmake-qt5 > /dev/null + if [ $? -ne 0 ]; then + break + fi + 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 + break + fi + CFLAGS+=" `pkg-config --cflags gtk+-2.0`" + LDFLAGS+=" `pkg-config --libs gtk+-2.0`" + CFLAGS+="-DUI_GTK2" + LDFLAGS+="-lpthread" + pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null + if [ $? -ne 0 ]; then + break + fi + 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+-3.0 ; then + break + fi + CFLAGS+=" `pkg-config --cflags gtk+-3.0`" + LDFLAGS+=" `pkg-config --libs gtk+-3.0`" + CFLAGS+="-DUI_GTK3" + LDFLAGS+="-lpthread" + echo yes + return 0 + done + + echo no + return 1 +} +dependency_motif() +{ + printf "checking for motif... " + # dependency motif + while true + do + CFLAGS+="-DUI_MOTIF" + LDFLAGS+="-lXm -lXt -lX11 -lpthread" + echo yes + return 0 + done + + echo no + return 1 +} +dependency_wpf() +{ + printf "checking for wpf... " + # dependency wpf platform="windows" + while true + do + if ! isplatform "windows"; then + break + fi + CFLAGS+="-DUI_WPF" + echo yes + return 0 + done + + echo no + return 1 +} +dependency_cocoa() +{ + printf "checking for cocoa... " + # dependency cocoa platform="macos" + while true + do + if ! isplatform "macos"; then + break + fi + CFLAGS+="-DUI_COCOA" + LDFLAGS+="-lobjc -framework Cocoa" + echo yes + return 0 + done + + echo no + return 1 +} + +DEPENDENCIES_FAILED= +ERROR=0 + +# +# OPTION VALUES +# +checkopt_toolkit_gtk3() +{ + VERR=0 + dependency_gtk3 + if [ $? -ne 0 ]; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> $TEMP_DIR/make.mk << __EOF__ +TOOLKIT = gtk +GTKOBJ = draw_cairo.o __EOF__ + return 0 +} +checkopt_toolkit_gtk2() +{ + VERR=0 + dependency_gtk2 + if [ $? -ne 0 ]; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> $TEMP_DIR/make.mk << __EOF__ +TOOLKIT = gtk +GTKOBJ = draw_cairo.o -# toolkit config -make/configure_${TOOLKIT}.sh +__EOF__ + return 0 +} +checkopt_toolkit_gtk2legacy() +{ + VERR=0 + dependency_gtk2legacy + if [ $? -ne 0 ]; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> $TEMP_DIR/make.mk << __EOF__ +TOOLKIT = gtk +GTKOBJ = draw_gdk.o + +__EOF__ + return 0 +} +checkopt_toolkit_qt5() +{ + VERR=0 + dependency_qt5 + if [ $? -ne 0 ]; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> $TEMP_DIR/make.mk << __EOF__ +TOOLKIT = qt +LD = $(CXX) + +__EOF__ + return 0 +} +checkopt_toolkit_qt4() +{ + VERR=0 + dependency_qt4 + if [ $? -ne 0 ]; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> $TEMP_DIR/make.mk << __EOF__ +TOOLKIT = qt +LD = $(CXX) + +__EOF__ + return 0 +} +checkopt_toolkit_motif() +{ + VERR=0 + dependency_motif + if [ $? -ne 0 ]; then + VERR=1 + fi + if [ $VERR -ne 0 ]; then + return 1 + fi + cat >> $TEMP_DIR/make.mk << __EOF__ +TOOLKIT = motif + +__EOF__ + return 0 +} + +# +# TARGETS +# +CFLAGS= +CXXFLAGS= +LDFLAGS= + +# Target: tk +CFLAGS= +LDFLAGS= +CXXFLAGS= + +# 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 + if isplatform "macos"; then + checkopt_toolkit_cocoa + if [ $? -eq 0 ]; then + echo " toolkit: cocoa" >> $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_qt5 + if [ $? -eq 0 ]; then + echo " toolkit: qt5" >> $TEMP_DIR/options + ERROR=0 + break + fi + checkopt_toolkit_gtk2 + if [ $? -eq 0 ]; then + echo " toolkit: gtk2" >> $TEMP_DIR/options + ERROR=0 + break + fi + checkopt_toolkit_qt4 + if [ $? -eq 0 ]; then + echo " toolkit: qt4" >> $TEMP_DIR/options + ERROR=0 + break + fi + checkopt_toolkit_motif + if [ $? -eq 0 ]; then + echo " toolkit: motif" >> $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 = "gtk2" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + checkopt_toolkit_gtk2 + if [ $? -ne 0 ]; then + ERROR=1 + fi + elif [ $OPT_TOOLKIT = "gtk2legacy" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + checkopt_toolkit_gtk2legacy + if [ $? -ne 0 ]; then + ERROR=1 + fi + elif [ $OPT_TOOLKIT = "qt5" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + checkopt_toolkit_qt5 + if [ $? -ne 0 ]; then + ERROR=1 + fi + elif [ $OPT_TOOLKIT = "qt4" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + checkopt_toolkit_qt4 + if [ $? -ne 0 ]; then + ERROR=1 + fi + elif [ $OPT_TOOLKIT = "motif" ]; then + echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options + checkopt_toolkit_motif + if [ $? -ne 0 ]; then + ERROR=1 + fi + fi +fi + +echo >> $TEMP_DIR/config.mk +if [[ ! -z ${CFLAGS} ]]; then + echo "TK_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${CXXFLAGS} ]]; then + echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${LDFLAGS} ]]; then + echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +fi + +if [ $ERROR -ne 0 ]; then + echo + echo "Error: Unresolved dependencies" + echo $DEPENCIES_FAILED + rm -Rf $TEMP_DIR + exit 1 +fi echo "configure finished" echo -echo " PREFIX: $PREFIX" -echo " BUILD_CONFIG: $BUILD_CONFIG" -echo " TOOLKIT: $TOOLKIT" +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/make/Makefile.mk Fri Nov 09 17:11:12 2018 +0100 +++ b/make/Makefile.mk Mon Feb 04 14:46:11 2019 +0100 @@ -28,7 +28,7 @@ # this makefile is invoked from the build root directory -BUILD_ROOT = . +BUILD_ROOT = ./ include config.mk BUILD_DIRS = build/bin build/lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/configure.vm Mon Feb 04 14:46:11 2019 +0100 @@ -0,0 +1,500 @@ +#!/bin/sh + +PREFIX=/usr +EPREFIX=$PREFIX + +BINDIR= +SBINDIR= +LIBDIR= +LIBEXECDIR= +DATADIR= +SYSCONFDIR= +SHAREDSTATEDIR= +LOCALSTATEDIR= +INCLUDEDIR= +INFODIR= +MANDIR= + +OS=`uname -s` +OS_VERSION=`uname -r` + +TEMP_DIR=".tmp-`uname -n`" +mkdir -p $TEMP_DIR +if [ $? -ne 0 ]; then + echo "Cannot create tmp dir" + echo "Abort" +fi +touch $TEMP_DIR/options +touch $TEMP_DIR/features + +# features +#foreach( $feature in $features ) +#if( ${feature.isDefault()} ) +${feature.getVarName()}=on +#end +#end + +# help text +printhelp() +{ + echo "Usage: $0 [OPTIONS]..." + cat << __EOF__ +Installation directories: + --prefix=PREFIX path prefix for architecture-independent files + [/usr] + --exec-prefix=EPREFIX path prefix for architecture-dependent files + [PREFIX] + + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR system configuration files [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --mandir=DIR man documentation [DATAROOTDIR/man] + +#if( $options.size() > 0 ) +Options: +#foreach( $opt in $options ) + --${opt.getArgument()}=${opt.getValuesString()} +#end + +#end +#if( $features.size() > 0 ) +Optional Features: +#foreach( $feature in $features ) +#if( $feature.default ) + --disable-${feature.arg} +#else + --enable-${feature.arg} +#end +#end + +#end +__EOF__ +} + +# +# parse arguments +# +#set( $D = '$' ) +for ARG in $@ +do + if [[ $ARG == --prefix=* ]]; then + PREFIX=${D}{ARG:9} + elif [[ $ARG = --exec-prefix=* ]]; then + EPREFIX=${D}{ARG:14} + elif [[ $ARG = --bindir=* ]]; then + BINDIR=${D}{ARG:9} + elif [[ $ARG = --sbindir=* ]]; then + SBINDIR=${D}{ARG:10} + elif [[ $ARG = --libdir=* ]]; then + LIBDIR=${D}{ARG:9} + elif [[ $ARG = --libexecdir=* ]]; then + LIBEXECDIR=${D}{ARG:13} + elif [[ $ARG = --datadir=* ]]; then + DATADIR=${D}{ARG:10} + elif [[ $ARG = --sysconfdir=* ]]; then + SYSCONFDIR=${D}{ARG:13} + elif [[ $ARG = --sharedstatedir=* ]]; then + SHAREDSTATEDIR=${D}{ARG:17} + elif [[ $ARG = --localstatedir=* ]]; then + LOCALSTATEDIR=${D}{ARG:16} + elif [[ $ARG = --includedir=* ]]; then + INCLUDEDIR=${D}{ARG:12} + elif [[ $ARG = --infodir=* ]]; then + INFODIR=${D}{ARG:10} + elif [[ $ARG = --mandir=* ]]; then + MANDIR=${D}{ARG:9} + elif [ $ARG = "--help" ]; then + printhelp + exit 0 + #foreach( $opt in $options ) + elif [[ $ARG == --${opt.getArgument()}=* ]]; then + ${opt.getVarName()}=${opt.getArgValue()} + #end + #foreach( $feature in $features ) + elif [[ $ARG == --enable-${feature.arg} ]]; then + ${feature.getVarName()}=on + elif [[ $ARG == --disable-${feature.arg} ]]; then + unset ${feature.getVarName()} + #end + fi +done + +# set dir variables +if [ -z $BINDIR ]; then + BINDIR=$EPREFIX/bin +fi +if [ -z $SBINDIR ]; then + SBINDIR=$EPREFIX/sbin +fi +if [ -z $LIBDIR ]; then + LIBDIRDIR=$EPREFIX/lib +fi +if [ -z $LIBEXEC ]; then + LIBExECDIR=$EPREFIX/libexec +fi +if [ -z $DATADIR ]; then + DATADIR=$PREFIX/share +fi +if [ -z $SYSCONFDIR]; then + SYSCONFDIR=$PREFIX/etc +fi +if [ -z $SHAREDSTATEDIR ]; then + SHAREDSTATEDIR=$PREFIX/com +fi +if [ -z $LOCALSTATEDIR ]; then + LOCALSTATEDIR=$PREFIX/var +fi +if [ -z $INCLUDEDIR ]; then + INCLUDEDIR=$PREFIX/include +fi +if [ -z $INFODIR ]; then + INFODIR=$PREFIX/info +fi +if [ -z $MANDIR ]; then + MANDIR=$PREFIX/man +fi + +which pkg-config > /dev/null +if [ $? -ne 0 ]; then + PKG_CONFIG=pkg-config +else + PKG_CONFIG=false +fi + +# Simple uname based platform detection +# $PLATFORM is used for platform dependent dependency selection +printf "detect platform... " +if [ $OS = SunOS ]; then + PLATFORM="solaris sunos unix svr4" +fi +if [ $OS = Linux ]; then + PLATFORM="linux unix" +fi +if [ $OS = FreeBSD ]; then + PLATFORM="freebsd bsd unix" +fi +if [ $OS = Darwin ]; then + PLATFORM="macos osx bsd unix" +fi +echo $OS | grep "MINGW" > /dev/null +if [ $? -eq 0 ]; then + PLATFORM="windows mingw" +fi + +if [ -z "$PLATFORM" ]; then + PLATFORM="unix" +fi + +for p in $PLATFORM +do + PLATFORM_NAME=$p + break +done +echo $PLATFORM_NAME + +isplatform() +{ + for p in $PLATFORM + do + if [ $p = $1 ]; then + return 0 + fi + done + return 1 +} + +# generate config.mk and config.h +cat > $TEMP_DIR/config.mk << __EOF__ +# +# config.mk generated by configure +# +__EOF__ + +echo > $TEMP_DIR/make.mk + +ENV_CFLAGS=$CFLAGS +ENV_LDFLAGS=$LDFLAGS +ENV_CXXFLAGS=$CXXFLAGS + +# Toolchain detection +# this will insert make vars to config.mk +source make/toolchain.sh + +# add user specified flags to config.mk +echo >> $TEMP_DIR/config.mk +if [[ ! -z ${ENV_CFLAGS} ]]; then + echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${ENV_CXXFLAGS} ]]; then + echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${ENV_LDFLAGS} ]]; then + echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk +fi + +# +# DEPENDENCIES +# + +#foreach( $dependency in $namedDependencies ) +dependency_${dependency.name}() +{ + printf "checking for ${dependency.name}... " + #foreach( $sub in $dependency.getSubdependencies() ) + # dependency $sub.name $sub.getPlatformString() + while true + do + #if( $sub.platform ) + if ! isplatform "${sub.platform}"; then + break + fi + #end + #if( $sub.pkgconfig.size() > 0 ) + if [ -z "PKG_CONFIG" ]; then + break + fi + #end + #foreach( $pkg in $sub.pkgconfig ) + if ! pkg-config $pkg.getPkgConfigParam() ; then + break + fi + CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`" + 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`" + else + break + fi + #else + $flags.varName+="$flags.value" + #end + #end + #foreach( $test in $sub.tests ) + $test > /dev/null + if [ $? -ne 0 ]; then + break + fi + #end + echo yes + return 0 + done + + #end + echo no + return 1 +} +#end + +DEPENDENCIES_FAILED= +ERROR=0 +#if( $dependencies.size() > 0 ) +# general dependencies +CFLAGS= +LDFLAGS= +#foreach( $dependency in $dependencies ) +while true +do + #if( $dependency.platform ) + if ! isplatform "${sub.platform}"; then + break + fi + #end + while true + do + #if( $dependency.pkgconfig.size() > 0 ) + if [ -z "PKG_CONFIG" ]; then + ERROR=1 + break + fi + #end + #foreach( $pkg in $dependency.pkgconfig ) + printf "checking for pkg-config package $pkg.getPkgConfigParam()... " + if ! pkg-config $pkg.getPkgConfigParam() ; then + echo no + ERROR=1 + break + fi + echo yes + CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`" + 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`" + else + ERROR=1 + break + fi + #else + $flags.varName+="$flags.value" + #end + #end + + break + done + + break +done +#end + +# add general dependency flags to config.mk +echo >> $TEMP_DIR/config.mk +if [[ ! -z ${CFLAGS} ]]; then + echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${CXXFLAGS} ]]; then + echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${LDFLAGS} ]]; then + echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk +fi +#end + +# +# OPTION VALUES +# +#foreach( $opt in $options ) +#foreach( $val in $opt.values ) +${val.func}() +{ + VERR=0 + #foreach( $dep in $val.dependencies ) + dependency_$dep + if [ $? -ne 0 ]; then + VERR=1 + fi + #end + if [ $VERR -ne 0 ]; then + return 1 + fi + #foreach( $def in $val.defines ) + CFLAGS+=" ${def.toFlags()}" + #end + #if( $val.hasMake() ) + cat >> $TEMP_DIR/make.mk << __EOF__ +$val.make +__EOF__ + #end + return 0 +} +#end +#end + +# +# TARGETS +# +CFLAGS= +CXXFLAGS= +LDFLAGS= + +#foreach( $target in $targets ) +#if ( $target.name ) +# Target: $target.name +#else +# Target +#end +CFLAGS= +LDFLAGS= +CXXFLAGS= + +#foreach( $dependency in $target.dependencies ) +dependency_$dependency +if [ $? -ne 0 ]; then + DEPENDENCIES_FAILED+="${dependency} " + ERROR=1 +fi +#end + +#foreach( $opt in $target.options ) +# Option: --${opt.argument} +if [ -z ${D}${opt.getVarName()} ]; then + SAVED_ERROR=$ERROR + SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED + ERROR=0 + while true + do + #foreach( $optdef in $opt.defaults ) + #if( $optdef.platform ) + if isplatform "$optdef.platform"; then + #end + $optdef.func + if [ $? -eq 0 ]; then + echo " ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options + ERROR=0 + break + fi + #if( $optdef.platform ) + fi + #end + #end + break + done + if [ $ERROR -ne 0 ]; then + SAVED_ERROR=1 + fi + ERROR=$SAVED_ERROR + DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= +else + if false; then + false + #foreach( $optval in $opt.values ) + elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then + echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options + $optval.func + if [ $? -ne 0 ]; then + ERROR=1 + fi + #end + fi +fi +#end + +echo >> $TEMP_DIR/config.mk +if [[ ! -z ${CFLAGS} ]]; then + echo "${target.getCFlags()} += $CFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${CXXFLAGS} ]]; then + echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk +fi +if [[ ! -z ${LDFLAGS} ]]; then + echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk +fi + +#end +if [ $ERROR -ne 0 ]; then + echo + echo "Error: Unresolved dependencies" + echo $DEPENCIES_FAILED + rm -Rf $TEMP_DIR + exit 1 +fi + +echo "configure finished" +echo +echo "Build Config:" +echo " PREFIX: $PREFIX" +echo " TOOLCHAIN: $TOOLCHAIN_NAME" +#if ( $options.size() > 0 ) +echo "Options:" +cat $TEMP_DIR/options +#end +echo +cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk +rm -Rf $TEMP_DIR + +
--- a/make/configure_cocoa.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -TK_CFLAGS="-DUI_COCOA `xml2-config --cflags`" -TK_LDFLAGS="-lobjc -framework Cocoa `xml2-config --libs`" - -cat >> config.mk << __EOF__ - -# toolkit configuration -CFLAGS += $TK_CFLAGS - -LDFLAGS += $TK_LDFLAGS - -TOOLKIT = cocoa - -__EOF__ - - - - - -
--- a/make/configure_gtk2.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -TK_CFLAGS="-DUI_GTK2 `pkg-config --cflags gtk+-2.0 libxml-2.0`" - -TK_LDFLAGS="`pkg-config --libs gtk+-2.0 libxml-2.0` -lpthread" - -cat >> config.mk << __EOF__ - -# toolkit configuration -CFLAGS += $TK_CFLAGS - -LDFLAGS += $TK_LDFLAGS - -TOOLKIT = gtk - -GTKOBJ = draw_cairo.o - -__EOF__ - - - - - -
--- a/make/configure_gtk2legacy.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -TK_CFLAGS="-DUI_GTK2 -DUI_GTK2LEGACY " -TK_CFLAGS="$TK_CFLAGS `pkg-config --cflags gtk+-2.0 libxml-2.0`" - -TK_LDFLAGS="`pkg-config --libs gtk+-2.0 libxml-2.0` -lpthread" - -cat >> config.mk << __EOF__ - -# toolkit configuration -CFLAGS += $TK_CFLAGS - -LDFLAGS += $TK_LDFLAGS - -TOOLKIT = gtk - -GTKOBJ = draw_gdk.o - -__EOF__ - - - - - -
--- a/make/configure_gtk3.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -TK_CFLAGS="-DUI_GTK3 `pkg-config --cflags gtk+-3.0 libxml-2.0`" - -TK_LDFLAGS="`pkg-config --libs gtk+-3.0 libxml-2.0` -lpthread" - -cat >> config.mk << __EOF__ - -# toolkit configuration -CFLAGS += $TK_CFLAGS - -LDFLAGS += $TK_LDFLAGS - -TOOLKIT = gtk - -GTKOBJ = draw_cairo.o - -__EOF__ - - - - - -
--- a/make/configure_motif.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -TK_CFLAGS="-DUI_MOTIF " - -TK_LDFLAGS="-lXm -lXt -lX11 -lpthread" - -cat >> config.mk << __EOF__ - -# toolkit configuration -CFLAGS += $TK_CFLAGS - -LDFLAGS += $TK_LDFLAGS - -TOOLKIT = motif - -__EOF__
--- a/make/configure_qt4.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -touch test.pro -TK_LIBS=`qmake-qt4 -o - test.pro | grep LIBS\ ` -rm -f test.pro - - -cat >> config.mk << __EOF__ - -# toolkit configuration - -CFLAGS += -DUI_QT4 -$TK_LIBS -LDFLAGS += \$(LIBS) - -TOOLKIT = qt - -# override linker -LD = \$(CXX) - -__EOF__ - - - - - -
--- a/make/configure_wpf.sh Fri Nov 09 17:11:12 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2011 Olaf Wintermann. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -TK_CFLAGS="-DUI_WPF " - -TK_LDFLAGS="\$(BUILD_ROOT)/build/UIwrapper/UIwrapper.lib" - -cat >> config.mk << __EOF__ - -# toolkit configuration -CFLAGS += $TK_CFLAGS - -LDFLAGS += $TK_LDFLAGS - -TOOLKIT = wpf - -__EOF__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/project.xml Mon Feb 04 14:46:11 2019 +0100 @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <dependency name="gtk3"> + <pkgconfig>gtk+-3.0</pkgconfig> + <cflags>-DUI_GTK3</cflags> + <ldflags>-lpthread</ldflags> + </dependency> + <dependency name="gtk2"> + <test>pkg-config --atleast-version=2.20 gtk+-2.0</test> + <pkgconfig>gtk+-2.0</pkgconfig> + <cflags>-DUI_GTK2</cflags> + <ldflags>-lpthread</ldflags> + </dependency> + <dependency name="gtk2legacy"> + <pkgconfig>gtk+-2.0</pkgconfig> + <cflags>-DUI_GTK2 -DUI_GTK2LEGACY</cflags> + <ldflags>-lpthread</ldflags> + </dependency> + <dependency name="wpf" platform="windows"> + <cflags>-DUI_WPF</cflags> + </dependency> + <dependency name="qt4"> + <test>which qmake-qt4</test> + <cflags type="exec">qmake-qt4 -o - /dev/null | grep DEFINES\ </cflags> + <cflags type="exec">qmake-qt4 -o - /dev/null | grep INCPATH\ </cflags> + <ldflags type="exec"><cflags type="exec">qmake-qt4 -o - /dev/null | grep LIBS\ </cflags></ldflags> + </dependency> + <dependency name="qt5"> + <test>which qmake-qt5</test> + <cflags type="exec">qmake-qt5 -o - /dev/null | grep DEFINES\ </cflags> + <cflags type="exec">qmake-qt5 -o - /dev/null | grep INCPATH\ </cflags> + <ldflags type="exec"><cflags type="exec">qmake-qt5 -o - /dev/null | grep LIBS\ </cflags></ldflags> + </dependency> + <dependency name="cocoa" platform="macos"> + <cflags>-DUI_COCOA</cflags> + <ldflags>-lobjc -framework Cocoa</ldflags> + </dependency> + <dependency name="motif"> + <cflags>-DUI_MOTIF</cflags> + <ldflags>-lXm -lXt -lX11 -lpthread</ldflags> + </dependency> + + <target name="tk"> + <option arg="toolkit"> + <value str="gtk3"> + <dependencies>gtk3</dependencies> + <make>TOOLKIT = gtk</make> + <make>GTKOBJ = draw_cairo.o</make> + </value> + <value str="gtk2"> + <dependencies>gtk2</dependencies> + <make>TOOLKIT = gtk</make> + <make>GTKOBJ = draw_cairo.o</make> + </value> + <value str="gtk2legacy"> + <dependencies>gtk2legacy</dependencies> + <make>TOOLKIT = gtk</make> + <make>GTKOBJ = draw_gdk.o</make> + </value> + <value str="qt5"> + <dependencies>qt5</dependencies> + <make>TOOLKIT = qt</make> + <make>LD = $(CXX)</make> + </value> + <value str="qt4"> + <dependencies>qt4</dependencies> + <make>TOOLKIT = qt</make> + <make>LD = $(CXX)</make> + </value> + <value str="motif"> + <dependencies>motif</dependencies> + <make>TOOLKIT = motif</make> + </value> + <default value="wpf" platform="windows" /> + <default value="cocoa" platform="macos" /> + <default value="gtk3" /> + <default value="qt5" /> + <default value="gtk2" /> + <default value="qt4" /> + <default value="motif" /> + </option> + </target> +</project> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/toolchain.sh Mon Feb 04 14:46:11 2019 +0100 @@ -0,0 +1,68 @@ +#!/bin/sh +# +# toolchain detection +# + +COMPILERS="cc gcc clang suncc" +unset CC_ARG_CHECKED +unset TOOLCHAIN_DETECTION_ERROR +unset TOOLCHAIN_NAME + +check_compiler() +{ + cat > $TEMP_DIR/test.c << __EOF__ +/* test file */ +#include <stdio.h> +int main(int argc, char **argv) { +#if defined(__GNUC__) + printf("gcc\n"); +#elif defined(__clang__) + printf("clang\n"); +#elif defined(__sun) + printf("suncc\n"); +#else + printf("unknown\n"); +#endif + return 0; +} +__EOF__ + rm -f $TEMP_DIR/checkcc + $1 -o $TEMP_DIR/checkcc $CFLAGS $LDFLAGS $TEMP_DIR/test.c + + if [ $? -ne 0 ]; then + return 1 + fi + return 0 +} + +printf "detect toolchain... " + +for COMP in $COMPILERS +do + check_compiler $COMP + if [ $? -ne 0 ]; then + if [ $COMP = $CC ]; then + echo "$CC is not a working C Compiler" + TOOLCHAIN_DETECTION_ERROR="error" + break + fi + else + TOOLCHAIN_NAME=`$TEMP_DIR/checkcc` + TOOLCHAIN_CC=$COMP + echo $TOOLCHAIN_NAME + break + fi +done + +TOOLCHAIN_LD=$TOOLCHAIN_CC + +if [ -z TOOLCHAIN_NAME ]; then + TOOLCHAIN_DETECTION_ERROR="error" +else + echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk + echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk + + if [ -e "make/${TOOLCHAIN_NAME}.mk" ]; then + echo "include \$(BUILD_ROOT)make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk + fi +fi
--- a/ucx/Makefile Fri Nov 09 17:11:12 2018 +0100 +++ b/ucx/Makefile Mon Feb 04 14:46:11 2019 +0100 @@ -26,7 +26,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -BUILD_ROOT = .. +BUILD_ROOT = ../ include ../config.mk # list of source files
--- a/ui/Makefile Fri Nov 09 17:11:12 2018 +0100 +++ b/ui/Makefile Mon Feb 04 14:46:11 2019 +0100 @@ -26,7 +26,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -BUILD_ROOT = .. +BUILD_ROOT = ../ include ../config.mk OBJ_DIR = ../build/ @@ -43,5 +43,5 @@ include $(TOOLKIT)/Makefile $(COMMON_OBJPRE)%.o: common/%.c - $(CC) -o $@ -c $(CFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(TK_CFLAGS) $<