#! /bin/sh # This file is part of AKFQuiz # # AKFQuiz is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # AKFQuiz is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ##################################################################### # configure here: PREFIX=/usr/local CGIDIR=/usr/lib/cgi-bin EXAMDIR="" # for modified versions use a variant-name please VARIANT="" VARIANT="-testing" NAME="AKFQuiz" MAINVERSION=4 SUBVERSION=5 REVISION=0 PKGVERSION=0 VERSION=$MAINVERSION.$SUBVERSION.$REVISION SVERSION=$MAINVERSION$SUBVERSION$REVISION SRCDIR="." # either a E-Mail address, or empty BUGMAIL="bug-akfquiz@akfoerster.de" ##################################################################### # don't change these values SOUND=no ##################################################################### # functions help() { cat <&2 } error() { echo "error: $@" 1>&2 exit 1 } getcompiler() { # search for available compiler echo "checking for fpc or gpc..." if which fpc then COMPILER=fpc elif which gpc then COMPILER=gpc else error "neither gpc nor fpc found" fi } create_rc() { sed < "srcbin/w32/rc.in" > "srcbin/w32/$1.rc" \ -e "s/^\(FILEVERSION\).*/\1 $MAINVERSION, $SUBVERSION, $REVISION, 0/" \ -e "s/^\(PRODUCTVERSION\).*/\1 $MAINVERSION, $SUBVERSION, $REVISION, 0/" \ -e "s/\(.*VALUE \"FileDescription\", *\)\".*\"/\1\"$2\"/" \ -e "s/\(.*VALUE \"FileVersion\", *\)\".*\"/\1\"$VERSION$VARIANT\"/" \ -e "s/\(.*VALUE \"InternalName\", *\)\".*\"/\1\"$1\"/" \ -e "s/\(.*VALUE \"OriginalFilename\", *\)\".*\"/\1\"$1.exe\"/" \ -e "s/\(.*VALUE \"Comments\", *\)\".*\"/\1\"$3\"/" \ -e "s/\(.*VALUE \"ProductName\", *\)\".*\"/\1\"$NAME$VARIANT\"/" \ -e "s/\(.*VALUE \"ProductVersion\", *\)\".*\"/\1\"$VERSION\"/" } notsupported() { warn "configure: warning: $1 not supported" } ##################################################################### # main program: SYS=`uname -s` ARCH=`uname -m` # rename architecture case "$ARCH" in i?86) ARCH=x86 ;; esac # system specific settings case "$SYS" in *Linux*) NEEDPTHREAD="yes" ;; *) NEEDPTHREAD="no" ;; esac # check parameter while [ $# -gt 0 ] do case "$1" in -h | --help) help ;; --target=gpc | --target=fpc | --target=xw32 | --target=xarm) error "old usage for --target no longer supported!" ;; #--srcdir=*) SRCDIR=`echo "$1" | sed -e "s/--srcdir=\(.*\)/\1/"` ;; --srcdir=*) notsupported --srcdir ;; # yet to be implemented --build=*) notsupported --build ;; # yet to be implemented --host=*) notsupported --host ;; # yet to be implemented --target=*) notsupported --target ;; # yet to be implemented --with-gpc) COMPILER=gpc ;; --with-grx) COMPILER=grx ;; --with-fpc) COMPILER=fpc ;; --with-xw32) COMPILER=xw32 ;; --with-xw64) COMPILER=xw64 ;; --with-xarm) COMPILER=xarm ;; --with-*) ;; # ignore (see GNU Coding Standards) --gpc) COMPILER=gpc ;; --grx) COMPILER=grx ;; --fpc) COMPILER=fpc ;; --xw32) COMPILER=xw32 ;; --xw32) COMPILER=xw64 ;; --xarm) COMPILER=xarm ;; --enable-sound|--enable-sound=yes|--disable-sound=no) SOUND=yes ;; --disable-sound|--disable-sound=yes|--enable-sound=no) SOUND=no ;; --enable-exam|--enable-exam=yes|--disable-exam=no) EXAMDIR="cgi-data/exam" ;; --disable-exam|--disable-exam=yes|--enable-exam=no) EXAMDIR="" ;; --enable-*) ;; # ignore (see GNU Coding Standards) --disable-*) ;; # ignore (see GNU Coding Standards) --prefix=*) PREFIX=`echo "$1" | sed -e "s/--prefix=\(.*\)/\1/"` ;; --mandir=*) notsupported --mandir ;; # yet to be implemented --infodir=*) ;; # ignore - not used --sysconfdir=*) ;; # ignore - not used --libexecdir=*) ;; # ignore - not used --cgidir=*) CGIDIR=`echo "$1" | sed -e "s/--cgidir=\(.*\)/\1/"` ;; --cgipath=*) CGIDIR=`echo "$1" | sed -e "s/--cgipath=\(.*\)/\1/"` ;; --examdir=*) EXAMDIR=`echo "$1" | sed -e "s/--examdir=\(.*\)/\1/"` ;; --variant=*) VARIANT=-`echo "$1" | sed -e "s/--variant=\(.*\)/\1/"` ;; --arch=*) ARCH=`echo "$1" | sed -e "s/--arch=\(.*\)/\1/"` ;; --sys=*) SYS=`echo "$1" | sed -e "s/--sys=\(.*\)/\1/"` ;; -*) error "unknown parameter $1" ;; *) ;; # ignore for now esac shift done test -z "$COMPILER" && getcompiler test "$COMPILER" = "xarm" && ARCH=arm test "$COMPILER" = "xw32" && { SYS=w32; NEEDPTHREAD="no"; } test "$COMPILER" = "xw64" && { SYS=w64; NEEDPTHREAD="no"; } # disable exam-mode on some systems case $SYS in w32|w64|mingw*|MINGW*) EXAMDIR="" ;; esac # check for needed tools case $COMPILER in grx) echo "checking for binobj... " which binobj || error "binobj not found - should come with gpc" ;; esac VERSION=$MAINVERSION.$SUBVERSION.$REVISION SVERSION=$MAINVERSION$SUBVERSION$REVISION #if [ ! -r $SRCDIR/srcbin/uakfquiz.pas ] #then # error cannot find sources in srcdir "$SRCDIR" #fi # show settings: cat << EOF prefix: $PREFIX cgidir: $CGIDIR examdir: $EXAMDIR Name: $NAME Variant: $VARIANT Version: $VERSION SVersion: $SVERSION Compiler: $COMPILER Sys: $SYS Arch: $ARCH BugMail: $BUGMAIL NeedPthread: $NEEDPTHREAD EOF # change to default directory cd $(dirname $0) sed < Makefile.in > Makefile \ -e "s%^\(srcdir *= *\).*%\1$SRCDIR%" \ -e "s/ARCH=.*/ARCH=$ARCH/" \ -e "s/SYS=.*/SYS=$SYS/" \ -e "s/^\(VERSION *= *\).*/\1$VERSION/" \ -e "s/^\(VARIANT *= *\).*/\1$VARIANT/" SOUNDCOMMENTED="" test "$SOUND" = "no" && SOUNDCOMMENTED="#" test "$NEEDPTHREAD" = "no" && PTHREADCOMMENTED="#" sed < srcbin/Makefile.$COMPILER > srcbin/Makefile \ -e "s/.*\(DEFINES.*SdlSoundForAll\)$/$SOUNDCOMMENTED\1/" \ -e "s/.*\(DEFINES.*NEEDPTHREAD\)$/$PTHREADCOMMENTED\1/" sed < srcbin/common.in > srcbin/common.mak \ -e "s%^\(srcdir *= *\).*%\1$SRCDIR%" \ -e "s%^\(prefix *= *\).*%\1$PREFIX%" \ -e "s%^\(cgidir *= *\).*%\1$CGIDIR%" \ -e "s%^\(examdir *= *\).*%\1$EXAMDIR%" \ -e "s/^\(SVERSION *= *\).*/\1$SVERSION/" cat > srcbin/config.inc < srcbin/getquiz < ../autopackage/default.apspec \ -e "s/^\(SoftwareVersion: *\).*/\1$VERSION/" fi # Windows stuff cat > srcbin/w32/akfquiz.nsh <