From 7b002e587bc6f9e953dfcb63493919a0865a99e3 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 16 Sep 2005 16:45:23 +0000 Subject: [PATCH] fixed compilation, started fpc_crosswin32 rpm git-svn-id: trunk@7720 - --- .gitattributes | 2 + ide/include/unix/lazbaseconf.inc | 2 +- tools/install/build_fpc_rpm.sh | 2 +- .../cross_unix/build_linux_cross_win32_rpm.sh | 127 ++++++++++++++++++ tools/install/cross_unix/update_cross_fpc.sh | 5 +- .../install/rpm/fpc_crosswin32.spec.template | 28 ++++ 6 files changed, 163 insertions(+), 3 deletions(-) create mode 100755 tools/install/cross_unix/build_linux_cross_win32_rpm.sh create mode 100644 tools/install/rpm/fpc_crosswin32.spec.template diff --git a/.gitattributes b/.gitattributes index 4ff5507b01..0a65e9d68a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1965,6 +1965,7 @@ tools/install/create_lazarus_export_tgz.sh -text svneol=native#application/x-sh tools/install/create_lazarus_rpm.sh -text svneol=native#application/x-sh tools/install/create_lazarus_snapshot_rpm.sh svneol=native#text/plain tools/install/create_lazarus_tgz_from_local_dir.sh -text svneol=native#application/x-sh +tools/install/cross_unix/build_linux_cross_win32_rpm.sh 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/do_nothing.sh -text svneol=native#application/x-sh @@ -1974,6 +1975,7 @@ tools/install/get_lazarus_version.sh -text svneol=native#application/x-sh tools/install/macosx/fpc_installer_info.zip -text svneol=unset#application/zip tools/install/replace_in_files.pl -text svneol=native#application/x-perl tools/install/rpm/fpc.spec.template svneol=native#text/plain +tools/install/rpm/fpc_crosswin32.spec.template svneol=native#text/plain tools/install/rpm/lazarus.spec.template svneol=native#text/plain tools/install/setup.sh -text svneol=native#application/x-sh tools/install/smart_strip.sh -text svneol=native#application/x-sh diff --git a/ide/include/unix/lazbaseconf.inc b/ide/include/unix/lazbaseconf.inc index b83eaf2959..7f68b4750e 100644 --- a/ide/include/unix/lazbaseconf.inc +++ b/ide/include/unix/lazbaseconf.inc @@ -76,7 +76,7 @@ end; ---------------------------------------------------------------------------} procedure SetPrimaryConfigPath(const NewValue: String); begin - debugln('SetPrimaryConfigPath NewValue="',NewValue,'" -> "',ExpandFileName(NewValue),'"'); + //writeln('SetPrimaryConfigPath NewValue="',NewValue,'" -> "',ExpandFileName(NewValue),'"'); PrimaryConfigPath:=ExpandFileName(NewValue); end; diff --git a/tools/install/build_fpc_rpm.sh b/tools/install/build_fpc_rpm.sh index f43f3f114c..e1c35c4cbf 100755 --- a/tools/install/build_fpc_rpm.sh +++ b/tools/install/build_fpc_rpm.sh @@ -161,7 +161,7 @@ else cd - rpmbuild --nodeps -ba $SpecFile - echo "The new rpms can be found in /usr/src/redhat/RPMS/i386/" + echo "The new rpm can be found in /usr/src/redhat/RPMS/i386/" fi # end. diff --git a/tools/install/cross_unix/build_linux_cross_win32_rpm.sh b/tools/install/cross_unix/build_linux_cross_win32_rpm.sh new file mode 100755 index 0000000000..6ea1de844c --- /dev/null +++ b/tools/install/cross_unix/build_linux_cross_win32_rpm.sh @@ -0,0 +1,127 @@ +#!/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 +BuildRoot=~/freepascal + +#=============================================================================== +# parse command line parameters +DownloadBinutils=no +DownloadFPC=no +BuildBinutils=no +BuildCrossFPC=no +BuildNormalFPC=no +BuildCrossWin32RPM=no + +Params=$@ +for p in $Params; do + case "$p" in + all) + DownloadBinutils=yes + DownloadFPC=yes + BuildBinutils=yes + BuildLinWin32RPM=no + BuildNormalRPM=no + ;; + downloadbinutils) + DownloadBinutils=yes + ;; + downloadfpc) + DownloadFPC=yes + ;; + buildbinutils) + BuildBinutils=yes + ;; + buildnormalfpc) + BuildNormalFPC=yes + ;; + buildcrossfpc) + BuildCrossFPC=yes + ;; + buildcrosswin32rpm) + BuildCrossWin32RPM=yes + ;; + *) + echo "Unknown option: $p" + echo + echo "Usage:" + echo " $0 [all] [downloadbinutils] [downloadfpc] [buildbinutils] [buildcrossfpc] [buildcrosswin32rpm]" + exit -1 + ;; + esac +done + +# expand paths +BuildRoot=$(echo $BuildRoot | sed -e 's#//#/#g' -e 's#/$##') + +#=============================================================================== +# download and build binutils and fpc +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 [ ! -z $Params ]; then + Params="$Params targets=i386-win32" + ./update_cross_fpc.sh $Params +fi + +#=============================================================================== +# build fpc_crosswin32 rpm +if [ $BuildCrossWin32RPM = "yes" ]; then + #---------------------------------------------------------------------------- + # retrieve the version information + #---------------------------------------------------------------------------- + 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" + + Release=$(date +%y%m%d) + + #---------------------------------------------------------------------------- + # create source directory + #---------------------------------------------------------------------------- + TmpDir=/tmp/fpc_patchdir + rm -rf $TmpDir + mkdir -p $TmpDir + + + + #---------------------------------------------------------------------------- + # change spec file + #---------------------------------------------------------------------------- + SpecFileTemplate=../rpm/fpc_crosswin32.spec.template + SpecFile=../rpm/fpc_crosswin32.spec + cat $SpecFileTemplate | \ + sed -e 's/FPCVERSION/'"$CompilerVersionStr/" \ + -e 's/FPCRELEASE/'"$Release/" \ + > $SpecFile + + #---------------------------------------------------------------------------- + # compile + #---------------------------------------------------------------------------- + rpmbuild --nodeps -ba $SpecFile + + echo "The new rpm can be found in /usr/src/redhat/RPMS/i386/" +fi + +# end. + diff --git a/tools/install/cross_unix/update_cross_fpc.sh b/tools/install/cross_unix/update_cross_fpc.sh index c1a8538235..7f7f5343ba 100755 --- a/tools/install/cross_unix/update_cross_fpc.sh +++ b/tools/install/cross_unix/update_cross_fpc.sh @@ -68,11 +68,14 @@ for p in $Params; do installbin=*) InstallBin=$(echo $p | sed -e 's#^installbin=##') ;; + targets=*) + Targets=$p + ;; *) echo "Unknown option: $p" echo echo "Usage:" - echo " $0 [all] [downloadbinutils] [downloadfpc] [buildbinutils] [buildnormalfpc] [buildcrossfpc] [createfpccfg]" + echo " $0 [all] [downloadbinutils] [downloadfpc] [buildbinutils] [buildnormalfpc] [buildcrossfpc] [createfpccfg] [install] [installbin=] [targets=]" exit -1 ;; esac diff --git a/tools/install/rpm/fpc_crosswin32.spec.template b/tools/install/rpm/fpc_crosswin32.spec.template new file mode 100644 index 0000000000..f7c0f4a7ee --- /dev/null +++ b/tools/install/rpm/fpc_crosswin32.spec.template @@ -0,0 +1,28 @@ +Name: fpc_crosswin32 +Version: FPCVERSION +Release: FPCRELEASE +Summary: Free Pascal Compiler cross binaries for win32 + +Group: Development/Languages +License: GPL and modified LGPL +URL: http://www.freepascal.org/ +Source0: ftp://ftp.freepascal.org/pub/fpc/dist/source-%{version}/%{name}-%{version}-%{release}.source.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Requires: glibc, binutils, fpc=FPCVERSION +BuildRequires: binutils, glibc-devel + +%description + +Units and binutils needed by Freepascal to cross compile to target win32. + +%prep +%setup -c + +%build + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_libdir}/%{name} +mkdir -p %{buildroot}%{_bindir} +