DEADSOFTWARE

fix pass record/array by value
[cpc.git] / make-bootstrap.sh
index 3c7f446a84f1303afaf0a7430e83a0e32ce10ecc..5cc1c61db38bc3a719be6ee607315a6a81cc71cc 100755 (executable)
@@ -8,12 +8,21 @@ set -e
 
 _exec="make-bootstrap.sh"
 _this="$(dirname "$(readlink -f "$0")")"
-_version="v0.2"
+_version="v0.3"
+_sign=false
 
 ###^^^^^^^^^^^###
 ### Functions ###
 ###___________###
 
+usage() {
+  echo "Usage: make-bootstrap.sh [options]"
+  echo "Options:"
+  echo "    -v version        Set build version"
+  echo "    -S                Sign build"
+  exit 2
+}
+
 make_bootstrap() {
   local _cpu="$1"
   local _target="$2"
@@ -24,6 +33,28 @@ make_bootstrap() {
     -type d -name 'CodeC' -prune -o -exec rm -rf {} +
 }
 
+error() {
+  echo "$_exec:" "$@"
+  exit 1
+}
+
+###^^^^^^^^^^^^^^^###
+### Parse options ###
+###_______________###
+
+while getopts v:Sh _name
+do
+  case "$_name" in
+    v) _version="$OPTARG" ;;
+    S) _sign=true ;;
+    h|?) usage ;;
+  esac
+done
+
+if [ -z "$_version" ] || echo "$_version" | grep " " > /dev/null; then
+  error "version not specified or contain spaces"
+fi
+
 ###^^^^^^^^^^^^^^^^^^^^###
 ### Prebuild C sources ###
 ###____________________###
@@ -31,6 +62,14 @@ make_bootstrap() {
 rm -rf "$_this/bootstrap"
 mkdir -p "$_this/bootstrap"
 make_bootstrap 486 cpfront linux
+make_bootstrap 486 cpfront cygwin
+make_bootstrap arm cpfront linux
+
+###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
+### Hack: remove temp files from v0.1 ###
+###___________________________________###
+
+find "$_this/bootstrap" -type f -name '.new*' -delete
 
 ###^^^^^^^^^^^^^^^^^^^^^^###
 ### Package dist sources ###
@@ -51,3 +90,11 @@ cp -rt "$_this/cpc-$_version" -- \
   "$_this/src" \
   "$_this/C"
 tar czf "cpc-$_version.src.tar.gz" "cpc-$_version"
+
+###^^^^^^^^^^^^^^^^###
+### Make signature ###
+###________________###
+
+if $_sign; then
+  gpg --yes --armor --detach-sig "cpc-$_version.src.tar.gz"
+fi