recipes: docbook/sgml-common: fix ent entries in post-install
[dragora.git] / darkcrusade
blob593e324cdb243f56f2bd8928eb869b8d5bc5a020
1 #! /bin/sh -
3 # Deploy static cross-compilers for easy distribution
5 # Copyright (c) 2016-2019 Matias Fonzo, <selk@dragora.org>.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 PROGRAM="${0##*/}"
21 # Show help via option
22 if test "$1" = -h -o "$1" = --help
23 then
24 echo "Deploy static cross-compilers for easy distribution."
25 echo ""
26 echo "Usage: $PROGRAM [TARGET]..."
27 echo ""
28 echo "Where TARGET is any target found in the directory \"targets\"."
29 echo "If no target names are passed, all available targets will be built."
30 echo ""
31 exit 0
34 # Exit immediately on any error
35 set -e
37 # Override locale settings
38 LC_ALL=C
39 export LC_ALL
41 #### Default values
43 # Get physical working directory, absolute path name
44 CWD=$(CDPATH= cd -P -- $(dirname -- "$0") && printf "$PWD")
46 # Output directory for tarballs
47 output="${CWD}/OUTPUT.darkcrusade"
49 # Set temporary directory for compilation, exporting it
50 TMPDIR=${output}/sources
51 export TMPDIR
53 # Compose tag for tarball names using year+month+day
54 tarname=darkcrusade_"$(date +%Y%b)"
56 # Prepare to start the cross compiler process in the phase 1
58 phase_one=${output}/phase1-native-"$(uname -m)".$$
60 echo "${PROGRAM}: Creating native cross compiler on $phase_one ..."
61 "${CWD}"/bootstrap -s0 -o $phase_one
63 # Now will start the preparatives to use the recent native cross compiler
65 echo "${PROGRAM}: Using (existing) compiler from $phase_one ..."
67 # Set flags according to the generated compiler
68 for BTCC in ${phase_one}/cross/*/bin/*-gcc
70 if test -x "$BTCC"
71 then
72 BTCC="$BTCC"
73 break
75 done
76 for BTCXX in ${phase_one}/cross/*/bin/*-g++
78 if test -x "$BTCXX"
79 then
80 BTCXX="$BTCXX"
81 break
83 done
85 # Set and compose flags to be used as CC/CXX
87 BTCC="$BTCC -static -Wl,-Bstatic -static-libgcc"
88 BTCXX="$BTCXX -static -Wl,-Bstatic -static-libgcc"
90 IS_DARKCRUSADE=IS_DARKCRUSADE
92 export BTCC BTCXX IS_DARKCRUSADE
94 # Loop for create the targets, phase 2
95 for target in "${CWD}"/targets/${@:-*}
97 target="${target##*/}"
99 phase_two=${output}/phase2-${target}.$$
101 echo "darkcrusade: Making target $target ..."
102 "${CWD}"/bootstrap -s0 -a $target -o $phase_two 2>&1 | \
103 tee ${output}/${tarname}-${target}.log
105 # Provide log file, tarball plus checkum
107 lzip -9 ${output}/${tarname}-${target}.log
109 # Produce tarball and .sha256
111 cd $output && rm -f ${tarname}-${target}.tar ${tarname}-${target}.tar.lz
113 cd $phase_two && tarlz -c cross/ > ${output}/${tarname}-${target}.tar.lz
115 cd $output && sha256sum ${tarname}-${target}.tar.lz \
116 > ${tarname}-${target}.tar.lz.sha256
118 # Back to the current working directory
119 cd -- "$CWD"
120 done