Commit e83db48d authored by Mart Lubbers's avatar Mart Lubbers
Browse files

Merge branch 'linux-arm64' into 'master'

Add linux-arm64 build scripts

See merge request !55
parents 7b1d61cc 6b18cf77
Pipeline #48763 passed with stage
in 16 minutes and 8 seconds
test:
test-linux-x64:
image: debian:stretch
before_script:
- apt-get update -qq
......@@ -9,3 +9,17 @@ test:
- ./generic/setup.sh clean-bundle-complete linux x64
- ./generic/fetch.sh clean-bundle-complete linux x64
- ./generic/build.sh clean-bundle-complete linux x64
test-linux-arm64:
tags:
- arm64
- linux
image: ubuntu
before_script:
- apt-get update -qq
- apt-get install -qq gcc make subversion git ca-certificates curl unzip
script:
- ./generic/cleanup.sh
- export CLEANDATE="$(date +%Y-%m-%d)"
- ./generic/setup.sh clean-bundle-complete linux arm64
- ./generic/fetch.sh clean-bundle-complete linux arm64
- ./generic/build.sh clean-bundle-complete linux arm64
#!/bin/sh
set -e
#to remove when changes are in the master
cp -r src/abc-interpreter-103-linux-arm64-interface src/abc-interpreter-master
cp -r src/abc-interpreter-master build/abc-interpreter
export CLEAN_HOME=`pwd`/build/clean
export PATH="$CLEAN_HOME/bin:$PATH"
# TODO: remove this when gcc>5 is default on the build server.
# This is needed because gcc 5 contains a bug that leads to a segfault for our source.
(cc --version | grep -F 5.) && export CC=gcc-6
# Library
make -C build/abc-interpreter/src optimized arm64 library
(cd build/abc-interpreter/lib;
curl -L https://gitlab.science.ru.nl/clean-and-itasks/abc-interpreter/-/jobs/artifacts/master/raw/src-js/WebPublic.tar.gz?job=build-wasm \
| tar -xzv
)
mkdir -p target/clean-abc-interpreter/lib/ABCInterpreter
cp -r build/abc-interpreter/lib/* target/clean-abc-interpreter/lib/ABCInterpreter
rm target/clean-abc-interpreter/lib/ABCInterpreter/Clean\ System\ Files/*_library
# Executables
TOOLS="abcopt bcgen bclink bcprelink bcstrip"
mkdir -p target/clean-abc-interpreter/lib/exe
make -C build/abc-interpreter/src optimized arm64 $TOOLS
for tool in $TOOLS; do
cp "build/abc-interpreter/src/$tool" target/clean-abc-interpreter/lib/exe
done
clean-base
clean-lib-argenv
clean-lib-dynamics
clean-and-itasks abc-interpreter 103-linux-arm64-interface
#!/bin/sh
set -e
export CLEAN_HOME=`pwd`/build/clean
export CLEANPATH=`pwd`/build/clean/lib/StdEnv
export CLEANLIB=`pwd`/build/clean/lib/exe
export PATH=`pwd`/build/clean/bin:$PATH
PACKAGE=$1
OS=$2
ARCH=$3
#### Component build functions ####
build_bootstrap_clean () {
# Download bootstrap version for x64
(cd build
curl https://ftp.cs.ru.nl/Clean/Clean30/linux/clean3.0_64_boot.tar.gz | tar xz
)
# Copy previously built clm
cp target/clean-c-components/bin/clm build/clean/bin
# Copy previously built code generator
mkdir -p build/clean/lib/exe
cp target/clean-c-components/lib/exe/* build/clean/lib/exe
# Copy bootstrap StdEnv but use previously built runtime system
mv build/clean/StdEnv build/clean/lib/StdEnv
cp target/clean-c-components/lib/StdEnv/Clean\ System\ Files/_startup.o build/clean/lib/StdEnv/Clean\ System\ Files
sed -i 's/dINT/INT/g' build/clean/lib/StdEnv/Clean\ System\ Files/_system.abc
clm -O _system
# Copy ArgEnv
make -C build/clean/src/libraries/ArgEnvUnix ArgEnvC.o
cp -r build/clean/src/libraries/ArgEnvUnix build/clean/lib/ArgEnv
# Prevent recompilation; we don't have a compiler yet
sleep 1
find build/clean -name '*.abc' -exec touch {} \;
# Build the compiler
(cd build/clean/src/compiler
./unix/make.linux64.sh
)
# Move the compiler to the tools
cp build/clean/src/compiler/cocl build/clean/lib/exe
}
build_codegenerator () { # $1:target
mkdir -p build
cp -r src/code-generator-master build/codegenerator
make -C build/codegenerator -f Makefile.linux_arm64 cg
mkdir -p $1/lib/exe
cp build/codegenerator/cg $1/lib/exe
}
build_runtimesystem_c () { # $1:target
mkdir -p build
cp -r src/run-time-system-master build/runtimesystem
make -C build/runtimesystem -f Makefile.linux_arm64
mkdir -p $1/lib/StdEnv/Clean\ System\ Files
cp build/runtimesystem/_startup.o $1/lib/StdEnv/Clean\ System\ Files/_startup.o
}
build_runtimesystem_clean () { # $1:target
#Generate the 'clean part' of the runtime system
mkdir -p $1/lib/StdEnv/Clean\ System\ Files
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/_system.abc $1/lib/StdEnv/Clean\ System\ Files/_system.abc
#Use the new code generator
target/clean-c-components/lib/exe/cg $1/lib/StdEnv/Clean\ System\ Files/_system
}
build_clm () { # $1:target
mkdir -p build
cp -r src/clm-master build/clm
make -C build/clm -f Makefile.linux_arm64 clms
mkdir -p $1/bin
cp build/clm/clms $1/bin/clm
}
build_cpm () { # $1:target
#Collect dependencies
mkdir -p build/cpm/deps
cp -r src/clean-libraries-master/Libraries/StdLib build/cpm/deps/stdlib
#Get cpm source code
cp -r src/clean-ide-master build/cpm/CleanIDE
(cd build/cpm/CleanIDE/cpm
clm -h 256M -nr -nt -I Posix -I ../BatchBuild -I ../Pm -I ../Unix -I ../Unix/Arm -I ../Util -I ../Interfaces/LinkerInterface\
-I ../../deps/stdlib -IL ArgEnv -IL Directory -IL Generics Cpm -o cpm
)
mkdir -p $1/bin
cp build/cpm/CleanIDE/cpm/cpm $1/bin/cpm
mkdir -p $1/etc
mkdir -p $1/Temp
cp $PACKAGE/$OS-$ARCH/txt/IDEEnvs $1/etc/IDEEnvs
}
build_compiler() { # $1:target
mkdir -p build
cp -r src/compiler-itask build/compiler
(cd build/compiler
clm -ABC -nw -ci -I backend -I frontend -I main/Unix -IL ArgEnv backendconvert
sed 's:-IL ArgEnv:-I ../../build/clean/lib/ArgEnv:g' < unix/make.linux64.sh > unix/make.linux64_.sh
chmod +x unix/make.linux64_.sh
./unix/make.linux64_.sh
)
mkdir -p $1/lib/exe
cp build/compiler/cocl $1/lib/exe/cocl-itasks
}
build_compiler_master() { # $1:target
mkdir -p build
cp -r src/compiler-master build/compiler-master
(cd build/compiler-master
clm -ABC -nw -ci -I backend -I frontend -I main/Unix -IL ArgEnv backendconvert
sed 's:-IL ArgEnv:-I ../../build/clean/lib/ArgEnv:g' < unix/make.linux64.sh > unix/make.linux64_.sh
chmod +x unix/make.linux64_.sh
./unix/make.linux64_.sh
)
mkdir -p $1/lib/exe
cp build/compiler-master/cocl $1/lib/exe/cocl
}
build_docs () { #$1:target
cp src/clean-ide-master/CleanLicenseConditions.txt $1/CleanLicenseConditions.txt
cp $PACKAGE/$OS-$ARCH/txt/README $1/README.md
mkdir -p build
cp -r src/language-report-master/write_clean_manual build/manual
(cd build/manual
#Create generator
clm -h 20M write_clean_manual -o write_clean_manual
#Copy fonts
cp ../../Fonts/LiberationSans-Regular.ttf .
cp ../../Fonts/LiberationSans-Bold.ttf .
cp ../../Fonts/LiberationSans-Italic.ttf .
cp ../../Fonts/NimbusMonoPS-Regular.ttf .
cp ../../Fonts/NimbusMonoPS-Bold.ttf .
#Generate manual heap full?
./write_clean_manual
)
#Copy to target
mkdir -p $1/doc
cp build/manual/CleanLanguageReport.* $1/doc/
}
build_stdenv() { # $1:target
mkdir -p $1/lib/StdEnv
cp src/stdenv-master/_library.dcl $1/lib/StdEnv/
cp src/stdenv-master/_startup.dcl $1/lib/StdEnv/
cp src/stdenv-master/_system.dcl $1/lib/StdEnv/
for a in StdArray StdBool StdChar StdCharList StdClass StdDebug StdEnum StdEnv \
StdFunc StdFunctions StdList StdMisc StdOrdList StdOverloaded StdOverloadedList \
StdStrictLists StdTuple StdMaybe _SystemArray _SystemEnum _SystemEnumStrict \
_SystemStrictLists _SystemStrictMaybes StdGeneric;
do cp src/stdenv-master/$a.[di]cl $1/lib/StdEnv ;
done
cp src/stdenv-master/StdInt.icl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/_SystemStrictLists.icl $1/lib/StdEnv/_SystemStrictLists.icl
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/_SystemStrictMaybes.icl $1/lib/StdEnv/_SystemStrictMaybes.icl
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdInt.dcl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdFile.dcl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdFile.icl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdReal.dcl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdReal.icl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdString.dcl $1/lib/StdEnv/
cp src/stdenv-master/StdEnv\ 64\ Changed\ Files/StdString.icl $1/lib/StdEnv/
if [ ! -z ${BUILD_STDENV+x} ]; then
echo first compile of system modules
for a in StdChar; # compile twice for inlining
do $CLEAN_HOME/lib/exe/cocl -ou -pm -pt -P $1/lib/StdEnv $a ;
done
echo second compile of system modules
for a in StdMisc StdBool StdInt StdChar StdFile StdReal StdString;
do $CLEAN_HOME/lib/exe/cocl -ou -pm -pt -P $1/lib/StdEnv $a ;
done
fi
}
build_argenv() { # $1:target
mkdir -p build/libraries/
cp -r src/clean-libraries-master/Libraries/ArgEnvUnix build/libraries/ArgEnv
make -e -C build/libraries/ArgEnv
mkdir -p "$1/lib/ArgEnv/Clean System Files"
for f in ArgEnvC.c ArgEnv.dcl printenv.icl ArgEnv.icl Makefile README;
do cp build/libraries/ArgEnv/$f $1/lib/ArgEnv/$f
done
cp "build/libraries/ArgEnv/Clean System Files/ArgEnvC.o" "$1/lib/ArgEnv/Clean System Files/"
}
build_dynamics() { #$1:target
#Copy minimal Dynamics libraries
mkdir -p "$1/lib/Dynamics/Clean System Files"
cp src/clean-dynamic-system-trunk/dynamics/StdDynamicEnv/extension/StdCleanTypes.dcl $1/lib/Dynamics/
cp src/clean-dynamic-system-trunk/dynamics/StdDynamicEnv/extension/StdCleanTypes.icl $1/lib/Dynamics/
cp src/clean-dynamic-system-trunk/dynamics/StdDynamicEnv/extension/StdDynamic.dcl $1/lib/Dynamics/
cp src/clean-dynamic-system-trunk/dynamics/StdDynamicEnv/extension/StdDynamicNoLinker.icl $1/lib/Dynamics/StdDynamic.icl
cp src/clean-dynamic-system-trunk/dynamics/StdDynamicEnv/implementation/_SystemDynamic.dcl $1/lib/Dynamics/
cp src/clean-dynamic-system-trunk/dynamics/StdDynamicEnv/implementation/_SystemDynamic.icl $1/lib/Dynamics/
}
build_generics() { #$1:target
#Copy generics library
mkdir -p $1/lib/Generics
cp src/clean-libraries-master/Libraries/GenLib/*.[id]cl $1/lib/Generics/
}
build_directory() {
mkdir -p build/Directory
cp -r src/clean-libraries-master/Libraries/Directory/* build/Directory/
cp src/clean-tools-trunk/htoclean/Clean.h "build/Directory/Clean System Files Unix/Clean.h"
(cd "build/Directory/Clean System Files Unix"
gcc -c -O cDirectory.c
)
mkdir -p "$1/lib/Directory/Clean System Files"
cp build/Directory/*.[id]cl $1/lib/Directory/
cp build/Directory/Clean\ System\ Files\ Unix/* $1/lib/Directory/Clean\ System\ Files/
}
build_clean_c_components () { # $1:target
mkdir -p $1
build_codegenerator $1
build_runtimesystem_c $1
build_clm $1
}
build_clean() { # $1:target
mkdir -p $1
#Copy all C components (they are built only once)
cp -r target/clean-c-components/* $1/
# Build all Clean components
# Standard libraries
build_stdenv $1
# Rts and compiler
build_runtimesystem_clean $1
build_compiler $1
build_compiler_master $1
}
#### Main build process ####
# Build components written in C (code generator, runtime system and clm)
build_clean_c_components target/clean-c-components
# Build the bootstrap system
build_bootstrap_clean
# First pass: build a clean system using the boot compiler
build_clean target/clean-intermediate
# Standard libraries as dependencies for the second pass
build_dynamics target/clean-intermediate
build_generics target/clean-intermediate
build_directory target/clean-intermediate
build_argenv target/clean-intermediate
# Second pass: Build a minimal clean system using the clean system from the previous pass
rm -rf build/*
mv target/clean-intermediate build/clean
export BUILD_STDENV=yes
# TODO: Temporary: the new compiler generates new ABC code (with optimized
# instance calls), so we need to regenerate the ABC of StdEnv before trying to
# build a new Clean system. This needs to be fixed elsewhere.
build_stdenv target/new-stdenv
mv target/new-stdenv/lib/StdEnv/Clean\ System\ Files/*.abc build/clean/lib/StdEnv/Clean\ System\ Files
rm -rf target/new-stdenv
build_clean target/clean-base
build_cpm target/clean-base
build_docs target/clean-base
clean-compiler-and-rts code-generator master
clean-compiler-and-rts run-time-system master
clean-compiler-and-rts compiler itask
clean-compiler-and-rts compiler master
clean-compiler-and-rts language-report master
clean-compiler-and-rts stdenv master
clean-and-itasks clean-libraries master
clean-and-itasks clean-ide master
clean-and-itasks clm master
clean-tools trunk
clean-dynamic-system trunk
Version: 1.0
Environments
Environment
EnvironmentName: StdEnv
EnvironmentPaths
Path: {Application}/lib/StdEnv
EnvironmentCompiler: lib/exe/cocl:-h 256M:
EnvironmentABCOptimise: lib/exe/abcopt
EnvironmentByteCodeGen: lib/exe/bcgen
EnvironmentByteCodeLink: lib/exe/bclink
EnvironmentByteCodeStrip: lib/exe/bcstrip
EnvironmentByteCodePrelink: lib/exe/bcprelink
EnvironmentCodeGen: lib/exe/cg
EnvironmentLinker: /usr/bin/gcc::-Wl,--gc-sections
EnvironmentVersion: 920
EnvironmentRedirect: False
EnvironmentCompileMethod: Pers
EnvironmentProcessor: I386
Environment64BitProcessor: True
Environment
EnvironmentName: StdEnv iTasks
EnvironmentPaths
Path: {Application}/lib/StdEnv
EnvironmentCompiler: lib/exe/cocl-itasks
EnvironmentABCOptimise: lib/exe/abcopt
EnvironmentByteCodeGen: lib/exe/bcgen
EnvironmentByteCodeLink: lib/exe/bclink
EnvironmentByteCodeStrip: lib/exe/bcstrip
EnvironmentByteCodePrelink: lib/exe/bcprelink
EnvironmentCodeGen: lib/exe/cg
EnvironmentLinker: /usr/bin/gcc::-Wl,--gc-sections
EnvironmentVersion: 920
EnvironmentRedirect: False
EnvironmentCompileMethod: Pers
EnvironmentProcessor: I386
Environment64BitProcessor: True
# Using Clean
Compiling Clean programs on linux can be done using one of the following tools:
- clm: A build tool for simple projects. All compilation options and paths to libraries are specified as command line arguments
- cpm: A build tool that allows you to specify build configurations of programs in Clean project files (.prj).
You can use cpm to create or edit project files and build those projects.
Both tools rely on the environment variable `CLEAN_HOME` to point to where you installed Clean to find libraries and executables.
So for example if you have unpacked this package to `/Users/myusername/clean` you should the following exports to your .bashrc/.profile/etc
```
export CLEAN_HOME=/Users/myusername/clean
export PATH=$PATH:$CLEAN_HOME/bin
```
# More Info
Additional information about Clean is can be found on the website:
http://clean.cs.ru.nl
Bug reports, questions and suggestions are welcome. Please send them to:
mailto:clean@cs.ru.nl
common
\ No newline at end of file
common
\ No newline at end of file
common
\ No newline at end of file
#!/bin/bash
mkdir -p target
cp -r build/clean target/clean-bundle-complete
clean-base
clean-abc-interpreter
clean-completion
clean-lib-argenv
clean-lib-directory
clean-lib-dynamics
clean-lib-gast
clean-lib-generics
clean-lib-graphcopy
clean-lib-itasks
clean-lib-platform
clean-lib-stdlib
clean-lib-tcpip
clean-test
clean-test-properties
common
\ No newline at end of file
common
\ No newline at end of file
Supports Markdown
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