Verified Commit dbf832ce authored by Camil Staps's avatar Camil Staps 🙂

Add clean-base/linux-arm64

parent 24fa0b09
Pipeline #41083 passed with stage
in 3 minutes and 13 seconds
#!/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
(cd build/codegenerator
make -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
(cd build/clm
make -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 ../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-master build/compiler
sed -i 's/-m32//' build/compiler/main/Unix/Makefile
(cd build/compiler
clm -ABC -nw -ci -I backend -I frontend -I main/Unix -IL ArgEnv backendconvert
sed -i 's:-I ../libraries/ArgEnvUnix:-IL ArgEnv:' unix/make.linux64.sh
./unix/make.linux64.sh
)
mkdir -p $1/lib/exe
cp build/compiler/cocl $1/lib/exe/cocl
}
build_compiler_itask () { # $1:target
mkdir -p build
cp -r src/compiler-itask build/compiler-itask
sed -i 's/-m32//' build/compiler-itask/main/Unix/Makefile
(cd build/compiler-itask
clm -ABC -nw -ci -I backend -I frontend -I main/Unix -IL ArgEnv backendconvert
sed -i 's:-I ../libraries/ArgEnvUnix:-IL ArgEnv:' unix/make.linux64.sh
./unix/make.linux64.sh
)
mkdir -p $1/lib/exe
cp build/compiler-itask/cocl $1/lib/exe/cocl-itasks
}
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
./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 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/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_itask $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
Markdown is supported
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