Additional patch to help building win32.
It forces CROSSINSTALL=1 for any OS_TARGET build even for the same CPU, in order to avoid building a load of cruft not needed.
(If you don't specify the OS_TARGET then it builds everything properly.)

It also allows BINUTILSPREFIX to be specified in the environment as some win32 binutils packages don't have the OS name in.

so:
BINUTILSPREFIX=/usr/bin/i586-mingw32msvc- OS_TARGET=win32 CPU_TARGET=i386 ./create_fpc_deb.sh fpc ~/lazarus/fpc

will work for windows cross-compiles (I guess - I still can't get lazarus to do anything with it).

The patch also stops it overwriting /etc/fpc.cfg for cross-install packages.

Sam


Index: tools/install/create_fpc_deb.sh
===================================================================
--- tools/install/create_fpc_deb.sh     (revision 13264)
+++ tools/install/create_fpc_deb.sh     (working copy)
@@ -63,7 +63,8 @@
   IFS="$_IFS"
   for p in "$@"
   do
-    as=`echo $p/${TARGET_PREFIX}*as`
+    set `echo $p/${TARGET_PREFIX}*as`
+    as="$1"
     if test -x "$as"
     then
       TARGET_PREFIX="${as%%as}"
@@ -94,6 +95,7 @@
 Arch=`dpkg --print-architecture` 
 
 CPU_TARGET="${CPU_TARGET:-$Arch}"
+
 case "$CPU_TARGET" in
   i386)  ppcbin=ppc386;;
   amd64) ppcbin=ppcx64;;
@@ -114,6 +116,7 @@
 then
        TARGET_SUFFIX="${TARGET_SUFFIX}-${OS_TARGET}"
        TARGET_PREFIX="${TARGET_PREFIX}${OS_TARGET}-"
+       CROSSINSTALL=1
 fi
 
 if test -z "$FPC"
@@ -123,17 +126,17 @@
 
 BINUTILS=binutils
 # detect any finalprefix elements
-if test -n "$TARGET_PREFIX"
+if test -n "$TARGET_PREFIX" -a -z "$BINUTILSPREFIX"
 then
-  BINUTILSPREFIX="`getBINUTILSPREFIX $TARGET_PREFIX`"
-  if test -n "$BINUTILSPREFIX"
-  then echo "BINUTILSPREFIX=$BINUTILSPREFIX"
-       BINUTILS=`dpkg -S "${BINUTILSPREFIX}as" | sed "s/:.*//"`
-  else echo "Can't find cross binutils"
-       exit 1
-  fi
+  BINUTILSPREFIX="`getBINUTILSPREFIX $BINUTILSPREFIX`"
 fi
 
+if test -n "$BINUTILSPREFIX"
+then echo "BINUTILSPREFIX=$BINUTILSPREFIX"
+     BINUTILS=`dpkg -S "${BINUTILSPREFIX}as" | sed "s/:.*//"`
+else echo "Can't find cross binutils"
+     exit 1
+fi
 
 #------------------------------------------------------------------------------
 # download/export fpc svn if needed
@@ -217,7 +220,7 @@
 gzip --best $File
 
 # create postinst if needed
-if [ -f "$ResourceDir/postinst" ]; then
+if [ -f "$ResourceDir/postinst" -a -z "$CROSSINSTALL" ]; then
     echo "creating DEBIAN/postinst file"
     cat $ResourceDir/postinst \
       | sed -e "s/FPCVERSION/$FPCVersion/g" -e "s/PPCBIN/$ppcbin/g" \

Reply via email to