From c3a783bd13673bcb8a77d35cfc033b4b34287040 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Mon, 9 Jun 2014 21:52:55 +0200 Subject: [PATCH] renovate build system --- .gitignore | 3 +- Makefile.in | 42 +++++++++++++ build.sh | 102 ------------------------------- common.pri | 2 +- configure | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/build.html | 32 +++++----- skid.config.template | 59 ------------------ 7 files changed, 224 insertions(+), 179 deletions(-) create mode 100644 Makefile.in delete mode 100755 build.sh create mode 100755 configure delete mode 100644 skid.config.template diff --git a/.gitignore b/.gitignore index 6d906b9..b72f86c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ build*/ .kdev* version.h versiontr.h -skid.config -.skidconfig.pri +*.kdev* diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..49bd77a --- /dev/null +++ b/Makefile.in @@ -0,0 +1,42 @@ +all: build + +include skidconfig.make + +build: build-qt build-inc build-doc + +install: install-qt install-inc install-doc install-prf + + +build-qt: + cd tmp ; $(MAKE) + #win32 specific + -cp -f $(LIBDIR)/*.dll $(BINDIR) || true + +build-inc: + mkdir -p $(INCDIR) + for idir in $(SRCDIR)/runnerlib/*/include ; do \ + tdir=$$(basename $$(dirname $$idir)) ; \ + cp -ra $$idir $(INCDIR)/$$tdir ; \ + done + +build-doc--basic: + cp -a $(SRCDIR)/doc $(DOCDIR) + +install-qt: build-qt + mkdir -p $(SYSROOT)/$(PREFIX)/bin + cp -a $(BINDIR)/* $(SYSROOT)/$(PREFIX)/bin + mkdir -p $(SYSROOT)/$(PREFIX)/lib + cp -a $(LIBDIR)/* $(SYSROOT)/$(PREFIX)/lib + +install-inc: build-inc + mkdir -p $(SYSROOT)/$(PREFIX)/include + cp -a $(INCDIR)/* $(SYSROOT)/$(PREFIX)/include + +install-doc: build-doc + mkdir -p $(SYSROOT)/$(PREFIX)/doc + cp -a $(DOCDIR)/* $(SYSROOT)/$(PREFIX)/doc + +install-prf: install-qt + cp $(BUILDDIR)/skid.prf $(SYSROOT)/$(QT_INSTALL_DATA)/mkspecs/features/skid.prf + +#here follow generated rules for doc \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index 4d19578..0000000 --- a/build.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh - -set -e - -#detect where the script is -CDIR=$(pwd) -SDIR=$(dirname $0) -cd "$SDIR" -SDIR="$(pwd)" - -#get Build directory -cd "$CDIR" -if test $# -lt 1 ; then - echo Usage: $0 '' - exit 1 -fi -BUILDDIR=$1 - -#load configuration, set defaults -test -z "$QMAKE" && QMAKE=qmake -test -z "$MAKE" && MAKE=make -test -z "$DOXYGEN" && DOXYGEN=doxygen - -if test -f skid.config ; then - . ./skid.config -fi - -test -z "$MAKEFLAGS" && { - test $(uname -s) = Linux && { - JOBS=$(expr $(cat /proc/cpuinfo |grep '^processor'|wc -l) + 1) - MAKEFLAGS="-j$JOBS" - } - test $(uname -s|cut -c 1-7) = MINGW32 && { - MAKEFLAGS="-j$NUMBER_OF_PROCESSORS" - } -} - - -#house keeping: check and prepare build dir -cd $CDIR -test -e $BUILDDIR && { - test $(ls $BUILDDIR | wc -l) -gt 0 && { - echo Build directory $BUILDDIR is not empty. - exit 1 - } -} - -mkdir -p $BUILDDIR || { - echo Unable to create build directory $BUILDDIR . - exit 1 -} -cd $BUILDDIR -BUILDDIR=$(pwd) -mkdir tmp target - - -#start building... -export BINDIR=$BUILDDIR/target/bin -export LIBDIR=$BUILDDIR/target/lib -export DOCDIR=$BUILDDIR/target/doc -export INCDIR=$BUILDDIR/target/include -CFGPRI=$SDIR/.skidconfig.pri -rm -f $CFGPRI -echo '#This is a generated file.' >$CFGPRI -echo BINDIR = $BINDIR >>$CFGPRI -echo LIBDIR = $LIBDIR >>$CFGPRI -echo DOCDIR = $DOCDIR >>$CFGPRI -echo INCDIR = $INCDIR >>$CFGPRI - -#build Qt components -cd tmp -$QMAKE $QMAKEFLAGS $SDIR/skid.pro -$MAKE $MAKEFLAGS -cd $BUILDDIR - -#win32: copy DLLs -cp -f $LIBDIR/*.dll $BINDIR || true - -#build other components... - - -#copy include files -mkdir -p $INCDIR -for idir in $SDIR/runnerlib/*/include ; do - tdir=$(basename $(dirname $idir)) - cp -ra $idir $INCDIR/$tdir -done - -#generate documentation -cp -ra $SDIR/doc $DOCDIR - -for dox in $(find $SDIR -name Doxyfile) ; do - cd $(dirname $dox) - export SRCDIR=$(pwd) - export DOXYDIR=$DOCDIR/$(basename $(pwd)) - $DOXYGEN -done - - -echo -echo Done. -exit 0 diff --git a/common.pri b/common.pri index 94ddc2a..0568833 100644 --- a/common.pri +++ b/common.pri @@ -33,4 +33,4 @@ linux-g++* { ############ # Include BUILD-Configuration -include ( .skidconfig.pri ) \ No newline at end of file +include ( $$BUILDDIR/skidconfig.pri ) \ No newline at end of file diff --git a/configure b/configure new file mode 100755 index 0000000..33a5bdb --- /dev/null +++ b/configure @@ -0,0 +1,163 @@ +#!/bin/sh + +set -e + +#defaults +DOXYGEN=doxygen +QMAKE=qmake +MAKE=make +MKSPEC=default +BUILDDIR="`dirname $0`/build" +PREFIX=/usr/local/skid + +#Usage output +helpme() +{ + echo "Usage: $0 [options...]" >&2 + echo " -d|--doxygen=/path/to/doxygen" >&2 + echo " sets the Doxygen binary to use for generating documentation" >&2 + echo " -q|--qmake=/path/to/qmake" >&2 + echo " sets the path to QMake, used for Qt based components" >&2 + echo " -m|--mkspec=spec" >&2 + echo " sets an alternative Qt platform mkspec, normally the default spec is used" >&2 + echo " currently SKID requires a spec that results in a makefile" >&2 + echo " -M|--make=/path/to/make" >&2 + echo " sets the path to Make (GNU Make is preferred)" >&2 + echo " -b|--build=build-dir" >&2 + echo " the directory in which the build is performed," >&2 + echo " it must not exist yet at configure time!" >&2 + echo " The default is $BUILDDIR" >&2 + echo " -p|--prefix=$PREFIX" >&2 + echo " sets the prefix to install into, default is $PREFIX" >&2 + echo " -h|--help" >&2 + echo " prints this help" >&2 + exit $1 +} + + + +TEMP=$(getopt -o hd:q:m:M:b:p: --long help,doxygen:,qmake:,mkspec:,make:,build:,prefix: -n "$0" -- "$@") +if [ $? != 0 ] ; then helpme 1 ; fi + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +while true ; do + case "$1" in + -h|--help) helpme 0 ; shift ;; + -d|--doxygen) DOXYGEN="$2" ; shift 2 ;; + -q|--qmake) QMAKE="$2" ; shift 2 ;; + -m|--mkspec) MKSPEC="$2" ; shift 2 ;; + -M|--make) MAKE="$2" ; shift 2 ;; + -b|--build) BUILDDIR="$2" ; shift 2 ;; + -p|--prefix) PREFIX="$2" ; shift 2 ;; + --) shift ; break ;; + *) echo "Internal error! (unhandled option $1)" ; exit 1 ;; + esac +done + +#detect where the script is +CDIR=$(pwd) +SDIR=$(dirname $0) +cd "$SDIR" +SDIR="$(pwd)" + +#get Build directory +cd "$CDIR" + +#house keeping: check and prepare build dir +cd $CDIR +test -e $BUILDDIR && { + echo Build directory $BUILDDIR exists. Please remove it and try again. + exit 1 +} + +mkdir -p $BUILDDIR || { + echo Unable to create build directory $BUILDDIR . + exit 1 +} +cd $BUILDDIR +BUILDDIR=$(pwd) +mkdir tmp target + + +#create config files +export BINDIR=$BUILDDIR/target/bin +export LIBDIR=$BUILDDIR/target/lib +export DOCDIR=$BUILDDIR/target/doc +export INCDIR=$BUILDDIR/target/include + +CFG=$BUILDDIR/skidconfig.pri +rm -f $CFG +echo '#This is a generated file.' >$CFG +echo BINDIR = $BINDIR >>$CFG +echo LIBDIR = $LIBDIR >>$CFG +echo DOCDIR = $DOCDIR >>$CFG +echo INCDIR = $INCDIR >>$CFG + +CFG=$BUILDDIR/skidconfig.sh +rm -f $CFG +echo '#This is a generated file.' >$CFG +echo BINDIR = \'$BINDIR\' >>$CFG +echo LIBDIR = \'$LIBDIR\' >>$CFG +echo DOCDIR = \'$DOCDIR\' >>$CFG +echo INCDIR = \'$INCDIR\' >>$CFG +echo PREFIX = \'$PREFIX\' >>$CFG +echo BUILDDIR = \'$BUILDDIR\' >>$CFG +echo SRCDIR = \'$SDIR\' >>$CFG +echo QMAKE = \'$QMAKE\' >>$CFG +echo MAKE = \'$MAKE\' >>$CFG +echo MKSPEC = \'$MKSPEC\' >>$CFG +echo DOXYGEN = \'$DOXYGEN\' >>$CFG +echo '#QMake settings' >>$CFG +qmake -query | sed 's/:/=\"/' |sed 's/$/\"/' >>$CFG + +CFG=$BUILDDIR/skidconfig.make +rm -f $CFG +echo '#This is a generated file.' >$CFG +echo BINDIR = $BINDIR >>$CFG +echo LIBDIR = $LIBDIR >>$CFG +echo DOCDIR = $DOCDIR >>$CFG +echo INCDIR = $INCDIR >>$CFG +echo PREFIX = $PREFIX >>$CFG +echo BUILDDIR = $BUILDDIR >>$CFG +echo SRCDIR = $SDIR >>$CFG +echo QMAKE = $QMAKE >>$CFG +echo MKSPEC = $MKSPEC >>$CFG +echo DOXYGEN = $DOXYGEN >>$CFG +echo '#QMake settings' >>$CFG +qmake -query | sed 's/:/=/' >>$CFG + +#create makefile +cp $SDIR/Makefile.in $BUILDDIR/Makefile +echo >>$BUILDDIR/Makefile +echo >>$BUILDDIR/Makefile +DOCS=build-doc--basic +for dox in $(find $SDIR -name Doxyfile) ; do + DDIR="$(dirname $dox)" + BDIR="$(basename $DDIR)" + TDIR="$DOCDIR/$BDIR" + echo "build-doc-$BDIR:" >>$BUILDDIR/Makefile + echo "\\tcd $DDIR ; SRCDIR=\"$DDIR\" DOXYDIR=\"$TDIR\" \$(DOXYGEN)" >>$BUILDDIR/Makefile + echo >>$BUILDDIR/Makefile + DOCS="$DOCS build-doc-$BDIR" +done +echo "build-doc: $DOCS" >>$BUILDDIR/Makefile + +#generate Qt makefile +cd tmp +if [ -z "$MKSPEC" -o "$MKSPEC" = "default" ] ; then QMAKEFLAGS="" ; else QMAKEFLAGS="-spec $MKSPEC" ; fi +$QMAKE $QMAKEFLAGS "BUILDDIR=$BUILDDIR" $SDIR/skid.pro + +#generate prf file +PRF=$BUILDDIR/skid.prf +rm -f $PRF +echo SKID_LIBDIR = $PREFIX/lib >>$PRF +echo SKID_INCDIR = $PREFIX/include/skid >>$PRF +echo 'CONFIG += c++11 exceptions' >>$PRF +echo 'INCLUDEPATH += $$SKID_INCDIR' >>$PRF +echo 'LIBS += -L$$SKID_LIBDIR -lrunnerqt5' >>$PRF + +#done +echo "Configuration done. Please call $MAKE -C $BUILDDIR" +exit 0 diff --git a/doc/build.html b/doc/build.html index 139551e..49b9390 100644 --- a/doc/build.html +++ b/doc/build.html @@ -21,23 +21,23 @@
  • OpenSSH is an option for starting remote agents
  • -

    Configuring the Build Environment

    +

    Overview

    -

    The defaults for building SKID are correct for most Linux-like environments, but may need to be changed if you want to use different tools or if you are on another platform.

    +

    SKID is built using the usual "trinity": configure - make - make install.

    -

    Copy the skid.config.template file to skid.config, then follow the instructions in the file for changing settings.

    +

    It is always built into a separate directory. It is set at configure time and per default it is named build.

    -

    Linux, Unix

    +

    The configure script takes arguments to configure where to find the tools, and where to install the completed SKID binaries and libraries. Call ./configure --help to get possible options.

    + +

    The build-directory will be separated into two sub-directories: tmp contains temporary files (like object files, moc files, etc.), target contains a template for installation with final binaries, libraries, and documentation.

    -

    The build.sh script can be used to build SKID. For example like this:

    +

    Linux, Unix

    -
    -./build.sh builddir
    -
    +

    Open a Shell and call ./configure to configure the build. Add options to change tools, target directories, etc. You can set the build-directory by adding the option --build=directory - the default is the directory build.

    -

    The script has to be called with the name of an empty (or not yet existing) directory as a parameter.

    +

    Call make -C build to build SKID (replace build with the correct build-directory) to compile SKID. You may add more options (like -j3 to parallelize) if you like.

    -

    It will build all components, create documentation and place the result in builddir/target.

    +

    To install SKID call make -C build install - SKID will be copied to the configured prefix directory. You may need root privileges to do the installation. You may set the SYSROOT environment variable to redirect the location of the root directory, for example to generate a template for an installation package.

    Debian and Ubuntu

    @@ -47,21 +47,23 @@

    There are no plans to create RPMs, but patches to achive this are welcome.

    -

    Windows

    +

    Windows

    This is currently untested, but planned for the first full release.

    This recipe presumes that Qt has been built with MinGW.

    -

    Open an MSys shell (e.g. by selecting "Git Bash" from the context menu if you are using MSysGIT). Make sure the path to your MinGW binaries and to Doxygen is set correctly. After that simply call build.sh from within this shell with an empty directory as parameter.

    +

    Open an MSys shell (e.g. by selecting "Git Bash" from the context menu if you are using MSysGIT). Make sure the path to your MinGW binaries and to Doxygen is set correctly. After that simply follow the Linux recipe above from within this shell.

    -

    Note: Windows systems have the odd habit to encourage directory names which contain spaces. The build script will trip over those! Avoid them. The full path to the SKID sources and to the build directory must not contain any spaces.

    +

    Note: Windows systems have the odd habit to encourage directory names which contain spaces. The build script may trip over those! Avoid them. The full path to the SKID sources and to the build directory should not contain any spaces.

    There are currently no plans for supporting Visual-Studio-Builds. There may be a plan for supporting the Qt5-runnerlib with Visual Studio in the future, but no promises.

    -

    MacOS/X

    +

    MacOS/X

    + +

    The Generic Linux way of building SKID may work on OS/X if you can find a working shell, if the spec used by Qt allows the use of Makefiles.

    -

    The Generic Linux way of building SKID should work on OS/X if you can find a working shell. I'm uncertain whether the SKID-UI binary will be able to find its documentation though.

    +

    I'm uncertain whether the SKID-UI binary will be able to find its documentation though.

    Since Apple does not plan to support my not-so-old Mac-Mini with a current MacOS/X, I reciprocate by not bothering with Apple. Feel free to send patches. (I will only accept patches that improve compatibility, I will not support Mac-only features or compromise my use of C++-11.)

    diff --git a/skid.config.template b/skid.config.template deleted file mode 100644 index 14c5bea..0000000 --- a/skid.config.template +++ /dev/null @@ -1,59 +0,0 @@ -# Build configuration for SKID -################################## - -# Copy this file to skid.config and edit the copy if you want to override -# some of the configuration settings. - -################## -# Uncomment and set this to an alternate value, if your QMake is found in a -# different location or has a different name. -# The default is to use "qmake". - -#QMAKE=/usr/bin/qmake-qt5 - - -################## -# Set this to a list of parameters you wish to send to QMake. For example: -# -qt=5.2.3 -> if you are using qtchooser, set Qt to version 5.2.3 -# -d -> be more verbose, debug qmake itself -# -recursive -> force recursion (this should not be necessary) -# -spec linux-icc -> select a different build-spec, in this case Linux with -# the Intel ICC compiler -# The default is to use no parameters, i.e. build for the default spec. - -#QMAKEFLAGS="-spec default" - - -################## -# Set this if your Make binary has a different name (e.g. mingw32-make on MinGW -# or gmake on some Unix-like systems). - -#MAKE=gmake - - -################## -# Set this to provide additional parameters to make. For example: -# -jN -> use up to N CPUs -# --> if MAKEFLAGS is not set this parameter may be set automatically for -# some systems (e.g. Linux, MinGW) -# --> set it to "-j1" to explicitly prohibit parallel build -# -k -> keep going after errors (not recommended) -# The default is to use no parameters, on some systems to parallelize. - -#MAKEFLAGS="-j3" - - -################## -# Set this to the executable of Doxygen: -# The default is to call "doxygen". - -#DOXYGEN=doxygen - - -################## -# Use this to adjust the path in which the system looks for tools: -# (Hint: always use a colon : to separate directories, even the MinGW bash -# uses Unix syntax) -# The default is to not alter the PATH variable. - -#PATH="$PATH:/usr/local/bin" -- 1.7.2.5