From df3d21abf7ebe9fd36227099f85b5f1c7bee6cff Mon Sep 17 00:00:00 2001 From: Fabien Chouteau Date: Thu, 1 Aug 2024 11:29:02 +0200 Subject: [PATCH 1/3] Prep for GNATcov 24 --- specs/binutils.anod | 71 +++++++++++++++++++++++++++++++++------------ specs/gnatcov.anod | 37 +++++++++-------------- specs/gnatutil.anod | 12 ++++++-- 3 files changed, 76 insertions(+), 44 deletions(-) diff --git a/specs/binutils.anod b/specs/binutils.anod index c74f986..3e74ba5 100644 --- a/specs/binutils.anod +++ b/specs/binutils.anod @@ -8,9 +8,17 @@ from e3.anod.loader import spec class Binutils(spec("common")): + + @property + def for_gnatcov (self): + return "gnatcov" in self.parsed_qualifier + @property def version(self): - return "2.42" + if self.for_gnatcov: + return "2.40" + else: + return "2.42" @property def tarball(self): @@ -41,32 +49,54 @@ class Binutils(spec("common")): return deps + @property + def build_space_name(self): + if self.for_gnatcov: + return "%s-gnatcov" % self.name + else: + return self.name + def merge(self, prefix): sync_tree(self["INSTALL_DIR"], prefix, delete=False) @Anod.primitive() def build(self): + for m in self.deps: self.deps[m].setenv() configure = Configure(self) configure.add("--prefix=%s" % unixpath(self["INSTALL_DIR"])) - configure.add( - "--disable-nls", - "--disable-shared", - "--disable-werror", - "--with-zlib", - "--without-zstd", - "--disable-compressed-debug-sections", - "--disable-separate-code", - "--disable-gdb", - "--disable-sim", - "--disable-libquadmath", - "--disable-readline", - ) - - # For embedded only? - configure.add("--enable-multilib") + + if self.for_gnatcov: + configure.add("--disable-ld", + "--disable-gdb", + "--disable-gdbserver", + "--disable-libquadmath", + "--disable-nls", + "--disable-readline", + "--disable-sim", + "--disable-werror", + "--enable-gprofng=no", + "--with-static-standard-libraries", + "--enable-targets=all") + # For embedded only? + configure.add("--enable-multilib") + + else: + configure.add( + "--disable-nls", + "--disable-shared", + "--disable-werror", + "--with-zlib", + "--without-zstd", + "--disable-compressed-debug-sections", + "--disable-separate-code", + "--disable-gdb", + "--disable-sim", + "--disable-libquadmath", + "--disable-readline", + ) for m in ("mpfr", "gmp", "mpc", "isl"): configure.add("--with-%s=%s" % (m, unixpath(self.deps[m]["INSTALL_DIR"]))) @@ -74,10 +104,15 @@ class Binutils(spec("common")): configure() make = Make(self) + + if self.for_gnatcov: + make.set_var("CFLAGS", " -fcommon") + make.set_var("CXXFLAGS", " -fcommon") + make.set_var("LDFLAGS", " -fcommon") + make() make("install") - # https://github.com/msys2/MINGW-packages/issues/7890 if self.env.build.os.name == "windows": # for some reason 'rm' doesn't seem to work, so we are moving the file to the build dir diff --git a/specs/gnatcov.anod b/specs/gnatcov.anod index aaeb7c0..89f2b6b 100644 --- a/specs/gnatcov.anod +++ b/specs/gnatcov.anod @@ -3,17 +3,13 @@ from e3.fs import cp from e3.anod.helper import Make from e3.anod.spec import Anod from e3.anod.loader import spec -from e3.diff import patch import os -patch_name = "gnatcov.patch" - - class GNATcov(spec("common")): @property def version(self): - return "22.0" + return "24.0" @property def tarball(self): @@ -26,32 +22,32 @@ class GNATcov(spec("common")): name=self.tarball, url="https://github.com/AdaCore/gnatcoverage/archive/refs/heads/%s.zip" % self.version, - ), - self.LocalSourceBuilder(name=patch_name), + ) ] @property def build_source_list(self): return [ Anod.Source(name=self.tarball, publish=True, dest=""), - self.Source(name=patch_name, publish=True, unpack_cmd=cp, dest="patches"), ] @property def build_deps(self): deps = [ Anod.Dependency("base_gcc", track=True), - Anod.Dependency("gprbuild", track=True), Anod.Dependency("libgpr", track=True), + Anod.Dependency("gprbuild", track=True), Anod.Dependency("gnatcoll", track=True), Anod.Dependency("gnatcoll-bindings", track=True), - Anod.Dependency("langkit", track=True), + Anod.Dependency("langkit_support", track=True), Anod.Dependency("libadalang", track=True), - Anod.Dependency("binutils", track=True), + Anod.Dependency("adasat", track=True), + Anod.Dependency("binutils", track=True, qualifier="gnatcov"), Anod.Dependency("gnatutil", track=True), Anod.Dependency("xmlada", track=True), Anod.Dependency("zlib", track=True), - Anod.Dependency("gmp", track=True) + Anod.Dependency("gmp", track=True), + Anod.Dependency("libgpr2", track=True) ] if self.env.target.os.name == "windows": deps.append(Anod.Dependency("libiconv")) @@ -60,19 +56,11 @@ class GNATcov(spec("common")): @Anod.primitive() def build(self): # Binutils are not needed in PATH - for m in [d for d in self.deps if d != "binutils"]: + # for m in [d for d in self.deps if d != "binutils"]: + # self.deps[m].setenv() + for m in self.deps: self.deps[m].setenv() - # Little hack to apply the patch only once, there is probably a clean - # way to do that. - patched = os.path.join(self["SRC_DIR"], "patches", ".patched") - if not os.path.exists(patched): - patch( - os.path.join(self["SRC_DIR"], "patches", patch_name), - self.build_space.src_dir, - ) - touch(patched) - build_mode = "prod" exec_dir = os.path.join(self["SRC_DIR"], "tools", "gnatcov") @@ -86,10 +74,13 @@ class GNATcov(spec("common")): make_distrib.set_default_target("distrib-without-doc") for m in (make_all, make_distrib): + m.set_var("C_SUPPORT", "False") + m.set_var("PART", "gnatcov64") m.set_var("BITS_ARCH", str(self.env.target.cpu.bits)) m.set_var("DISTRIB_ARCH", self.env.build.cpu.name) m.set_var("BUILD_MODE", build_mode) m.set_var("ADAPTERS_LIST", "") + m.set_var("LD_FLAGS", "-v") make_all() make_distrib() diff --git a/specs/gnatutil.anod b/specs/gnatutil.anod index e24f552..df618e4 100644 --- a/specs/gnatutil.anod +++ b/specs/gnatutil.anod @@ -8,15 +8,21 @@ import os class GNATUTIL(spec("common")): @property def version(self): - return "20.0w-20190814-1532A" + return "14.1.0" @property def tarball(self): - return "gnat_util-%s-src.tar.gz" % self.version + return "gnat_util-%s.tar.gz" % self.version @property def source_pkg_build(self): - return [self.LocalSourceBuilder(self.tarball)] + return [ + self.HTTPSSourceBuilder( + name=self.tarball, + url="https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-14.1.0-3/%s" + % self.tarball, + ) + ] @property def build_source_list(self): From e82af19639c0717bf95e21449767febead6984a2 Mon Sep 17 00:00:00 2001 From: Fabien Chouteau Date: Thu, 1 Aug 2024 11:37:45 +0200 Subject: [PATCH 2/3] Bump GPRbuild package to .2 for static libiconv --- specs/release_package.anod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/release_package.anod b/specs/release_package.anod index 0e2925c..eefb2ea 100644 --- a/specs/release_package.anod +++ b/specs/release_package.anod @@ -47,7 +47,7 @@ class ReleasePackage(spec("common")): package = self.package if package == "gprbuild": - return "1" + return "2" elif package == "gnatcov": return "1" elif package == "gnatprove": From f65f5e6f14303218935f41f87fd79d2f3dc130ae Mon Sep 17 00:00:00 2001 From: Fabien Chouteau Date: Thu, 1 Aug 2024 13:42:56 +0200 Subject: [PATCH 3/3] Split GPRbuild and GNATcov builds in different runs Also add GPRbuild run for macOS aarch64 --- .github/workflows/linux.yml | 28 ++++++++++++++++++-- .github/workflows/macos.yml | 28 +++++++++++++++++--- .github/workflows/macos_arm.yml | 34 ++++++++++++++++++++++++ .github/workflows/windows.yml | 47 ++++++++++++++++++++++++++++----- 4 files changed, 126 insertions(+), 11 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 64855ab..792db4a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -52,8 +52,8 @@ jobs: - gprbuild_gnatcov: - name: GPRbuild and GNATcov + gprbuild: + name: GPRbuild runs-on: ubuntu-20.04 steps: - name: Checkout Project @@ -77,6 +77,30 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for GitHub CLI tool + - uses: actions/upload-artifact@v2 + with: + name: release-packages + path: sbx/*/release_package*/install/* + retention-days: 5 + + + gnatcov: + name: GNATcov + runs-on: ubuntu-20.04 + steps: + - name: Checkout Project + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install e3-core==22.1.0 + - name: Build GNATcov run: ./anod build gnatcov -v --loglevel DEBUG --enable-cleanup diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 259a4c4..9ac3316 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -48,8 +48,8 @@ jobs: retention-days: 5 - gprbuild_gnatcov: - name: GPRbuild and GNATcov + gprbuild: + name: GPRbuild runs-on: macos-12 steps: - name: Checkout Project @@ -73,6 +73,29 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for GitHub CLI tool + - uses: actions/upload-artifact@v2 + with: + name: release-packages + path: sbx/*/release_package*/install/* + retention-days: 5 + + + gnatcov: + name: GNATcov + runs-on: macos-12 + steps: + - name: Checkout Project + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install e3-core==22.1.0 - name: Build GNATcov run: ./anod build gnatcov -v --loglevel DEBUG --enable-cleanup @@ -89,7 +112,6 @@ jobs: retention-days: 5 - gnat_cross: strategy: matrix: diff --git a/.github/workflows/macos_arm.yml b/.github/workflows/macos_arm.yml index 0f09772..4293f2a 100644 --- a/.github/workflows/macos_arm.yml +++ b/.github/workflows/macos_arm.yml @@ -165,6 +165,40 @@ jobs: path: /tmp/alt-ergo-install + gprbuild: + name: GPRbuild + runs-on: macos-14 + steps: + - name: Set Xcode 15.3 + run: sudo xcode-select --switch /Applications/Xcode_15.3.app + + - name: Checkout Project + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.10.11 + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install e3-core==22.1.0 + + - name: Build GPRbuild + run: ./anod build gprbuild -v --loglevel DEBUG --enable-cleanup + + - name: Package GPRbuild + run: ./anod build release_package --qualifier=package=gprbuild,do_gh_release -v --loglevel DEBUG + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for GitHub CLI tool + + - uses: actions/upload-artifact@v2 + with: + name: release-packages + path: sbx/*/release_package*/install/* + retention-days: 5 + spark: name: SPARK diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index da0c97b..7b9bed7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -63,8 +63,8 @@ jobs: - gprbuild_gnatcov: - name: GPRbuild and GNATcov + gprbuild: + name: GPRbuild runs-on: windows-2019 env: CONFIG_SHELL: /bin/bash @@ -104,6 +104,45 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for GitHub CLI tool + - uses: actions/upload-artifact@v2 + with: + name: release-packages + path: C:/aaa/GNAT-FSF-builds/sbx/*/release_package*/install/* + retention-days: 5 + + + + gnatcov: + name: GPRbuild and GNATcov + runs-on: windows-2019 + env: + CONFIG_SHELL: /bin/bash + defaults: + run: + shell: msys2 {0} + steps: + - name: Checkout Project + uses: actions/checkout@v2 + + - name: Install msys2 + uses: msys2/setup-msys2@v2 + with: + install: >- + base-devel + git + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-github-cli + mingw-w64-x86_64-python + mingw-w64-x86_64-python-pip + mingw-w64-x86_64-python-psutil + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install e3-core==22.1.0 + + - name: Prepare msys2 build setup + # We need a path that is compatible between Windows and Unix world + run: df -h; mkdir /c/aaa; mount C:/aaa /aaa ; cd ..; cp -r GNAT-FSF-builds /c/aaa - name: Build GNATcov run: mount C:/aaa /aaa && cd /aaa/GNAT-FSF-builds && python3 ./anod build gnatcov -v --loglevel DEBUG --enable-cleanup @@ -120,10 +159,6 @@ jobs: retention-days: 5 - - - - gnat_cross: strategy: matrix: