Skip to content
Snippets Groups Projects
Commit 5517be30 authored by Martok's avatar Martok
Browse files

Use Buildutil as build manager

parent 1975b947
Branches
No related merge requests found
Pipeline #17 pending
Buildfile 0 → 100644
[*MAIN*]
tasks=requirements,printSummary,fpcBootstrap,snapshots,package
[*BUILDUTIL*]
TOOLPATH=fpcbootstrap
FPC_DIR=fpc_3_1
FPC_BRANCH=trunk
FPC_REV=
FPC_VER=3.1.1
LAZ_DIR=lazarus_1_7
LAZ_BRANCH=trunk
LAZ_REV=
LAZ_VER=1.7
; ----------------------------------------------------------------------------------------------------------------
[requirements]
TOOL=CMD
IF NOT EXIST fpclazup.exe CALL update-fpcup.cmd
[printSummary]
TOOL=CMD
echo FPC Snapshot Builder
echo Platform : %PROCESSOR_ARCHITECTURE%
echo Building FPC in : ${FPC_DIR} - ${FPC_BRANCH}
echo Lazarus in : ${LAZ_DIR} - ${LAZ_BRANCH}
[fpcBootstrap]
tasks=fpcup_fpcbootstrap_install
FPC_DIR=fpcbs_3_0
FPC_BRANCH=3.0
[snapshots]
tasks=fpc386,fpcx64,lazarus,finishTree
[fpc386]
tasks=fpcup_fpc
LAZUPBIN=fpclazup
[fpcx64]
tasks=fpcup_fpc
LAZUPBIN=fpclazup64
[lazarus]
tasks=fpcup_laz
[finishTree]
TOOL=CMD
set svnbinpath=${realpath ${TOOLPATH}}\svn\bin
echo Integrating GDB...
${TOOLPATH}\unzip -o gdb.zip -d ${LAZ_DIR}
echo Stripping Debug Symbols...
${TOOLPATH}\strip.exe -s ${LAZ_DIR}\lazarus.exe
${TOOLPATH}\strip.exe -s ${LAZ_DIR}\startlazarus.exe
${TOOLPATH}\strip.exe -s ${LAZ_DIR}\lazbuild.exe
echo Cleaning FPC.cfg...
copy /Y makeconfig.cmd ${LAZ_DIR}\makeconfig.cmd
pushd ${LAZ_DIR}
call makeconfig.cmd clean
popd
echo Cleaning FPC Package Units...
for /D %%i in ( ${FPC_DIR}\packages\* ) do ( if exist %%i\units rmdir /S /Q %%i\units )
echo Exporting SVN log...
@echo on
pushd ${FPC_DIR}
%svnbinpath%\svn log -l 1000 > ${realpath ${LAZ_DIR}}\svn-fpc.log
popd
pushd ${LAZ_DIR}
%svnbinpath%\svn log -l 1000 > ${realpath ${LAZ_DIR}}\svn-lazarus.log
popd
@echo off
[package]
tasks=zip_temp,zip_rename
ARTMP=tmp.7z
[zip_temp]
TOOL=ZIP
filename=${ARTMP}
files=zip_temp.files
level=5
exclude=*.svn*
exclude=lazarus.cfg
exclude=fpc.cfg
[zip_temp.files]
${LAZ_DIR}\*=
${FPC_DIR}\bin\*=fpc/${FPC_VER}/bin
${FPC_DIR}\msg\*=fpc/${FPC_VER}/msg
${FPC_DIR}\units\*=fpc/${FPC_VER}/units
${FPC_DIR}\packages\*=fpc/${FPC_VER}/source/packages
${FPC_DIR}\rtl\*=fpc/${FPC_VER}/source/rtl
[zip_rename]
TOOL=CMD
set fpcrev=${shell ${TOOLPATH}\svn\bin\svnversion ${FPC_DIR}}
set lazrev=${shell ${TOOLPATH}\svn\bin\svnversion ${LAZ_DIR}}
for %%f in ( ${ARTMP} ) do set "tslocal=%%~tf"
for /F "tokens=1,2,3,4,5,6 delims=.:/ " %%a in ("%tslocal%") do set "ts=%%c%%b%%a-%%d%%e"
set "arname=Lazarus-${LAZ_VER}-%lazrev%_fpc-${FPC_VER}-%fpcrev%_%ts%${suffix ${ARTMP}}"
ren ${ARTMP} %arname%
echo Created Archive %arname%
; ----------------------------------------------------------------------------------------------------------------
[fpcup_fpcbootstrap_install]
TOOL=CMD
del ${TOOLPATH}\ppc386.exe
del ${TOOLPATH}\ppcx64.exe
fpclazup --inifile=.\custom.ini --inisection=basefpc --fpcdir=${FPC_DIR} --fpcurl=${FPC_BRANCH} --verbose
fpclazup64 --inifile=.\custom.ini --inisection=basefpc --fpcdir=${FPC_DIR} --fpcurl=${FPC_BRANCH} --verbose
copy .\${FPC_DIR}\bin\i386-win32\ppc386.exe ${TOOLPATH}\
copy .\${FPC_DIR}\bin\x86_64-win64\ppcx64.exe ${TOOLPATH}\
[fpcup_fpc]
TOOL=CMD
${LAZUPBIN} --inifile=.\custom.ini --inisection=basefpc --fpcdir=${FPC_DIR} --fpcurl=${FPC_BRANCH} --fpcrevision=${FPC_REV} --verbose
[fpcup_laz]
TOOL=CMD
fpclazup --inifile=.\custom.ini --inisection=baselazarus --fpcdir=${FPC_DIR} --lazdir=${LAZ_DIR} --lazurl=${LAZ_BRANCH} --lazrevision=${LAZ_REV} --verbose
......@@ -5,17 +5,18 @@ Script for building FPC+Lazarus Windows Snapshots from SVN. Uses FPCUp as build
Requirements
------------
* buildutil [GitHub](https://github.com/martok/buildtools)
* fpcup (will be automatically downloaded)
* Internet connection for the entire process (fpcup downloads utils, a bootstrap compiler and the sourcecode via svn)
* Tools in PATH: `wget`, for example from [here](https://eternallybored.org/misc/wget/) (some other will be used from fpcbootstrap downloaded by fpcup)
Usage
-----
Call builder.cmd and wait. If the build is successful, an archive of the current snapshot version will be created. Note
Run buildutil and wait. If the build is successful, an archive of the current snapshot version will be created. Note
that it is not unlikely that a build will fail, for example if someone checked in code that doesn't actually compile.
Use --suppress=fpcBootstrap to skip building the bootstrap compiler.
On Win64 machines, a native ppc64 will be created, on Win32 this step is skipped.
On both systems, ppc386 and a 32bit Lazarus will always be built.
Will build native ppc386 and ppcx64 as well as 32bit Lazarus using the new compiler.
Call update-fpcup.cmd to download fresh copies of the fpcup binaries.
......
@echo off
setlocal
rem ===============================================================================================
set fpcdir=fpc030101
set lazdir=lazarus17
set optPackOnly=0
set optBuildBootstrap=0
set fpcsub=%lazdir%\fpc\3.1.1
set toolpath=%~dp0fpcbootstrap
set svnbinpath=%toolpath%\svn\bin
set "customcmd=%*"
rem ===============================================================================================
echo FPC Snapshot Builder
echo Platform : %PROCESSOR_ARCHITECTURE%
if "%optBuildBootstrap%" == "1" (
echo Building own bootstrap compilers
)
echo Building FPC in : %fpcdir%
echo Lazarus in : %lazdir%
echo Parameters : %customcmd%
pause
rem ===============================================================================================
IF NOT EXIST fpclazup.exe CALL update-fpcup.cmd
if "%optPackOnly%" == "1" goto :step_pack
if not "%optBuildBootstrap%" == "1" goto :step_compile
:step_bootstrap
CALL :compiler_bootstrap fpclazup i386-win32 ppc386
IF ERRORLEVEL 1 GOTO :EOF
IF "%PROCESSOR_ARCHITECTURE%" NEQ "x86" CALL :compiler_bootstrap fpclazup64 x86_64-win64 ppcx64
IF ERRORLEVEL 1 GOTO :EOF
:step_compile
SET OVERRIDEVERSIONCHECK=1
CALL :compiler fpclazup i386-win32
IF ERRORLEVEL 1 GOTO :EOF
IF "%PROCESSOR_ARCHITECTURE%" NEQ "x86" CALL :compiler fpclazup64 x86_64-win64
IF ERRORLEVEL 1 GOTO :EOF
SET OVERRIDEVERSIONCHECK=
CALL :lazarus
IF ERRORLEVEL 1 GOTO :EOF
:step_copy
CALL :copycompiler
CALL :makeconfig
:step_pack
CALL :makezip
endlocal
goto :eof
rem ===============================================================================================
:compiler_bootstrap
rem [fpcup-name] [platform-name] [ppcname]
echo Compiling bootstrap %3 for %2...
del %toolpath%\%3.exe
%1.exe --inifile=.\custom.ini --inisection=fpcbootstrap --getfullrepo --noconfirm --verbose %customcmd%
copy .\fpc030000\bin\%2\%3.exe %toolpath%\
goto :eof
rem -----------------------------------------------------------------------------------------------
:compiler
rem [fpcup-name] [platform-name]
echo Compiling %2 FPC...
%1.exe --inifile=.\custom.ini --inisection=%fpcdir% --getfullrepo --noconfirm --verbose %customcmd%
goto :eof
rem -----------------------------------------------------------------------------------------------
:lazarus
echo Compiling Lazarus...
fpclazup.exe --inifile=.\custom.ini --inisection=%lazdir% --getfullrepo --noconfirm --verbose %customcmd%
goto :eof
rem -----------------------------------------------------------------------------------------------
:copycompiler
echo Copying FPC to Lazarus...
for /D %%i in ( %fpcdir%\packages\* ) do ( if exist %%i\units rmdir /S /Q %%i\units )
if exist %fpcsub% RMDIR /S /Q %fpcsub%
mkdir %fpcsub%
%toolpath%\cp -vR %fpcdir%\bin %fpcsub%
%toolpath%\cp -vR %fpcdir%\msg %fpcsub%
%toolpath%\cp -vR %fpcdir%\units %fpcsub%
mkdir %fpcsub%\source
%toolpath%\cp -vR %fpcdir%\packages %fpcsub%\source
%toolpath%\cp -vR %fpcdir%\rtl %fpcsub%\source
echo Integrating GDB...
%toolpath%\unzip -o gdb.zip -d %lazdir%
echo Stripping Debug Symbols...
%toolpath%\strip.exe -s %lazdir%\lazarus.exe
%toolpath%\strip.exe -s %lazdir%\startlazarus.exe
%toolpath%\strip.exe -s %lazdir%\lazbuild.exe
goto :eof
rem -----------------------------------------------------------------------------------------------
:makeconfig
echo Cleaning FPC.cfg...
copy /Y makeconfig.cmd %lazdir%\makeconfig.cmd
pushd %lazdir%
call makeconfig.cmd clean
popd
goto :eof
rem -----------------------------------------------------------------------------------------------
:makezip
echo Exporting SVN log...
pushd %lazdir%
set fulllazdir=%CD%
popd
@echo on
pushd %fpcdir%
%svnbinpath%\svn log -l 1000 > %fulllazdir%\svn-fpc.log
popd
pushd %lazdir%
%svnbinpath%\svn log -l 1000 > %fulllazdir%\svn-lazarus.log
popd
call readvar.cmd fpcrev %svnbinpath%\svnversion.exe %fpcdir%
call readvar.cmd lazrev %svnbinpath%\svnversion.exe %lazdir%
@echo off
set tmpname=laz.tmp
if exist %tmpname% del %tmpname%
echo Creating Archive...
pushd %lazdir%
%toolpath%\zip -o -9 -r -S ..\%tmpname% * -x \*.svn\* -x lazarus.cfg
popd
for %%f in ( %tmpname% ) do set "tslocal=%%~tf"
for /F "tokens=1,2,3,4,5,6 delims=.:/ " %%a in ("%tslocal%") do set "ts=%%c%%b%%a-%%d%%e"
set "arname=Lazarus-1.7-%lazrev%_fpc-3.1.1-%fpcrev%_%ts%.zip"
ren %tmpname% %arname%
echo Created Archive %arname%
goto :eof
rem -----------------------------------------------------------------------------------------------
[fpcbootstrap]
[basefpc]
; Set these options:
;fpcdir=.\fpc030101
;fpcurl=3.1
;fpcrevision=33825
installdir=.
; FPC release (3.0)
fpcdir=.\fpc030000
fpcurl=3.0
fpcOPT=-O2 -Xs -CX -XX
keeplocalchanges=false
fpcuplinkname=""
noconfirm=true
only=FPC
[fpc030101]
installdir=.
; FPC trunk (3.1)
fpcdir=.\fpc030101
fpcurl=3.1
; O2, strip binaries, smartlinked lib+binary
fpcOPT=-O2 -Xs -CX -XX
;fpcrevision=31463
keeplocalchanges=false
getfullrepo=true
; Do not create a batch file with shortcut
fpcuplinkname=""
; Just install/update, no questions asked:
......@@ -26,16 +16,17 @@ noconfirm=true
only=FPC
skip=helplazarus,lazarus,lazbuild,bigide,useride
[lazarus17]
[baselazarus]
; Set these options:
;lazdir=.\lazarus17
;lazurl=1.7
;lazrevision=52205
;fpcdir=.\fpc030101
installdir=.
; Use FPC 3.1.1
fpcdir=.\fpc030101
; Lazarus trunk (1.7)
lazdir=.\lazarus17
lazurl=1.7
; O2, strip binaries, smartlinked lib+binary
lazOPT=-O2 -Xs -CX -XX
keeplocalchanges=false
getfullrepo=true
; Do not create a batch file with shortcut
fpcuplinkname=""
lazlinkname=""
......
@for /F "usebackq" %%k in (`%2 %3 %4 %5 %6 %7 %8 %9`) do @set "%1=%%k"
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment