mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-02 19:24:46 +01:00
started deb for fpc_crosswin32
git-svn-id: trunk@9857 -
This commit is contained in:
parent
bee79f87dd
commit
1cc36c5311
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -2646,8 +2646,15 @@ tools/install/create_lazarus_deb.sh svneol=native#text/plain
|
||||
tools/install/create_lazarus_export_tgz.sh svneol=native#text/plain
|
||||
tools/install/create_lazarus_rpm.sh svneol=native#text/plain
|
||||
tools/install/create_lazarus_snapshot_rpm.sh svneol=native#text/plain
|
||||
tools/install/cross_unix/HowToCreate_fpc_crosswin32_deb.txt svneol=native#text/plain
|
||||
tools/install/cross_unix/HowToCreate_fpc_crosswin32_rpm.txt svneol=native#text/plain
|
||||
tools/install/cross_unix/create_linux_cross_win32_deb.sh svneol=native#text/plain
|
||||
tools/install/cross_unix/create_linux_cross_win32_rpm.sh svneol=native#text/plain
|
||||
tools/install/cross_unix/debian_crosswin32/changelog svneol=native#text/plain
|
||||
tools/install/cross_unix/debian_crosswin32/changelog.Debian svneol=native#text/plain
|
||||
tools/install/cross_unix/debian_crosswin32/control svneol=native#text/plain
|
||||
tools/install/cross_unix/debian_crosswin32/copyright svneol=native#text/plain
|
||||
tools/install/cross_unix/debian_crosswin32/postinst svneol=native#text/plain
|
||||
tools/install/cross_unix/update_cross_fpc.sh svneol=native#text/plain
|
||||
tools/install/cvsexportlocal.pas svneol=native#text/pascal
|
||||
tools/install/debian_fpc/changelog svneol=native#text/plain
|
||||
|
||||
36
tools/install/cross_unix/HowToCreate_fpc_crosswin32_deb.txt
Normal file
36
tools/install/cross_unix/HowToCreate_fpc_crosswin32_deb.txt
Normal file
@ -0,0 +1,36 @@
|
||||
How to create the fpc_crosswin32 deb
|
||||
|
||||
This deb was only tested under linux.
|
||||
|
||||
For configuration see below.
|
||||
|
||||
First get the FPC sources and the binutils.
|
||||
|
||||
For example:
|
||||
|
||||
[]$ cd <lazarusdir>/tools/install/cross_unix/
|
||||
[]$ ./create_linux_cross_win32_deb.sh downloadbinutils downloadfpc buildbinutils
|
||||
|
||||
This will download the FPC svn to ~/freepascal/fpc, its install files to
|
||||
~/freepascal/install and the binutils to ~/freepascal/binutils.
|
||||
|
||||
Create the fpc deb and install it:
|
||||
|
||||
[]$ cd <lazarusdir>/tools/install
|
||||
[]$ ./create_fpc_deb.sh ~/freepascal/fpc
|
||||
[]$ sudo dpkg -i fpc-<version>.i386.rpm
|
||||
|
||||
Then build the fpc_crosswin32 deb and install it:
|
||||
[]$ cd <lazarusdir>/tools/install/cross_unix/
|
||||
[]$ ./create_linux_cross_win32_deb.sh buildcrossfpc buildcrosswin32deb
|
||||
[]$ sudo dpkg -i fpc_crosswin32-<version>.i386.rpm
|
||||
|
||||
Now you can cross compile from linux to win32.
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
The following environment variables are handled:
|
||||
The base directory BuildRoot. Default value is ~/freepascal
|
||||
[]$ export BuildRoot=/home/user/freepascal
|
||||
|
||||
230
tools/install/cross_unix/create_linux_cross_win32_deb.sh
Executable file
230
tools/install/cross_unix/create_linux_cross_win32_deb.sh
Executable file
@ -0,0 +1,230 @@
|
||||
#!/usr/bin/env bash
|
||||
# Author: Mattias Gaertner
|
||||
# License: LGPL
|
||||
# Abstract: Download, compile binutils and FPC
|
||||
|
||||
set -e
|
||||
#set -x
|
||||
|
||||
# This is the root for all download and building directories
|
||||
if [ ! -d "$BuildRoot" ]; then
|
||||
BuildRoot=~/freepascal
|
||||
fi
|
||||
|
||||
#===============================================================================
|
||||
# parse command line parameters
|
||||
echo "parsing parameters ..."
|
||||
DownloadBinutils=no
|
||||
DownloadFPC=no
|
||||
BuildBinutils=no
|
||||
BuildCrossFPC=no
|
||||
BuildNormalFPC=no
|
||||
BuildCrossWin32DEB=no
|
||||
|
||||
Params=$@
|
||||
for p in $Params; do
|
||||
case "$p" in
|
||||
all)
|
||||
DownloadBinutils=yes
|
||||
DownloadFPC=yes
|
||||
BuildBinutils=yes
|
||||
BuildLinWin32DEB=no
|
||||
BuildNormalDEB=no
|
||||
;;
|
||||
downloadbinutils)
|
||||
DownloadBinutils=yes
|
||||
;;
|
||||
downloadfpc)
|
||||
DownloadFPC=yes
|
||||
;;
|
||||
buildbinutils)
|
||||
BuildBinutils=yes
|
||||
;;
|
||||
buildnormalfpc)
|
||||
BuildNormalFPC=yes
|
||||
;;
|
||||
buildcrossfpc)
|
||||
BuildCrossFPC=yes
|
||||
;;
|
||||
buildcrosswin32deb)
|
||||
BuildCrossWin32DEB=yes
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $p"
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo " $0 [all] [downloadbinutils] [downloadfpc] [buildbinutils] [buildcrossfpc] [buildcrosswin32deb]"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# expand paths
|
||||
BuildRoot=$(echo $BuildRoot | sed -e 's#//#/#g' -e 's#/$##')
|
||||
Targets='i386-win32'
|
||||
|
||||
#===============================================================================
|
||||
# download and build binutils and fpc
|
||||
set -x
|
||||
Params=""
|
||||
if [ $DownloadBinutils = "yes" ]; then
|
||||
Params="$Params downloadbinutils"
|
||||
fi
|
||||
if [ $DownloadFPC = "yes" ]; then
|
||||
Params="$Params downloadfpc"
|
||||
fi
|
||||
if [ $BuildBinutils = "yes" ]; then
|
||||
Params="$Params buildbinutils"
|
||||
fi
|
||||
if [ $BuildNormalFPC = "yes" ]; then
|
||||
Params="$Params buildnormalfpc"
|
||||
fi
|
||||
if [ $BuildCrossFPC = "yes" ]; then
|
||||
Params="$Params buildcrossfpc"
|
||||
fi
|
||||
|
||||
if [ "x$Params" != "x" ]; then
|
||||
Params="$Params targets=i386-win32"
|
||||
echo "calling update_cross_fpc.sh $Params ..."
|
||||
./update_cross_fpc.sh $Params || exit
|
||||
fi
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# build fpc_crosswin32 deb
|
||||
if [ $BuildCrossWin32DEB = "yes" ]; then
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# retrieve the version information
|
||||
#----------------------------------------------------------------------------
|
||||
echo -n "retrieving the FPC version ..."
|
||||
VersionFile="$BuildRoot/fpc/compiler/version.pas"
|
||||
CompilerVersion=`cat $VersionFile | grep ' *version_nr *=.*;' | sed -e 's/[^0-9]//g'`
|
||||
CompilerRelease=`cat $VersionFile | grep ' *release_nr *=.*;' | sed -e 's/[^0-9]//g'`
|
||||
CompilerPatch=`cat $VersionFile | grep ' *patch_nr *=.*;' | sed -e 's/[^0-9]//g'`
|
||||
CompilerVersionStr="$CompilerVersion.$CompilerRelease.$CompilerPatch"
|
||||
FPCVersion="$CompilerVersion.$CompilerRelease"
|
||||
if [ "$CompilerPatch" != "0" ]; then
|
||||
FPCVersion="$FPCVersion.$CompilerPatch"
|
||||
fi
|
||||
echo " $CompilerVersionStr-$FPCRelease"
|
||||
|
||||
FPCRelease=$(date +%y%m%d)
|
||||
echo " $CompilerVersionStr-$FPCRelease"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# setup variables
|
||||
|
||||
CurDir=`pwd`
|
||||
Arch=i386
|
||||
PackageName=fpc_crosswin32
|
||||
ResourceDir=$CurDir/debian_crosswin32
|
||||
FPCBuildDir=/tmp/fpc_build
|
||||
FPCDeb=$CurDir/${PackageName}_${FPCVersion}-${FPCRelease}_$Arch.deb
|
||||
DebianInstallDir=$FPCBuildDir/usr
|
||||
DebianRulezDir=$FPCBuildDir/DEBIAN/
|
||||
DebianDocDir=$FPCBuildDir/usr/share/doc/$PackageName
|
||||
Date=`date --rfc-822`
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# create temporary directory
|
||||
#----------------------------------------------------------------------------
|
||||
echo "create temporary directory $TmpSrcDir ..."
|
||||
rm -rf $FPCBuildDir
|
||||
mkdir -p $FPCBuildDir
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# collect binutils
|
||||
#----------------------------------------------------------------------------
|
||||
echo "collecting binutils from $BuildRoot/binutils/cross/bin/ ..."
|
||||
BinDir=$FPCBuildDir/usr/bin/
|
||||
mkdir -p $BinDir
|
||||
MyIntel=i686
|
||||
for Target in $Targets; do
|
||||
TargetCPU=$(echo $Target | sed -e 's#^\(.*\)-.*$#\1#')
|
||||
TargetOS=$(echo $Target | sed -e 's#^.*-\(.*\)$#\1#')
|
||||
BinUtilsCPU=$TargetCPU
|
||||
BinUtilsOS=$TargetOS
|
||||
|
||||
if [ $TargetOS = "win32" ]; then
|
||||
BinUtilsOS="mingw32"
|
||||
BinUtilsCPU=$MyIntel
|
||||
fi
|
||||
|
||||
BinUtilsDir=$BuildRoot/binutils/cross/bin/
|
||||
BinUtilsPrefix="$BinUtilsCPU-$BinUtilsOS-"
|
||||
|
||||
cd ${BinUtilsDir}
|
||||
for binutility in $(ls -B ${BinUtilsPrefix}*); do
|
||||
NewName=$(echo $binutility | sed -e "s#^$BinUtilsPrefix##")
|
||||
if [ ! $NewName = "windres" ]; then
|
||||
NewName="fpc-${TargetCPU}-${TargetOS}-$NewName"
|
||||
fi
|
||||
cp ${BinUtilsDir}${binutility} ${BinDir}${NewName}
|
||||
done
|
||||
cd -
|
||||
done
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# collect fpc libs (e.g. .ppu/.o)
|
||||
#----------------------------------------------------------------------------
|
||||
echo "collecting fpc libs (e.g. .ppu/.o) from $BuildRoot/binutils/cross/destination/ ..."
|
||||
for Target in $Targets; do
|
||||
FPCLibDir=lib/fpc/$CompilerVersionStr/units # !!! no / at end
|
||||
|
||||
mkdir -p $FPCBuildDir/$FPCLibDir
|
||||
cp -a $BuildRoot/binutils/cross/destination/$FPCLibDir/$Target $FPCBuildDir/$FPCLibDir/
|
||||
done
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# create rulez and files
|
||||
|
||||
# change debian files
|
||||
mkdir -p $DebianDocDir
|
||||
mkdir -p $DebianRulezDir
|
||||
|
||||
# create debian control file, which contains the package description
|
||||
echo "creating DEBIAN/control file"
|
||||
cat $ResourceDir/control | sed -e "s/FPCVERSION/$FPCVersion/g" > $DebianRulezDir/control
|
||||
|
||||
# create debian changelog file, needed for version
|
||||
echo "creating usr/share/doc/fpc/changelog file ..."
|
||||
File=$DebianDocDir/changelog
|
||||
echo "$PackageName ($FPCVersion-$FPCRelease) unstable; urgency=low" > $File
|
||||
echo " -- Mattias Gaertner <mattias@freepascal.org> $Date" >> $File
|
||||
echo "" >> $File
|
||||
cat $ResourceDir/changelog >> $File
|
||||
gzip --best $File
|
||||
|
||||
# create postinst if needed
|
||||
if [ -f "$ResourceDir/postinst" ]; then
|
||||
echo "creating DEBIAN/postinst file"
|
||||
cat $ResourceDir/postinst | sed -e "s/FPCVERSION/$FPCVersion/g" > $DebianRulezDir/postinst
|
||||
chmod a+x $DebianRulezDir/postinst
|
||||
fi
|
||||
|
||||
# create changelog.Debian file
|
||||
echo "creating changelog.Debian file ..."
|
||||
File=$DebianDocDir/changelog.Debian
|
||||
cp $ResourceDir/changelog.Debian $File
|
||||
gzip --best $File
|
||||
|
||||
# create debian copyright file
|
||||
echo "creating copyright file ..."
|
||||
cp $ResourceDir/copyright $DebianDocDir/
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# creating deb
|
||||
|
||||
cd $FPCBuildDir
|
||||
fakeroot dpkg-deb --build $FPCBuildDir
|
||||
mv $FPCBuildDir.deb $FPCDeb
|
||||
|
||||
echo "The new deb can be found at $FPCDeb"
|
||||
echo "You can test it with lintian."
|
||||
else
|
||||
echo "To build the deb call this script with parameter all or buildcrosswin32deb"
|
||||
fi
|
||||
|
||||
# end.
|
||||
|
||||
6
tools/install/cross_unix/debian_crosswin32/changelog
Normal file
6
tools/install/cross_unix/debian_crosswin32/changelog
Normal file
@ -0,0 +1,6 @@
|
||||
fpc-crosswin32 (2.0.4)
|
||||
|
||||
* Started package
|
||||
|
||||
-- Mattias Gaertner <mattias@cvs.freepascal.org> 09/10/2006
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
fpc Debian maintainer and upstream author are identical.
|
||||
Therefore see also normal changelog file for Debian changes.
|
||||
|
||||
13
tools/install/cross_unix/debian_crosswin32/control
Normal file
13
tools/install/cross_unix/debian_crosswin32/control
Normal file
@ -0,0 +1,13 @@
|
||||
Package: fpc-crosswin32
|
||||
Version: FPCVERSION
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Mattias Gaertner <mattias@cvs.freepascal.org>
|
||||
Architecture: i386
|
||||
Pre-Depends: binutils, glibc-devel
|
||||
Description: Free Pascal units cross compiled to win32 for linux
|
||||
Units and binutils needed by Freepascal to cross compile to target win32.
|
||||
This deb was built from sources built by the scripts of the lazarus project.
|
||||
See http://www.lazarus.freepascal.org.
|
||||
Download the lazarus sources and see <lazarusdir>/tools/install/cross_unix/
|
||||
|
||||
9
tools/install/cross_unix/debian_crosswin32/copyright
Normal file
9
tools/install/cross_unix/debian_crosswin32/copyright
Normal file
@ -0,0 +1,9 @@
|
||||
The package was originally put together by:
|
||||
Mattias Gaertner <mattias@freepascal.org>
|
||||
|
||||
From sources obtained from:
|
||||
ftp://ftp.us.freepascal.org/pub/fpc/snapshot/
|
||||
|
||||
The files and libraries are released under the terms of the GNU
|
||||
Library General Public License, which can be found in the file
|
||||
/usr/share/common-licenses/LGPL-2 on a Debian system.
|
||||
2
tools/install/cross_unix/debian_crosswin32/postinst
Executable file
2
tools/install/cross_unix/debian_crosswin32/postinst
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
|
||||
Loading…
Reference in New Issue
Block a user