DEADSOFTWARE

fix Kernel compilation with cpfront
[cpc.git] / make-bootstrap.sh
1 #! /bin/sh
3 set -e
5 ###^^^^^^^^^^^^^^^^^^###
6 ### Global variables ###
7 ###__________________###
9 _exec="make-bootstrap.sh"
10 _this="$(dirname "$(readlink -f "$0")")"
11 _version="v0.2"
12 _sign=false
14 ###^^^^^^^^^^^###
15 ### Functions ###
16 ###___________###
18 usage() {
19 echo "Usage: make-bootstrap.sh [options]"
20 echo "Options:"
21 echo " -v version Set build version"
22 echo " -S Sign build"
23 exit 2
24 }
26 make_bootstrap() {
27 local _cpu="$1"
28 local _target="$2"
29 local _system="$3"
30 "$_this/make.sh" -x -o "$_this/bootstrap/$_cpu-$_target-$_system" \
31 "$_cpu" "$_target" "$_system"
32 find "$_this/bootstrap/$_cpu-$_target-$_system" -mindepth 1 -maxdepth 1 \
33 -type d -name 'CodeC' -prune -o -exec rm -rf {} +
34 }
36 error() {
37 echo "$_exec:" "$@"
38 exit 1
39 }
41 ###^^^^^^^^^^^^^^^###
42 ### Parse options ###
43 ###_______________###
45 while getopts v:Sh _name
46 do
47 case "$_name" in
48 v) _version="$OPTARG" ;;
49 S) _sign=true ;;
50 h|?) usage ;;
51 esac
52 done
54 if [ -z "$_version" ] || echo "$_version" | grep " " > /dev/null; then
55 error "version not specified or contain spaces"
56 fi
58 ###^^^^^^^^^^^^^^^^^^^^###
59 ### Prebuild C sources ###
60 ###____________________###
62 rm -rf "$_this/bootstrap"
63 mkdir -p "$_this/bootstrap"
64 make_bootstrap 486 cpfront linux
65 make_bootstrap 486 cpfront cygwin
66 make_bootstrap arm cpfront linux
68 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
69 ### Hack: remove temp files from v0.1 ###
70 ###___________________________________###
72 find "$_this/bootstrap" -type f -name '.new*' -delete
74 ###^^^^^^^^^^^^^^^^^^^^^^###
75 ### Package dist sources ###
76 ###______________________###
78 rm -rf "$_this/cpc-$_version"
79 mkdir -p "$_this/cpc-$_version"
80 cp -rt "$_this/cpc-$_version" -- \
81 "$_this/CHANGELOG" \
82 "$_this/LICENSE" \
83 "$_this/README" \
84 "$_this/man" \
85 "$_this/crux" \
86 "$_this/make.sh" \
87 "$_this/make-all.sh" \
88 "$_this/make-bootstrap.sh" \
89 "$_this/bootstrap" \
90 "$_this/src" \
91 "$_this/C"
92 tar czf "cpc-$_version.src.tar.gz" "cpc-$_version"
94 ###^^^^^^^^^^^^^^^^###
95 ### Make signature ###
96 ###________________###
98 if $_sign; then
99 gpg --yes --armor --detach-sig "cpc-$_version.src.tar.gz"
100 fi