renovate build system
authorKonrad Rosenbaum <konrad@silmor.de>
Mon, 9 Jun 2014 19:52:55 +0000 (21:52 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Mon, 9 Jun 2014 19:52:55 +0000 (21:52 +0200)
.gitignore
Makefile.in [new file with mode: 0644]
build.sh [deleted file]
common.pri
configure [new file with mode: 0755]
doc/build.html
skid.config.template [deleted file]

index 6d906b9..b72f86c 100644 (file)
@@ -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 (file)
index 0000000..49bd77a
--- /dev/null
@@ -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 (executable)
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 '<build-directory>'
-        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
index 94ddc2a..0568833 100644 (file)
@@ -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 (executable)
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
index 139551e..49b9390 100644 (file)
 <li><a href="http://www.openssh.com" target="_blank">OpenSSH</a> is an option for starting remote agents</li>
 </ul>
 
-<h2>Configuring the Build Environment</h2>
+<h2>Overview</h2>
 
-<p>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.</p>
+<p>SKID is built using the usual "trinity": configure - make - make install.</p>
 
-<p>Copy the <tt>skid.config.template</tt> file to <tt>skid.config</tt>, then follow the instructions in the file for changing settings.</p>
+<p>It is always built into a separate directory. It is set at configure time and per default it is named <tt>build</tt>.</p>
 
-<h2>Linux, Unix</h2>
+<p>The <tt>configure</tt> script takes arguments to configure where to find the tools, and where to install the completed SKID binaries and libraries. Call <tt>./configure&nbsp;--help</tt> to get possible options.</p>
+
+<p>The build-directory will be separated into two sub-directories: <tt>tmp</tt> contains temporary files (like object files, moc files, etc.), <tt>target</tt> contains a template for installation with final binaries, libraries, and documentation.</p>
 
-<p>The <tt>build.sh</tt> script can be used to build SKID. For example like this:</p>
+<h2>Linux, Unix</h2>
 
-<pre>
-./build.sh builddir
-</pre>
+<p>Open a Shell and call <tt>./configure</tt> to configure the build. Add options to change tools, target directories, etc. You can set the build-directory by adding the option <tt>--build=<i>directory</i></tt> - the default is the directory <tt>build</tt>.</p>
 
-<p>The script has to be called with the name of an empty (or not yet existing) directory as a parameter.</p>
+<p>Call <tt>make&nbsp;-C&nbsp;build</tt> to build SKID (replace <tt>build</tt> with the correct build-directory) to compile SKID. You may add more options (like <tt>-j3</tt> to parallelize) if you like.</p>
 
-<p>It will build all components, create documentation and place the result in <tt>builddir/target</tt>.</p>
+<p>To install SKID call <tt>make&nbsp;-C&nbsp;build&nbsp;install</tt> - SKID will be copied to the configured prefix directory. You may need root privileges to do the installation. You may set the <tt>SYSROOT</tt> environment variable to redirect the location of the root directory, for example to generate a template for an installation package.</p>
 
 <h3>Debian and Ubuntu</h3>
 
 
 <p>There are no plans to create RPMs, but patches to achive this are welcome.</p>
 
-<h3>Windows</h3>
+<h2>Windows</h2>
 
 <p>This is currently untested, but planned for the first full release.</p>
 
 <p>This recipe presumes that Qt has been built with MinGW.</p>
 
-<p>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.</p>
+<p>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.</p>
 
-<p>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.</p>
+<p>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.</p>
 
 <p>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.</p>
 
-<h3>MacOS/X</h3>
+<h2>MacOS/X</h2>
+
+<p>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.</p>
 
-<p>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.</p>
+<p>I'm uncertain whether the SKID-UI binary will be able to find its documentation though.</p>
 
 <p>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.)</p>
 
diff --git a/skid.config.template b/skid.config.template
deleted file mode 100644 (file)
index 14c5bea..0000000
+++ /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"