Skip to content

Commit

Permalink
GPRbuild 24.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien-Chouteau committed Nov 22, 2023
1 parent aa468b2 commit eed0f22
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 26 deletions.
4 changes: 2 additions & 2 deletions specs/gnatcoll-bindings.anod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import os
class GNATcollBindings(spec("common")):
@property
def version(self):
return "22.0.0"
return "24.0.0"

@property
def tarball(self):
Expand All @@ -31,7 +31,7 @@ class GNATcollBindings(spec("common")):
@property
def build_deps(self):
deps = [
Anod.Dependency("gcc"),
Anod.Dependency("base_gcc"),
Anod.Dependency("gprbuild"),
Anod.Dependency("gnatcoll"),
Anod.Dependency("libgpr"),
Expand Down
2 changes: 1 addition & 1 deletion specs/gnatcoll.anod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import os
class GNATcoll(spec("common")):
@property
def version(self):
return "22.0.0"
return "24.0.0"

@property
def tarball(self):
Expand Down
120 changes: 120 additions & 0 deletions specs/gpr2.anod
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
from e3.os.fs import touch
from e3.anod.helper import Make, text_replace
from e3.anod.spec import Anod
from e3.anod.loader import spec
from e3.fs import cp, rm, ls
from e3.diff import patch
import os
from datetime import date


class LibGPR2(spec("common")):
@property
def version(self):
return "24.0.0"

@property
def tarball(self):
return "gpr-%s.tar.gz" % self.version

@property
def tools_only(self):
return "tools_only" in self.parsed_qualifier

@property
def source_pkg_build(self):
return [
self.HTTPSSourceBuilder(
name=self.tarball,
url="https://github.com/AdaCore/gpr/archive/v%s.tar.gz"
% self.version,
)
]

@property
def build_source_list(self):
return [
Anod.Source(name=self.tarball, publish=True, dest=""),
]

@property
def build_deps(self):
return [
Anod.Dependency("base_gcc", track=True),
Anod.Dependency("gprbuild", track=True),
Anod.Dependency("xmlada", track=True),
Anod.Dependency("libgpr", track=True),
Anod.Dependency("gnatcoll", track=True),
Anod.Dependency("gnatcoll-bindings", track=True),
Anod.Dependency("gprconfig_kb", track=True),
]

def update_version(self):
text_replace(
os.path.join(self["SRC_DIR"], "src", "lib", "gpr2-version.ads"),
[
(
"Build_Type : constant GNAT_Build_Type.*",
"Build_Type : constant GNAT_Build_Type := FSF;",
),
(
"Short_Value : constant String.*",
'Short_Value : constant String := "%s";' % self.version,
),
(
"Date : constant String.*",
'Date : constant String := "%s-gpr2";' % str(date.today()),
),
(
"Current_Year : constant String.*",
'Current_Year : constant String := "%s";' % str(date.today().year),
),
],
)

@property
def productized_tools(self):
"""List of tools from gpr2-tools.gpr we want to push in the released
package"""
return [
"gprclean",
"gprinspect",
"gprinstall",
"gprls",
"gprremote",
"gprconfig",
]


@Anod.primitive()
def build(self):
for m in self.deps:
if m != "gprconfig_kb":
self.deps[m].setenv()

self.update_version()

gprconfig_kb_dir = os.path.join(self.deps["gprconfig_kb"]["SRC_DIR"],
"db")

make = Make(self, exec_dir=self["SRC_DIR"])
make("setup")
make.set_var("GPR2KBDIR", gprconfig_kb_dir)
make.set_var("prefix", self["INSTALL_DIR"])
make.set_var("ENABLE_SHARED", "no")

make()
make("install")

if self.tools_only:
rm(os.path.join(self["INSTALL_DIR"], 'share'), recursive=True)
rm(os.path.join(self["INSTALL_DIR"], 'include'), recursive=True)
rm(os.path.join(self["INSTALL_DIR"], 'lib'), recursive=True)

bin_dir = os.path.join(self["INSTALL_DIR"], 'bin', "*")
for file in ls(bin_dir):
if os.path.basename(file) not in self.productized_tools:
rm(file)


self.clean()
2 changes: 1 addition & 1 deletion specs/gprbuild.anod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from datetime import date
class GPRbuild(spec("gh-artifact")):
@property
def version(self):
return "22.0.0"
return "24.0.0"

@property
def tarball(self):
Expand Down
2 changes: 1 addition & 1 deletion specs/libgpr.anod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import os
class LibGPR(spec("common")):
@property
def version(self):
return "22.0.0"
return "24.0.0"

@property
def tarball(self):
Expand Down
3 changes: 2 additions & 1 deletion specs/release_package.anod
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class ReleasePackage(spec("common")):
def build_deps(self):
pck = self.package
if pck == "gprbuild":
return [Anod.Dependency("gprbuild", track=True)]
return [Anod.Dependency("gprbuild"),
Anod.Dependency("gpr2", qualifier="tools_only")]

if pck == "gnatcov":
return [Anod.Dependency("gnatcov", track=True)]
Expand Down
2 changes: 1 addition & 1 deletion specs/xmlada.anod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from e3.anod.loader import spec
class XMLAda(spec("common")):
@property
def version(self):
return "22.0.0"
return "24.0.0"

@property
def tarball(self):
Expand Down
21 changes: 2 additions & 19 deletions specs/zlib.anod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@ from e3.diff import patch

import os

# patch from msys2:
# https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-zlib/01-zlib-1.2.11-1-buildsys.mingw.patch
patch_name = "zlib-buildsys-mingw.patch"


class ZLib(spec("common")):
@property
def version(self):
return "1.2.11"
return "1.3"

@property
def tarball(self):
Expand All @@ -27,19 +22,17 @@ class ZLib(spec("common")):
self.HTTPSSourceBuilder(
name=self.tarball, url="https://zlib.net/current/%s" % self.tarball
),
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):
return [Anod.Dependency("gcc")]
return [Anod.Dependency("base_gcc")]

def setenv(self):
self.env.add_search_path(
Expand All @@ -54,16 +47,6 @@ class ZLib(spec("common")):
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)

configure = Configure(self, exec_dir=self["SRC_DIR"], auto_target=False)
configure.add("--prefix=%s" % unixpath(self["INSTALL_DIR"]))
configure.add("--static")
Expand Down

0 comments on commit eed0f22

Please sign in to comment.