X-Git-Url: https://deadsoftware.ru/gitweb?p=cpc.git;a=blobdiff_plain;f=make-bootstrap.sh;h=5cc1c61db38bc3a719be6ee607315a6a81cc71cc;hp=8fdb3fdc4d3904db0fa7bf201f58fa7a09b5f377;hb=4698f29af16739226d3987d1cfd4ce93c068d897;hpb=4de97bf7ae01a78248a15ff69031824c5b089e31 diff --git a/make-bootstrap.sh b/make-bootstrap.sh index 8fdb3fd..5cc1c61 100755 --- a/make-bootstrap.sh +++ b/make-bootstrap.sh @@ -2,189 +2,99 @@ set -e -THIS="$(dirname "$(readlink -f "$0")")" -OUT="$THIS/bootstrap/i486" - -cpc() { - "$THIS/stage2/i486/cpfront" -outcode CodeC -outsym SymC "$@" +###^^^^^^^^^^^^^^^^^^### +### Global variables ### +###__________________### + +_exec="make-bootstrap.sh" +_this="$(dirname "$(readlink -f "$0")")" +_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 } -importlist() { - echo - while [ "$1" != "" ]; do - echo -n "\t\t$1" - shift - if [ "$1" != "" ]; then - echo "," - fi - done +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 {} + } -mainmodule() { -local name="$1" -shift -cat < "$name.cp" - shift - - cpc -main "$name.cp" - - local list="" - for mod in "$@" "$name"; do - list="$list CodeC/$mod.c" - done +error() { + echo "$_exec:" "$@" + exit 1 } -###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^### -### 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 +###^^^^^^^^^^^^^^^### +### 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 ### +###____________________### + +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 ### +###______________________### + +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" + +###^^^^^^^^^^^^^^^^### +### Make signature ### +###________________### + +if $_sign; then + gpg --yes --armor --detach-sig "cpc-$_version.src.tar.gz" +fi