浏览代码

ADD: Cross compiling support (Linux32 -> Linux64) to build scripts

Alexander Koblov 15 年之前
父节点
当前提交
8923c446ce

+ 11 - 5
_make.sh

@@ -16,16 +16,22 @@
 # all - compiling components, plugins and DC with *.lrs files generation
 # default - compiling DC with *.lrs files generation (using by default)
 
-#path to lazarus
+# path to lazarus
 export lazpath=/home/alexx/bin/lazarus
-#widgetset gtk or gtk2
-if [ -z $lcl ]
-  then export lcl=gtk2
+
+# Set up widgetset: gtk or gtk2 or qt
+if [ $lcl ]
+  then export DC_ARCH=$(echo "$DC_ARCH --widgetset=$lcl")
+fi
+
+# Set up processor architecture
+if [ $CPU_TARGET ] 
+  then export DC_ARCH=$(echo "$DC_ARCH --cpu=$CPU_TARGET")
 fi
 
 build_doublecmd()
 {
-  $lazpath/lazbuild --widgetset=$lcl src/doublecmd.lpi
+  $lazpath/lazbuild src/doublecmd.lpi $DC_ARCH
   
   strip --strip-all doublecmd
 }

+ 4 - 4
components/build.sh

@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/bin/bash
 # Compiling components
 
 # This script run from _make.bat
 # If you run it direct, set up $lazpath first
 
 pushd components
-$lazpath/lazbuild CmdLine/cmdbox.lpk
-$lazpath/lazbuild KASToolBar/kascomp.lpk
-$lazpath/lazbuild viewer/viewerpackage.lpk
+$lazpath/lazbuild CmdLine/cmdbox.lpk $DC_ARCH
+$lazpath/lazbuild KASToolBar/kascomp.lpk $DC_ARCH
+$lazpath/lazbuild viewer/viewerpackage.lpk $DC_ARCH
 popd

+ 8 - 0
install/create_packages.bat

@@ -65,6 +65,14 @@ rem Create *.zip package
 patch doublecmd/doublecmd.ini portable.diff
 zip -9 -Dr %PACK_DIR%\doublecmd-%DC_VER%.%CPU_TARGET%-%OS_TARGET%.zip doublecmd 
 
+rem Create help packages
+cd /D %BUILD_DC_TMP_DIR%
+rem Copy help files
+call %BUILD_DC_TMP_DIR%\install\windows\install-help.bat
+rem Create help package for each language
+cd %BUILD_PACK_DIR%\doublecmd
+for /D %%f in (doc\*) do zip -9 -Dr %PACK_DIR%\doublecmd-help.%%~nf-%DC_VER%.noarch.zip %%f
+
 rem Clean temp directories
 cd \
 rm -rf %BUILD_DC_TMP_DIR%

+ 13 - 0
install/create_packages.sh

@@ -60,6 +60,19 @@ cd $BUILD_PACK_DIR
 sed -i -e 's/UseIniInProgramDir=0/UseIniInProgramDir=1/' doublecmd/doublecmd.ini
 tar -cvjf $PACK_DIR/doublecmd-$DC_VER-1.$lcl.$CPU_TARGET.tar.bz2 doublecmd
 
+# Create help packages ------------------------------------------------------------
+cd $BUILD_DC_TMP_DIR
+# Copy help files
+install/linux/install-help.sh $BUILD_PACK_DIR
+# Create help package for each language
+cd $BUILD_PACK_DIR/doublecmd/doc
+for HELP_LANG in `ls`
+  do
+    cd $BUILD_PACK_DIR/doublecmd
+    tar -cvjf $PACK_DIR/doublecmd-help.$HELP_LANG-$DC_VER.noarch.tar.bz2 doc/$HELP_LANG
+  done
+# ---------------------------------------------------------------------------------
+
 # Clean DC build dir
 rm -rf $BUILD_DC_TMP_DIR
 rm -rf $BUILD_PACK_DIR

+ 12 - 0
install/linux/install-help.sh

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ -z $1 ]
+  then DC_HELP_INSTALL_DIR=/opt/doublecmd/doc
+  else DC_HELP_INSTALL_DIR=$1/doublecmd/doc
+fi
+
+# Clean help directory
+rm -rf $DC_HELP_INSTALL_DIR/*
+
+# Copy Russian help files
+cp -r doc/ru $DC_HELP_INSTALL_DIR/

+ 8 - 2
install/linux/install.sh

@@ -7,6 +7,8 @@ fi
 
 mkdir -p $DC_INSTALL_DIR
 
+mkdir -p $DC_INSTALL_DIR/doc
+
 mkdir -p $DC_INSTALL_DIR/plugins
 # WCX plugins directories
 mkdir -p $DC_INSTALL_DIR/plugins/wcx
@@ -31,9 +33,10 @@ mkdir -p $DC_INSTALL_DIR/plugins/dsx/DSXLocate
 
 # Copy directories
 cp -r language $DC_INSTALL_DIR/
-cp -r doc $DC_INSTALL_DIR/
-cp -r pixmaps $DC_INSTALL_DIR/
+cp -r doc/en   $DC_INSTALL_DIR/doc/
+cp -r pixmaps  $DC_INSTALL_DIR/
 # Copy files
+cp -a doc/*.txt                    $DC_INSTALL_DIR/doc/   
 cp -a doublecmd                    $DC_INSTALL_DIR/
 cp -a install/linux/doublecmd.ini  $DC_INSTALL_DIR/
 cp -a doublecmd.ext.example        $DC_INSTALL_DIR/
@@ -66,8 +69,11 @@ if [ -z $1 ]
     # Copy libraries
     if [ "$CPU_TARGET" = "x86_64" ]
       then
+	# for cross compiling try to create library directory
+	mkdir /usr/lib64
         install -m 644 *.so           /usr/lib64/
       else
+	mkdir /usr/lib
         install -m 644 *.so           /usr/lib/
     fi
     # Create symlink and desktop files

+ 10 - 0
install/windows/install-help.bat

@@ -0,0 +1,10 @@
+rem This script run from create_packages.bat
+rem If you run it direct, set up %BUILD_PACK_DIR% first
+
+set DC_HELP_INSTALL_DIR=%BUILD_PACK_DIR%\doublecmd\doc
+
+rem Clean help directory
+rm -rf %DC_HELP_INSTALL_DIR%\
+
+rem Copy Russian help files
+xcopy /E doc\ru %DC_HELP_INSTALL_DIR%\ru\

+ 3 - 2
install/windows/install.bat

@@ -24,9 +24,10 @@ mkdir  %DC_INSTALL_DIR%\plugins\wdx\deb_wdx
 
 rem Copy directories
 xcopy /E language %DC_INSTALL_DIR%\language\
-xcopy /E doc %DC_INSTALL_DIR%\doc\
-xcopy /E pixmaps %DC_INSTALL_DIR%\pixmaps\
+xcopy /E doc\en   %DC_INSTALL_DIR%\doc\en\
+xcopy /E pixmaps  %DC_INSTALL_DIR%\pixmaps\
 rem Copy files
+copy doc\*.txt              %DC_INSTALL_DIR%\doc\
 copy doublecmd.exe          %DC_INSTALL_DIR%\
 copy doublecmd.ini          %DC_INSTALL_DIR%\
 copy doublecmd.ext.example  %DC_INSTALL_DIR%\

+ 12 - 12
plugins/build.sh

@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Build all plugins
 
 # This script run from _make.sh
@@ -8,23 +8,23 @@
 pushd plugins
 
 # WCX plugins
-$lazpath/lazbuild wcx/cpio/src/cpio.lpi
-$lazpath/lazbuild wcx/deb/src/deb.lpi
-$lazpath/lazbuild wcx/lzma/src/lzma.lpi
-$lazpath/lazbuild wcx/rpm/src/rpm.lpi
-$lazpath/lazbuild wcx/unbz2/src/unbz2.lpi
-$lazpath/lazbuild wcx/unrar/src/unrar.lpi
-$lazpath/lazbuild wcx/zip/src/Zip.lpi
+$lazpath/lazbuild wcx/cpio/src/cpio.lpi $DC_ARCH
+$lazpath/lazbuild wcx/deb/src/deb.lpi $DC_ARCH
+$lazpath/lazbuild wcx/lzma/src/lzma.lpi $DC_ARCH
+$lazpath/lazbuild wcx/rpm/src/rpm.lpi $DC_ARCH
+$lazpath/lazbuild wcx/unbz2/src/unbz2.lpi $DC_ARCH
+$lazpath/lazbuild wcx/unrar/src/unrar.lpi $DC_ARCH
+$lazpath/lazbuild wcx/zip/src/Zip.lpi $DC_ARCH
 
 # WDX plugins
-$lazpath/lazbuild wdx/rpm_wdx/src/rpm_wdx.lpi
-$lazpath/lazbuild wdx/deb_wdx/src/deb_wdx.lpi
+$lazpath/lazbuild wdx/rpm_wdx/src/rpm_wdx.lpi $DC_ARCH
+$lazpath/lazbuild wdx/deb_wdx/src/deb_wdx.lpi $DC_ARCH
 
 # WLX plugins
-$lazpath/lazbuild wlx/WlxMplayer/src/wlxMplayer.lpi
+$lazpath/lazbuild wlx/WlxMplayer/src/wlxMplayer.lpi $DC_ARCH
 
 # DSX plugins
-$lazpath/lazbuild dsx/DSXLocate/src/DSXLocate.lpi
+$lazpath/lazbuild dsx/DSXLocate/src/DSXLocate.lpi $DC_ARCH
 
 # Strip and rename WCX
 pushd wcx/cpio/lib/

+ 4 - 0
plugins/wcx/zip/src/fpc-extra.cfg

@@ -1,3 +1,7 @@
 #IFDEF CPU64
 -fPIC
+#IFDEF FPC_CROSSCOMPILING
+-Fl/usr/local/lib64/gcc/x86_64-linux-gnu/4.2
+-Fl/usr/local/lib64
+#ENDIF
 #ENDIF

+ 7 - 0
plugins/wlx/WlxMplayer/src/fpc-extra.cfg

@@ -0,0 +1,7 @@
+#IFDEF CPU64
+-fPIC
+#IFDEF FPC_CROSSCOMPILING
+-Fl/usr/local/lib64/gcc/x86_64-linux-gnu/4.2
+-Fl/usr/local/lib64
+#ENDIF
+#ENDIF

+ 13 - 8
plugins/wlx/WlxMplayer/src/wlxMplayer.lpi

@@ -2,12 +2,10 @@
 <CONFIG>
   <ProjectOptions>
     <PathDelim Value="\"/>
-    <Version Value="7"/>
+    <Version Value="6"/>
     <General>
-      <Flags>
-        <LRSInOutputDirectory Value="False"/>
-      </Flags>
       <MainUnit Value="0"/>
+      <IconPath Value=".\"/>
       <TargetFileExt Value=""/>
       <ActiveEditorIndexAtStart Value="0"/>
     </General>
@@ -18,6 +16,7 @@
     </VersionInfo>
     <PublishOptions>
       <Version Value="2"/>
+      <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
       <IgnoreBinaries Value="False"/>
       <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
       <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
@@ -25,7 +24,7 @@
     <RunParams>
       <local>
         <FormatVersion Value="1"/>
-        <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
       </local>
     </RunParams>
     <Units Count="2">
@@ -52,13 +51,16 @@
     <JumpHistory Count="0" HistoryIndex="-1"/>
   </ProjectOptions>
   <CompilerOptions>
-    <Version Value="8"/>
+    <Version Value="5"/>
     <PathDelim Value="\"/>
     <SearchPaths>
       <OtherUnitFiles Value="$(LazarusDir)\lcl\units\$(TargetCPU)-$(TargetOS)\$(LCLWidgetType)\"/>
-      <UnitOutputDirectory Value="..\lib"/>
       <LCLWidgetType Value="qt"/>
+      <UnitOutputDirectory Value="../lib"/>
     </SearchPaths>
+    <CodeGeneration>
+      <Generate Value="Faster"/>
+    </CodeGeneration>
     <Linking>
       <LinkSmart Value="True"/>
       <Options>
@@ -66,7 +68,10 @@
       </Options>
     </Linking>
     <Other>
-      <CustomOptions Value="-fPIC"/>
+      <ConfigFile>
+        <CustomConfigFile Value="True"/>
+        <ConfigFilePath Value="fpc-extra.cfg"/>
+      </ConfigFile>
       <CompilerPath Value="$(CompPath)"/>
     </Other>
   </CompilerOptions>

+ 4 - 0
src/doublecmd.lpi

@@ -695,6 +695,10 @@
       </Debugging>
     </Linking>
     <Other>
+      <ConfigFile>
+        <CustomConfigFile Value="True"/>
+        <ConfigFilePath Value="fpc-extra.cfg"/>
+      </ConfigFile>
       <CompilerPath Value="$(CompPath)"/>
       <ExecuteBefore>
         <Command Value="_getsvnrev.cmd $(LazarusDir)"/>

+ 6 - 0
src/fpc-extra.cfg

@@ -0,0 +1,6 @@
+#IFDEF CPU64
+#IFDEF FPC_CROSSCOMPILING
+-Fl/usr/local/lib64/gcc/x86_64-linux-gnu/4.2
+-Fl/usr/local/lib64
+#ENDIF
+#ENDIF