DEADSOFTWARE

updated build scripts
[cpc.git] / make-bootstrap.sh
index 8fdb3fdc4d3904db0fa7bf201f58fa7a09b5f377..3c7f446a84f1303afaf0a7430e83a0e32ce10ecc 100755 (executable)
 
 set -e
 
-THIS="$(dirname "$(readlink -f "$0")")"
-OUT="$THIS/bootstrap/i486"
-
-cpc() {
-       "$THIS/stage2/i486/cpfront" -outcode CodeC -outsym SymC "$@"
-}
-
-importlist() {
-       echo
-       while [ "$1" != "" ]; do
-               echo -n "\t\t$1"
-               shift
-               if [ "$1" != "" ]; then
-                       echo ","
-               fi
-       done
-}
-
-mainmodule() {
-local name="$1"
-shift
-cat <<!
-MODULE ${name};
-
-       IMPORT $(importlist "$@");
-
-END ${name}.
-!
+###^^^^^^^^^^^^^^^^^^###
+### Global variables ###
+###__________________###
+
+_exec="make-bootstrap.sh"
+_this="$(dirname "$(readlink -f "$0")")"
+_version="v0.2"
+
+###^^^^^^^^^^^###
+### Functions ###
+###___________###
+
+make_bootstrap() {
+  local _cpu="$1"
+  local _target="$2"
+  local _system="$3"
+  "$_this/make.sh" -x -o "$_this/bootstrap/$_cpu-$_target-$_system" \
+    "$_cpu" "$_target" "$_system"
+  find "$_this/bootstrap/$_cpu-$_target-$_system" -mindepth 1 -maxdepth 1 \
+    -type d -name 'CodeC' -prune -o -exec rm -rf {} +
 }
 
-linkall() {
-       local name="$1";
-       mainmodule "$@" > "$name.cp"
-       shift
-
-       cpc -main "$name.cp"
-
-       local list=""
-       for mod in "$@" "$name"; do
-               list="$list CodeC/$mod.c"
-       done
-}
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Prepare bbdsw sources for LINUX/i486 ###
-###______________________________________###
-
-rm -rf "$OUT"
-mkdir -p "$OUT"
-cp -r -- \
-       "$THIS/src/generic/"* \
-       "$THIS/src/posix/"* \
-       "$THIS/src/cpfront/posix/"* \
-       "$THIS/src/cpfront/linux/"* \
-       "$OUT"
-cd "$OUT"
-
-###^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile POSIX bindings ###
-###________________________###
-
-cpc C99/Mod/types.cp \
-       C99/Mod/sys_types.cp \
-       C99/Mod/stdlib.cp C99/Mod/stdio.cp C99/Mod/unistd.cp \
-       C99/Mod/dirent.cp C99/Mod/locale.cp C99/Mod/time.cp \
-       C99/Mod/sys_stat.cp C99/Mod/fcntl.cp C99/Mod/errno.cp \
-       C99/Mod/iconv.cp C99/Mod/wctype.cp C99/Mod/sys_mman.cp \
-       C99/Mod/dlfcn.cp C99/Mod/signal.cp C99/Mod/setjmp.cp \
-       C99/Mod/libgen.cp \
-       C99/Mod/macro.cp
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile BlackBox Framework ###
-###____________________________###
-
-cpc System/Mod/Math.cp System/Mod/SMath.cp System/Mod/Kernel.cp \
-       System/Mod/Console.odc System/Mod/Files.odc System/Mod/Dates.odc \
-       System/Mod/Log.odc System/Mod/Strings.odc System/Mod/Services.odc \
-       System/Mod/Int.odc System/Mod/Integers.odc
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile Linux Host subsystem ###
-###______________________________###
-
-cpc Host/Mod/Lang.cp Host/Mod/Dates.cp Host/Mod/Console.cp Host/Mod/Files.cp
-
-###^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile Dev subsystem ###
-###_______________________###
-
-cpc Dev/Mod/CPM.cp Dev/Mod/CPT.odc Dev/Mod/CPS.odc Dev/Mod/CPB.odc \
-       Dev/Mod/CPP.odc Dev/Mod/CPE.odc Dev/Mod/CPH.odc Dev/Mod/CPL486.odc \
-       Dev/Mod/CPC486.odc Dev/Mod/CPV486.odc
-
-###^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile Dev2 subsystem ###
-###________________________###
-
-cpc Dev2/Mod/LnkBase.odc Dev2/Mod/LnkChmod.odc Dev2/Mod/LnkLoad.odc \
-       Dev2/Mod/LnkWriteElf.odc Dev2/Mod/LnkWriteElfStatic.odc \
-       Dev2/Mod/LnkWritePe.odc
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile CPfront subsystem ###
-###___________________________###
-
-cpc CPfront/Mod/CPG.odc CPfront/Mod/CPC.odc CPfront/Mod/CPV.odc
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile bbdsw-specific modules ###
-###________________________________###
-
-cpc Dsw/Mod/Documents.cp Dsw/Mod/Log.odc Dsw/Mod/Compiler486Main.cp \
-       Dsw/Mod/CompilerCPfrontMain.cp Dsw/Mod/Linker486Main.cp
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Compile other utilities ###
-###_________________________###
-
-cpc Dsw/Mod/ListMain.cp Dsw/Mod/EchoMain.cp Dsw/Mod/LoopMain.cp
-
-###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
-### Link Standalone Component Pascl Compiler & Dev2 Linker ###
-###________________________________________________________###
-
-linkall cpfront \
-       C99types C99macro \
-       Kernel Console Files Dates Math Strings Services Log \
-       HostLang HostConsole HostFiles HostDates DswLog \
-       DevCPM DevCPT DevCPS DevCPB DevCPP DevCPE DevCPH \
-       CPfrontCPG CPfrontCPC CPfrontCPV\
-       DswDocuments DswCompilerCPfrontMain
-
-linkall cpc486 \
-       C99types C99macro \
-       Kernel Console Files Dates Math Strings Services Log \
-       HostLang HostConsole HostFiles HostDates DswLog \
-       DevCPM DevCPT DevCPS DevCPB DevCPP DevCPE DevCPH \
-       DevCPL486 DevCPC486 DevCPV486 \
-       DswDocuments DswCompiler486Main
-
-linkall cpl486 \
-       C99types C99macro \
-       Kernel Console Files Math Strings Services Log \
-       HostLang HostConsole HostFiles DswLog \
-       Dev2LnkBase Dev2LnkChmod Dev2LnkLoad Dev2LnkWriteElf \
-       Dev2LnkWriteElfStatic Dev2LnkWritePe \
-       DswLinker486Main
-
-#linkall cplist \
-#      C99types C99macro \
-#      Kernel Console Files Math Strings Services Log \
-#      HostLang HostConsole HostFiles DswLog \
-#      DswListMain
-
-#linkall cpecho \
-#      C99types C99macro \
-#      Kernel Console Files Math Strings Services Log \
-#      HostLang HostConsole HostFiles DswLog \
-#      DswEchoMain
-
-#linkall cploop \
-#      C99types C99macro \
-#      Kernel Console Files Math Strings Services Log \
-#      HostLang HostConsole HostFiles DswLog \
-#      DswLoopMain
-
-rm -rf "$THIS/bootstrap-src"
-mkdir -p "$THIS/bootstrap-src"
-cp -r -t "$THIS/bootstrap-src" -- \
-       "$THIS/CHANGELOG" \
-       "$THIS/LICENSE" \
-       "$THIS/README" \
-       "$THIS/man" \
-       "$THIS/crux" \
-       "$THIS/make-bootstrap.sh" \
-       "$THIS/make-stage0.sh" \
-       "$THIS/make-stage0c.sh" \
-       "$THIS/make-stage1.sh" \
-       "$THIS/make-stage2.sh" \
-       "$THIS/src" \
-       "$THIS/C" \
-       CodeC
-
-cd "$THIS"
-tar czf cpc-v0.1.src.tar.gz bootstrap-src
+###^^^^^^^^^^^^^^^^^^^^###
+### Prebuild C sources ###
+###____________________###
+
+rm -rf "$_this/bootstrap"
+mkdir -p "$_this/bootstrap"
+make_bootstrap 486 cpfront linux
+
+###^^^^^^^^^^^^^^^^^^^^^^###
+### Package dist sources ###
+###______________________###
+
+rm -rf "$_this/cpc-$_version"
+mkdir -p "$_this/cpc-$_version"
+cp -rt "$_this/cpc-$_version" -- \
+  "$_this/CHANGELOG" \
+  "$_this/LICENSE" \
+  "$_this/README" \
+  "$_this/man" \
+  "$_this/crux" \
+  "$_this/make.sh" \
+  "$_this/make-all.sh" \
+  "$_this/make-bootstrap.sh" \
+  "$_this/bootstrap" \
+  "$_this/src" \
+  "$_this/C"
+tar czf "cpc-$_version.src.tar.gz" "cpc-$_version"