Skip to content

Commit

Permalink
bootstrap ada too
Browse files Browse the repository at this point in the history
Cross-compilation is the documented way to bootstrap ada.
  • Loading branch information
sthibaul authored and flavioc committed Nov 1, 2024
1 parent 9f7baf2 commit 0d5241e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ jobs:
- run: apt-get update
- run: apt-get install apt-transport-https ca-certificates -y
- run: update-ca-certificates
- run: apt install -y gcc make autoconf g++ texinfo libmpfr-dev libgmp-dev wget bzip2 git xz-utils sudo libmpc-dev zlib1g-dev bison flex gawk autopoint libtool fakeroot mount parted gettext meson
- run: apt install -y gcc make autoconf g++ gnat texinfo libmpfr-dev libgmp-dev wget bzip2 git xz-utils sudo libmpc-dev zlib1g-dev bison flex gawk autopoint libtool fakeroot mount parted gettext meson
- run: bash download.sh
- run: bash bootstrap.sh
- run: bash compile.sh
full-build-x86_64:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- run: apt install -y gcc make autoconf g++ texinfo libmpfr-dev libgmp-dev wget bzip2 git xz-utils sudo libmpc-dev zlib1g-dev bison flex gawk autopoint libtool fakeroot mount parted gettext
- run: apt install -y gcc make autoconf g++ gnat texinfo libmpfr-dev libgmp-dev wget bzip2 git xz-utils sudo libmpc-dev zlib1g-dev bison flex gawk autopoint libtool fakeroot mount parted gettext
- run: bash download.sh
- run: CPU=x86_64 bash bootstrap.sh
- run: CPU=x86_64 bash compile.sh
kernel-x86_64_32:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- run: apt install -y gcc make autoconf g++ texinfo libmpfr-dev libgmp-dev wget bzip2 git xz-utils sudo libmpc-dev zlib1g-dev bison flex gawk autopoint libtool fakeroot mount parted gettext
- run: apt install -y gcc make autoconf g++ gnat texinfo libmpfr-dev libgmp-dev wget bzip2 git xz-utils sudo libmpc-dev zlib1g-dev bison flex gawk autopoint libtool fakeroot mount parted gettext
- run: bash download.sh
- run: USER32="true" CPU=x86_64 bash bootstrap-kernel.sh
12 changes: 8 additions & 4 deletions bootstrap-funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ compile_gcc() {
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c &&
--enable-languages=c,c++,ada &&
make -j$PROCS all-gcc &&
make -j$PROCS install-gcc &&
make -j$PROCS configure-target-libgcc &&
make -j$PROCS all-target-libgcc &&
make -j$PROCS install-target-libgcc &&
make -j$PROCS configure-target-libada &&
make -j$PROCS all-target-libada &&
make -j$PROCS install-target-libada &&
make -j$PROCS configure-target-libstdc++-v3 &&
make -j$PROCS all-target-libstdc++-v3 &&
make -j$PROCS install-target-libstdc++-v3 &&
mv config.status config.status.removed &&
rm -f config.cache *config.cache */*/config.cache &&
cd ..
Expand Down Expand Up @@ -165,9 +170,8 @@ compile_full_gcc() {
--with-sysroot="$SYSTEM" \
--with-local-prefix="$SYS_ROOT" \
--with-native-system-header-dir="$SYS_ROOT"/include \
--disable-static \
--disable-nls \
--enable-languages=c,c++ \
--enable-languages=c,c++,ada \
--enable-threads=posix \
--disable-multilib \
--with-system-zlib \
Expand Down
2 changes: 1 addition & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ install_gcc() {
--disable-bootstrap \
--with-local-prefix="$SYS_ROOT" \
--disable-nls \
--enable-languages=c,c++ \
--enable-languages=c,c++,ada \
--disable-libstdcxx-pch \
--with-system-zlib \
--with-native-system-header-dir="$SYS_ROOT/include" \
Expand Down
11 changes: 11 additions & 0 deletions download-funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ download_glibc() {
cd ..
}

download_gcc () {
download $GCC_PKG $GCC_URL &&
if [ -d "$GCC_SRC" ]; then
return 0
fi
unpack xf $GCC_PKG $GCC_SRC &&
pushd $GCC_SRC &&
apply_patch $SCRIPT_DIR/patches/gcc/ada-hurd-amd64.diff 1 &&
popd
}

download_sed() {
download $SED_PKG $SED_URL &&
if [ -d "$SED_SRC" ]; then
Expand Down
40 changes: 40 additions & 0 deletions patches/gcc/ada-hurd-amd64.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--- a/src/gcc/ada/Makefile.rtl
+++ b/src/gcc/ada/Makefile.rtl
@@ -1674,6 +1674,37 @@ ifeq ($(strip $(filter-out x86_64 kfreeb
LIBRARY_VERSION := $(LIB_VERSION)
endif

+# x86_64-pc-gnu i.e. GNU Hurd
+ifeq ($(strip $(filter-out x86_64 pc gnu,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86_64-gnuhurd
+
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
+ s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
+ s-intman.adb<libgnarl/s-intman__posix.adb \
+ s-osinte.adb<libgnarl/s-osinte__gnu.adb \
+ s-osinte.ads<libgnarl/s-osinte__gnu.ads \
+ s-osprim.adb<libgnat/s-osprim__posix.adb \
+ s-taprop.adb<libgnarl/s-taprop__posix.adb \
+ s-taspri.ads<libgnarl/s-taspri__posix.ads \
+ s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(X86_64_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
+ system.ads<libgnat/system-freebsd.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
+
+ TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
+
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
# aarch64 FreeBSD
ifeq ($(strip $(filter-out %aarch64 freebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \

0 comments on commit 0d5241e

Please sign in to comment.