#!/bin/sh # $Id$ DIR="Common Library Server Manager Module/drm Module/linuxfb Module/x11" EXPORTS="PKG_NAME" PREFIX="/usr/local" VERSION="1.0.0" for i in $@; do case "$i" in --prefix=*) PREFIX="`echo "$i" | sed "s/--prefix=//g"`" ;; esac done echo "Configuring MultiView" for i in $DIR; do . $i/config rm -f $i/configure.tmp.* count=0 cat Template/configure.in > $i/configure.tmp.0 for j in $EXPORTS; do count=`expr $count + 1` sed "s/@$j@/`eval echo \\\$$j`/g" $i/configure.tmp.`expr $count - 1` > $i/configure.tmp.$count done mv $i/configure.tmp.$count $i/configure rm -f $i/configure.tmp.* OLDPWD="`pwd`" cd $i chmod +x configure ./configure "$@" || exit 1 if [ ! "$i" = "Common" ]; then sed "s%LIBS=%LIBS=$OLDPWD/Common/common.a %g" Makefile > Makefile.tmp mv Makefile.tmp Makefile fi if [ "$i" = "Server" ]; then sed "s%LIBS=%LIBS=-lmultiview %g" Makefile > Makefile.tmp mv Makefile.tmp Makefile sed "s%LDFLAGS=%LDFLAGS=-L$OLDPWD/Library %g" Makefile > Makefile.tmp mv Makefile.tmp Makefile fi sed "s%CFLAGS=%CFLAGS=-I $OLDPWD/Include%g" Makefile > Makefile.tmp mv Makefile.tmp Makefile cd "$OLDPWD" echo done echo "Generating Makefile" sed "s%@DIR@%$DIR%g" Template/Makefile.in | sed "s%@PREFIX@%$PREFIX%g" > Makefile for i in $DIR; do REQ=" Common" if [ "$i" = "Common" ]; then REQ="" elif [ "$i" = "Server" ]; then REQ="$REQ Library" fi echo "" >> Makefile echo "$i::$REQ" >> Makefile echo " \$(MAKE) -C $i" >> Makefile done if [ ! -f "Include/MultiView/Path.h" ]; then echo "Generating Include/MultiView/Path.h" cat > Include/MultiView/Path.h << EOF /* This file was auto-generated */ #ifndef __MULTIVIEW_PATH_H__ #define __MULTIVIEW_PATH_H__ #define __MultiView_Prefix "$PREFIX" #define __MultiView_DriverPrefix __MultiView_Prefix "/lib/multiview" #define __MultiView_ConfigPrefix __MultiView_Prefix "/etc/MultiView" #endif EOF fi if [ ! -f "Include/MultiView/Version.h" ]; then echo "Generating Include/MultiView/Version.h" cat > Include/MultiView/Version.h << EOF /* This file was auto-generated */ #ifndef __MULTIVIEW_VERSION_H__ #define __MULTIVIEW_VERSION_H__ #define MVVersion "$VERSION" const char* MVGetVersion(void); #endif EOF fi