From 10b73a29ad6cff12297a1c86a8e9c1b7a6e41780 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Wed, 9 Oct 2024 09:36:02 -0700 Subject: [PATCH] Add support for building PostGIS and its dependencies (#116) This also adapts to the metapkg changes in edgedb/metapkg#40 --- edgedbpkg/edgedb/__init__.py | 191 ++++--- edgedbpkg/edgedb_ext/__init__.py | 3 + edgedbpkg/edgedb_ext/base.py | 177 ++++++ edgedbpkg/edgedb_ext/postgis/__init__.py | 38 ++ edgedbpkg/edgedb_ext/postgis/install.list | 4 + edgedbpkg/edgedb_ext/postgis/no_install.list | 4 + edgedbpkg/edgedb_grafana_backend/__init__.py | 14 +- edgedbpkg/edgedb_ls/__init__.py | 55 +- edgedbpkg/icu/__init__.py | 17 +- edgedbpkg/libabseil/__init__.py | 149 +++++ edgedbpkg/libabseil/install.list | 1 + edgedbpkg/libabseil/no_install.list | 14 + .../libabsl__cmake_xarch_flags_fix.patch | 49 ++ edgedbpkg/libb2/__init__.py | 32 +- edgedbpkg/libb2/ignore.list | 6 +- edgedbpkg/libexpat/__init__.py | 26 + edgedbpkg/libexpat/install.list | 1 + edgedbpkg/libexpat/no_install.list | 15 + edgedbpkg/libffi/__init__.py | 14 +- edgedbpkg/libgdal/__init__.py | 171 ++++++ edgedbpkg/libgdal/ignore.list | 1 + edgedbpkg/libgdal/install.list | 4 + edgedbpkg/libgdal/no_install.list | 14 + .../patches/libgdal__relative-data-load.patch | 145 +++++ edgedbpkg/libgeos/__init__.py | 45 ++ edgedbpkg/libgeos/install.list | 1 + edgedbpkg/libgeos/no_install.list | 14 + edgedbpkg/libgeotiff/__init__.py | 71 +++ edgedbpkg/libgeotiff/install.list | 1 + edgedbpkg/libgeotiff/no_install.list | 14 + edgedbpkg/libjson_c/__init__.py | 40 ++ edgedbpkg/libjson_c/install.list | 2 + edgedbpkg/libjson_c/no_install.list | 12 + edgedbpkg/libjsoncpp/__init__.py | 33 ++ edgedbpkg/libjsoncpp/install.list | 1 + edgedbpkg/libjsoncpp/no_install.list | 14 + edgedbpkg/libpcre2/__init__.py | 43 ++ edgedbpkg/libpcre2/ignore.list | 1 + edgedbpkg/libpcre2/install.list | 1 + edgedbpkg/libpcre2/no_install.list | 12 + edgedbpkg/libproj/__init__.py | 74 +++ edgedbpkg/libproj/install.list | 2 + edgedbpkg/libproj/no_install.list | 16 + .../patches/libproj__relative_share_fix.patch | 55 ++ edgedbpkg/libprotobuf_c/__init__.py | 40 ++ edgedbpkg/libprotobuf_c/install.list | 1 + edgedbpkg/libprotobuf_c/no_install.list | 14 + .../patches/libprotobuf-c__build_fixes.patch | 117 ++++ edgedbpkg/libsqlite3/__init__.py | 123 +++++ edgedbpkg/libsqlite3/install.list | 1 + edgedbpkg/libsqlite3/no_install.list | 7 + edgedbpkg/libtiff/__init__.py | 63 +++ edgedbpkg/libtiff/install.list | 1 + edgedbpkg/libtiff/no_install.list | 14 + edgedbpkg/libuuid/__init__.py | 13 +- edgedbpkg/libxml2/__init__.py | 38 ++ edgedbpkg/libxml2/install.list | 1 + edgedbpkg/libxml2/no_install.list | 19 + edgedbpkg/openssl/__init__.py | 65 ++- edgedbpkg/openssl/no_install.list | 2 + edgedbpkg/pgbundle/__init__.py | 9 +- edgedbpkg/pgext/__init__.py | 3 + edgedbpkg/pgext/base.py | 157 ++++++ edgedbpkg/pgext/pgvector/__init__.py | 114 +--- ...h => pgext-pgvector__Fix-CFLAGS-004.patch} | 0 ...h => pgext-pgvector__Fix-CFLAGS-006.patch} | 0 ...ext-pgvector__Fix-build-warning-004.patch} | 0 edgedbpkg/pgext/postgis/__init__.py | 74 +++ edgedbpkg/pgext/postgis/ignore.list | 1 + edgedbpkg/pgext/postgis/install.list | 6 + edgedbpkg/pgext/postgis/no_install.list | 16 + .../pgext-postgis__fix-out-of-tree.patch | 43 ++ .../pgext-postgis__geos-pkgconfig-304.patch | 514 ++++++++++++++++++ .../pgext-postgis__macos-fix-304.patch | 62 +++ .../pgext-postgis__mkdir-p-config-fix.patch | 94 ++++ ...pgext-postgis__protocc-pkgconfig-304.patch | 77 +++ ...__remove-explicit-libstdcpp-link-304.patch | 57 ++ edgedbpkg/postgresql/__init__.py | 102 ++-- edgedbpkg/postgresql/ignore.list | 4 +- .../postgresql-edgedb__pkgconfig-16.patch | 38 +- edgedbpkg/protobuf/__init__.py | 75 +++ edgedbpkg/protobuf/install.list | 1 + edgedbpkg/protobuf/no_install.list | 14 + edgedbpkg/protoc_c/__init__.py | 34 ++ edgedbpkg/protoc_c/install.list | 2 + edgedbpkg/protoc_c/no_install.list | 12 + .../patches/protoc-c__build_fixes.patch | 117 ++++ edgedbpkg/python/__init__.py | 110 ++-- edgedbpkg/python/ignore.list | 3 +- edgedbpkg/zlib/__init__.py | 21 +- .../linux/build/Dockerfile-centos.template | 36 +- .../linux/build/Dockerfile-debian.template | 18 +- .../linux/build/Dockerfile-fedora.template | 19 +- .../linux/build/Dockerfile-linux.template | 43 +- .../linux/build/Dockerfile-linuxmusl.template | 10 +- .../build/Dockerfile-rockylinux.template | 79 ++- integration/linux/build/centos-7/Dockerfile | 37 +- integration/linux/build/centos-8/Dockerfile | 37 +- .../linux/build/debian-bookworm/Dockerfile | 44 +- .../linux/build/debian-bullseye/Dockerfile | 44 +- .../linux/build/debian-buster/Dockerfile | 44 +- integration/linux/build/entrypoint.sh | 1 + integration/linux/build/fedora-29/Dockerfile | 20 +- .../linux/build/linux-aarch64/Dockerfile | 44 +- .../linux/build/linux-x86_64/Dockerfile | 44 +- .../linux/build/linuxmusl-aarch64/Dockerfile | 11 +- .../linux/build/linuxmusl-x86_64/Dockerfile | 11 +- .../linux/build/rockylinux-9/Dockerfile | 82 ++- .../linux/build/ubuntu-bionic/Dockerfile | 13 +- .../linux/build/ubuntu-focal/Dockerfile | 44 +- .../linux/build/ubuntu-hirsute/Dockerfile | 44 +- .../linux/build/ubuntu-jammy/Dockerfile | 44 +- .../linux/build/ubuntu-noble/Dockerfile | 44 +- integration/macos/build.sh | 2 +- setup.py | 2 +- 115 files changed, 4145 insertions(+), 548 deletions(-) create mode 100644 edgedbpkg/edgedb_ext/__init__.py create mode 100644 edgedbpkg/edgedb_ext/base.py create mode 100644 edgedbpkg/edgedb_ext/postgis/__init__.py create mode 100644 edgedbpkg/edgedb_ext/postgis/install.list create mode 100644 edgedbpkg/edgedb_ext/postgis/no_install.list create mode 100644 edgedbpkg/libabseil/__init__.py create mode 100644 edgedbpkg/libabseil/install.list create mode 100644 edgedbpkg/libabseil/no_install.list create mode 100644 edgedbpkg/libabseil/patches/libabsl__cmake_xarch_flags_fix.patch create mode 100644 edgedbpkg/libexpat/__init__.py create mode 100644 edgedbpkg/libexpat/install.list create mode 100644 edgedbpkg/libexpat/no_install.list create mode 100644 edgedbpkg/libgdal/__init__.py create mode 100644 edgedbpkg/libgdal/ignore.list create mode 100644 edgedbpkg/libgdal/install.list create mode 100644 edgedbpkg/libgdal/no_install.list create mode 100644 edgedbpkg/libgdal/patches/libgdal__relative-data-load.patch create mode 100644 edgedbpkg/libgeos/__init__.py create mode 100644 edgedbpkg/libgeos/install.list create mode 100644 edgedbpkg/libgeos/no_install.list create mode 100644 edgedbpkg/libgeotiff/__init__.py create mode 100644 edgedbpkg/libgeotiff/install.list create mode 100644 edgedbpkg/libgeotiff/no_install.list create mode 100644 edgedbpkg/libjson_c/__init__.py create mode 100644 edgedbpkg/libjson_c/install.list create mode 100644 edgedbpkg/libjson_c/no_install.list create mode 100644 edgedbpkg/libjsoncpp/__init__.py create mode 100644 edgedbpkg/libjsoncpp/install.list create mode 100644 edgedbpkg/libjsoncpp/no_install.list create mode 100644 edgedbpkg/libpcre2/__init__.py create mode 100644 edgedbpkg/libpcre2/ignore.list create mode 100644 edgedbpkg/libpcre2/install.list create mode 100644 edgedbpkg/libpcre2/no_install.list create mode 100644 edgedbpkg/libproj/__init__.py create mode 100644 edgedbpkg/libproj/install.list create mode 100644 edgedbpkg/libproj/no_install.list create mode 100644 edgedbpkg/libproj/patches/libproj__relative_share_fix.patch create mode 100644 edgedbpkg/libprotobuf_c/__init__.py create mode 100644 edgedbpkg/libprotobuf_c/install.list create mode 100644 edgedbpkg/libprotobuf_c/no_install.list create mode 100644 edgedbpkg/libprotobuf_c/patches/libprotobuf-c__build_fixes.patch create mode 100644 edgedbpkg/libsqlite3/__init__.py create mode 100644 edgedbpkg/libsqlite3/install.list create mode 100644 edgedbpkg/libsqlite3/no_install.list create mode 100644 edgedbpkg/libtiff/__init__.py create mode 100644 edgedbpkg/libtiff/install.list create mode 100644 edgedbpkg/libtiff/no_install.list create mode 100644 edgedbpkg/libxml2/__init__.py create mode 100644 edgedbpkg/libxml2/install.list create mode 100644 edgedbpkg/libxml2/no_install.list create mode 100644 edgedbpkg/pgext/base.py rename edgedbpkg/pgext/pgvector/patches/{pgext-pgvector__Fix-CFLAGS-04.patch => pgext-pgvector__Fix-CFLAGS-004.patch} (100%) rename edgedbpkg/pgext/pgvector/patches/{pgext-pgvector__Fix-CFLAGS-06.patch => pgext-pgvector__Fix-CFLAGS-006.patch} (100%) rename edgedbpkg/pgext/pgvector/patches/{pgext-pgvector__Fix-build-warning-04.patch => pgext-pgvector__Fix-build-warning-004.patch} (100%) create mode 100644 edgedbpkg/pgext/postgis/__init__.py create mode 100644 edgedbpkg/pgext/postgis/ignore.list create mode 100644 edgedbpkg/pgext/postgis/install.list create mode 100644 edgedbpkg/pgext/postgis/no_install.list create mode 100644 edgedbpkg/pgext/postgis/patches/pgext-postgis__fix-out-of-tree.patch create mode 100644 edgedbpkg/pgext/postgis/patches/pgext-postgis__geos-pkgconfig-304.patch create mode 100644 edgedbpkg/pgext/postgis/patches/pgext-postgis__macos-fix-304.patch create mode 100644 edgedbpkg/pgext/postgis/patches/pgext-postgis__mkdir-p-config-fix.patch create mode 100644 edgedbpkg/pgext/postgis/patches/pgext-postgis__protocc-pkgconfig-304.patch create mode 100644 edgedbpkg/pgext/postgis/patches/pgext-postgis__remove-explicit-libstdcpp-link-304.patch create mode 100644 edgedbpkg/protobuf/__init__.py create mode 100644 edgedbpkg/protobuf/install.list create mode 100644 edgedbpkg/protobuf/no_install.list create mode 100644 edgedbpkg/protoc_c/__init__.py create mode 100644 edgedbpkg/protoc_c/install.list create mode 100644 edgedbpkg/protoc_c/no_install.list create mode 100644 edgedbpkg/protoc_c/patches/protoc-c__build_fixes.patch diff --git a/edgedbpkg/edgedb/__init__.py b/edgedbpkg/edgedb/__init__.py index 83606ba9..4c35ad6b 100644 --- a/edgedbpkg/edgedb/__init__.py +++ b/edgedbpkg/edgedb/__init__.py @@ -7,7 +7,6 @@ import os import pathlib import platform -import shlex import textwrap from poetry.core.packages import dependency as poetry_dep @@ -78,15 +77,40 @@ class EdgeDB(packages.BundledPythonPackage): ], } - artifact_build_requirements = [ - "pyentrypoint (>=1.0.0)", - "pypkg-setuptools (<70.2.0)", - ] + artifact_build_requirements = { + ">=2.0,<3.0.rc1": [ + "postgresql-edgedb (~= 14.0)", + "python-edgedb (~= 3.10.0)", + "pyentrypoint (>=1.0.0)", + "pypkg-setuptools (<70.2.0)", + ], + ">=3.0rc1,<4.0.dev1": [ + "postgresql-edgedb (~= 14.0)", + "python-edgedb (~= 3.11.0)", + "pgext-pgvector (~= 0.4.0)", + "pyentrypoint (>=1.0.0)", + "pypkg-setuptools (<70.2.0)", + ], + ">=4.0.dev1,<5.0.dev1": [ + "postgresql-edgedb (~= 15.0)", + "python-edgedb (~= 3.11.0)", + "pgext-pgvector (~= 0.4.0)", + "pyentrypoint (>=1.0.0)", + "pypkg-setuptools (<70.2.0)", + ], + ">=5.0.dev1": [ + "postgresql-edgedb (~= 16.0)", + "python-edgedb (~= 3.12.0)", + "pgext-pgvector (~= 0.6.0)", + "pyentrypoint (>=1.0.0)", + "pypkg-setuptools (<70.2.0)", + ], + } bundle_deps = [ postgresql.PostgreSQL(version="14.11"), postgresql.PostgreSQL(version="15.6"), - postgresql.PostgreSQL(version="16.2"), + postgresql.PostgreSQL(version="16.4"), python_bundle.Python(version="3.10.11"), python_bundle.Python(version="3.11.8"), python_bundle.Python(version="3.12.2"), @@ -104,6 +128,7 @@ def resolve( revision: str | None = None, is_release: bool = False, target: targets.Target, + requires: list[poetry_dep.Dependency] | None = None, ) -> EdgeDB: os.environ["EDGEDB_BUILD_OFFICIAL"] = "yes" os.environ["EDGEDB_BUILD_TARGET"] = ( @@ -132,6 +157,7 @@ def resolve( revision=revision, is_release=is_release, target=target, + requires=requires, ) finally: if prev is None: @@ -185,8 +211,6 @@ def get_package_repository( repo.register_package_impl("jwcrypto", JWCrypto) repo.register_package_impl("edgedb", EdgeDBPython) repo.register_package_impl("maturin", Maturin) - repo.register_package_impl("pydantic-core", PyPackageNeedingMaturin) - repo.register_package_impl("rpds-py", PyPackageNeedingMaturin) return repo @property @@ -239,19 +263,25 @@ def get_version_metadata_fields(self) -> dict[str, str]: return fields def sh_get_build_wheel_env( - self, build: targets.Build, *, site_packages_var: str - ) -> dict[str, str]: + self, + build: targets.Build, + *, + site_packages: str, + wd: str, + ) -> packages.Args: env = dict( super().sh_get_build_wheel_env( - build, site_packages_var=site_packages_var + build, site_packages=site_packages, wd=wd ) ) - bindir = build.get_install_path("bin").relative_to("/") + bindir = build.get_install_path(self, "bin").relative_to("/") if build.target.is_portable(): runstate = "" else: - runstate = str(build.get_install_path("runstate") / "edgedb") - shared_dir = (build.get_install_path("data") / "data").relative_to("/") + runstate = str(build.get_install_path(self, "runstate") / "edgedb") + shared_dir = ( + build.get_install_path(self, "data") / "data" + ).relative_to("/") temp_root = build.get_temp_root(relative_to="pkgsource") src_python = build.sh_get_command( "python", package=self, relative_to="pkgsource" @@ -260,7 +290,7 @@ def sh_get_build_wheel_env( ( "import os.path", "rp = os.path.relpath", - f"sp = rp('{site_packages_var}', start='{temp_root}')", + f"sp = rp('{site_packages}', start='{temp_root}')", f"print(rp('{bindir}', start=os.path.join(sp, 'edb')))", ) ) @@ -271,7 +301,7 @@ def sh_get_build_wheel_env( ( "import os.path", "rp = os.path.relpath", - f"sp = rp('{site_packages_var}', start='{temp_root}')", + f"sp = rp('{site_packages}', start='{temp_root}')", f"print(rp('{shared_dir}', start=os.path.join(sp, 'edb')))", ) ) @@ -288,20 +318,24 @@ def sh_get_build_wheel_env( openssl_pkg = build.get_package("openssl") if build.is_bundled(openssl_pkg): - try: - openssl_path = build.get_install_dir( - openssl_pkg, relative_to="buildroot" - ) - except ValueError: - # deb/build.py doesn't have buildroot - openssl_path = build.get_install_dir( - openssl_pkg, relative_to="pkgsource" - ) - openssl_path /= build.get_full_install_prefix().relative_to("/") - quoted = shlex.quote(str(openssl_path)) - pwd = "$(pwd -P)" - env["OPENSSL_LIB_DIR"] = f"!{pwd}/{quoted}/lib" - env["OPENSSL_INCLUDE_DIR"] = f"!{pwd}/{quoted}/include" + build.sh_replace_quoted_paths( + env, + "OPENSSL_LIB_DIR", + build.sh_must_get_bundled_pkg_lib_path( + openssl_pkg, + relative_to="pkgsource", + wd=wd, + ), + ) + build.sh_replace_quoted_paths( + env, + "OPENSSL_INCLUDE_DIR", + build.sh_must_get_bundled_pkg_include_path( + openssl_pkg, + relative_to="pkgsource", + wd=wd, + ), + ) return env @@ -317,9 +351,6 @@ def get_build_script(self, build: targets.Build) -> str: ) pg_pkg = build.get_package("postgresql-edgedb") - icu_pkg = build.get_package("icu") - openssl_pkg = build.get_package("openssl") - uuid_pkg = build.get_package("uuid") build_python = build.sh_get_command("python") temp_dir = build.get_temp_dir(self, relative_to="pkgbuild") @@ -327,29 +358,34 @@ def get_build_script(self, build: targets.Build) -> str: pg_temp_install_path = ( build.get_build_dir(pg_pkg, relative_to="pkgbuild") / "_install" ) - bindir = build.get_install_path("bin").relative_to("/") - libdir = build.get_install_path("lib").relative_to("/") + bindir = build.get_install_path(self, "bin").relative_to("/") + libdir = build.get_install_path(self, "lib").relative_to("/") pg_config = pg_temp_install_path / bindir / "pg_config" pg_libpath = pg_temp_install_path / libdir temp_install_dir = build.get_temp_root( relative_to="pkgbuild" - ) / build.get_full_install_prefix().relative_to("/") + ) / build.get_rel_install_prefix(self) sitescript = ( f"import site; " f'print(site.getsitepackages(["{temp_install_dir}"])[0])' ) - runstatescript = "import tempfile; " "print(tempfile.mkdtemp())" + runstatescript = "import tempfile; print(tempfile.mkdtemp())" abspath = ( "import pathlib, sys; print(pathlib.Path(sys.argv[1]).resolve())" ) - ld_env = " ".join( - build.get_ld_env( - deps=[icu_pkg, openssl_pkg, uuid_pkg], - wd="${_wd}", - extra=["${_ldlibpath}"], - ) + all_build_deps = build.get_build_reqs(self, recursive=True) + ld_env_args = build.get_ld_env( + deps=all_build_deps, + wd="${_wd}", + extra=["${_ldlibpath}"], + ) + + ld_env = build.sh_format_args( + ld_env_args, + force_args_eq=True, + linebreaks=False, ) if platform.system() == "Darwin": @@ -427,9 +463,9 @@ def get_extra_python_build_commands( def get_build_install_script(self, build: targets.Build) -> str: script = super().get_build_install_script(build) srcdir = build.get_source_dir(self, relative_to="pkgbuild") - dest = build.get_install_dir(self, relative_to="pkgbuild") + dest = build.get_build_install_dir(self, relative_to="pkgbuild") - datadir = build.get_install_path("data") + datadir = build.get_install_path(self, "data") script += textwrap.dedent( f"""\ mkdir -p "{dest}/{datadir}" @@ -440,7 +476,7 @@ def get_build_install_script(self, build: targets.Build) -> str: """ ) - bindir = build.get_install_path("bin").relative_to("/") + bindir = build.get_install_path(self, "bin").relative_to("/") ep_helper_pkg = build.get_package("pyentrypoint") ep_helper = ( @@ -481,7 +517,9 @@ def get_extra_system_requirements( return {"before-install": ["adduser"], "after-install": rc_deps} def get_before_install_script(self, build: targets.Build) -> str: - dataroot = build.get_install_path("localstate") / "lib" / "edgedb" + dataroot = ( + build.get_install_path(self, "localstate") / "lib" / "edgedb" + ) action = build.target.get_action("adduser", build) assert isinstance(action, targets.AddUserAction) @@ -497,7 +535,7 @@ def get_before_install_script(self, build: targets.Build) -> str: return user_script def get_exposed_commands(self, build: targets.Build) -> list[pathlib.Path]: - bindir = build.get_install_path("bin") + bindir = build.get_install_path(self, "bin") return [ bindir / "edgedb-server", @@ -551,25 +589,34 @@ def get_provided_packages( class Cryptography(packages.PythonPackage): def sh_get_build_wheel_env( - self, build: targets.Build, *, site_packages_var: str - ) -> dict[str, str]: - env = dict( - super().sh_get_build_wheel_env( - build, site_packages_var=site_packages_var - ) - ) - env["OPENSSL_STATIC"] = "0" + self, build: targets.Build, *, site_packages: str, wd: str + ) -> packages.Args: + env = super().sh_get_build_wheel_env( + build, site_packages=site_packages, wd=wd + ) | { + "OPENSSL_STATIC": "0", + } openssl_pkg = build.get_package("openssl") if build.is_bundled(openssl_pkg): - openssl_path = build.get_install_dir( - openssl_pkg, relative_to="pkgsource" + build.sh_replace_quoted_paths( + env, + "OPENSSL_LIB_DIR", + build.sh_must_get_bundled_pkg_lib_path( + openssl_pkg, + relative_to="pkgsource", + wd=wd, + ), + ) + build.sh_replace_quoted_paths( + env, + "OPENSSL_INCLUDE_DIR", + build.sh_must_get_bundled_pkg_include_path( + openssl_pkg, + relative_to="pkgsource", + wd=wd, + ), ) - openssl_path /= build.get_full_install_prefix().relative_to("/") - quoted = shlex.quote(str(openssl_path)) - pwd = "$(pwd -P)" - env["OPENSSL_LIB_DIR"] = f"!{pwd}/{quoted}/lib" - env["OPENSSL_INCLUDE_DIR"] = f"!{pwd}/{quoted}/include" return env @@ -599,8 +646,8 @@ def get_build_requirements(self) -> list[poetry_dep.Dependency]: class JWCrypto(packages.PythonPackage): def get_file_no_install_entries(self, build: targets.Build) -> list[str]: entries = super().get_file_no_install_entries(build) - entries.append("{prefix}/share/doc/jwcrypto") - entries.append("{prefix}/share/doc/jwcrypto/**") + entries.append("{docdir}/jwcrypto") + entries.append("{docdir}/jwcrypto/**") return entries @@ -612,14 +659,6 @@ def get_file_no_install_entries(self, build: targets.Build) -> list[str]: class Maturin(packages.PythonPackage): - executable = "maturin" - - def get_build_tools(self, build: targets.Build) -> dict[str, pathlib.Path]: - install_dir = build.get_install_dir(self, relative_to="sourceroot") - bin_dir = build.get_install_path("bin").relative_to("/") - return {self.executable: install_dir / bin_dir / "maturin"} - - -class PyPackageNeedingMaturin(packages.PythonPackage): - def get_dep_commands(self) -> list[str]: - return [Maturin.executable] + @property + def provides_build_tools(self) -> bool: + return True diff --git a/edgedbpkg/edgedb_ext/__init__.py b/edgedbpkg/edgedb_ext/__init__.py new file mode 100644 index 00000000..c027257f --- /dev/null +++ b/edgedbpkg/edgedb_ext/__init__.py @@ -0,0 +1,3 @@ +from .base import EdgeDBExtension + +__all__ = ("EdgeDBExtension",) diff --git a/edgedbpkg/edgedb_ext/base.py b/edgedbpkg/edgedb_ext/base.py new file mode 100644 index 00000000..d5ccddf1 --- /dev/null +++ b/edgedbpkg/edgedb_ext/base.py @@ -0,0 +1,177 @@ +from __future__ import annotations +from typing import ( + Any, + TYPE_CHECKING, +) + +import importlib +import pathlib +import shlex + +from poetry.core.packages import dependency as poetry_dep + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import edgedb +from edgedbpkg import pgext + +if TYPE_CHECKING: + from cleo.io import io as cleo_io + + +class EdgeDBExtension(packages.BuildSystemMakePackage): + # Populated in resolve() when this is built as top-level package. + bundle_deps: list[packages.BundledPackage] = [] + _edb: edgedb.EdgeDB + _pgext: poetry_dep.Dependency + + @classmethod + def resolve( + cls, + io: cleo_io.IO, + *, + version: str | None = None, + revision: str | None = None, + is_release: bool = False, + target: targets.Target, + requires: list[poetry_dep.Dependency] | None = None, + ) -> EdgeDBExtension: + slot = "" + if version is not None: + slot, _, version = version.rpartition("!") + + if not slot: + raise RuntimeError( + "must specify EdgeDB version as epoch, eg 5!1.0" + ) + + edb_ver = slot + if "." not in edb_ver: + edb_ver = f"{edb_ver}.0" + + edb = edgedb.EdgeDB(version=edb_ver) + + if requires is None: + requires = [] + else: + requires = list(requires) + + pgext_ver = cls.get_pgext_ver() + + pg_ext: pgext.PostgresCExtension | None + if pgext_ver: + # Find the postgres version + for dep in edb.get_requirements(): + if dep.name == "postgresql-edgedb": + pg = packages.get_bundled_pkg(dep) + break + else: + raise RuntimeError( + "could not determine version of PostgreSQL used " + "by the specified EdgeDB version" + ) + + pgextname = cls.name.replace("edbext-", "pgext-") + requires.append( + poetry_dep.Dependency.create_from_pep_508( + f"{pgextname} (== {pgext_ver})", + ), + ) + _, _, mod = cls.__module__.rpartition(".") + pg_ext = getattr( + importlib.import_module(f"edgedbpkg.pgext.{mod}"), + cls.__name__, + )(pgext_ver) + assert pg_ext is not None + pg_ext.build_requires.append(pg.to_dependency()) + + else: + pg_ext = None + + ext = super().resolve( + io, + version=version, + revision=revision, + is_release=is_release, + target=target, + requires=requires, + ) + ext._edb = edb + + if pg_ext is not None: + ext.bundle_deps.append(pg_ext) + + if slot: + ext.set_slot(slot) + + return ext + + @classmethod + def get_pgext_ver(cls) -> str | None: + return None + + @property + def supports_out_of_tree_builds(self) -> bool: + return False + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self._slot = "" + + def set_slot(self, slot: str) -> None: + self._slot = slot + + @property + def slot(self) -> str: + return self._slot + + def version_includes_slot(self) -> bool: + return False + + def get_build_script(self, build: targets.Build) -> str: + return "" + + def get_dep_install_subdir( + self, + build: targets.Build, + pkg: packages.BasePackage, + ) -> pathlib.Path: + prefix = build.get_install_prefix(self) + lib_dir = build.get_install_path(self, "lib").relative_to(prefix) + if pkg.name not in {"postgresql-edgedb", "edgedb-server"}: + return lib_dir / "postgresql" / self.unique_name + else: + return pathlib.Path("") + + def get_make_args(self, build: targets.Build) -> packages.Args: + return super().get_make_args(build) | { + "WITH_SQL": "no", + "WITH_EDGEQL": "yes", + } + + def get_make_install_args(self, build: targets.Build) -> packages.Args: + return super().get_make_args(build) | { + "WITH_SQL": "no", + "WITH_EDGEQL": "yes", + } + + def get_root_install_subdir(self, build: targets.Build) -> pathlib.Path: + if build.target.is_portable(): + return pathlib.Path(self.name_slot) + else: + return pathlib.Path(self._edb.name_slot) + + def get_make_install_destdir_subdir( + self, + build: targets.Build, + ) -> pathlib.Path: + if build.target.is_portable(): + return pathlib.Path("") + else: + return ( + build.get_install_path(self._edb, "data").relative_to("/") + / "data" + / "extensions" + / f"{self.pretty_name}-{self.version}" + ) diff --git a/edgedbpkg/edgedb_ext/postgis/__init__.py b/edgedbpkg/edgedb_ext/postgis/__init__.py new file mode 100644 index 00000000..9c4239d2 --- /dev/null +++ b/edgedbpkg/edgedb_ext/postgis/__init__.py @@ -0,0 +1,38 @@ +from __future__ import annotations + +import pathlib + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import edgedb_ext + + +class PostGIS(edgedb_ext.EdgeDBExtension): + title = "edgedb postgis extension" + name = packages.canonicalize_name("edbext-postgis") + description = "Geographic Objects for EdgeDB" + license_id = "GPL-3" + group = "Applications/Databases" + + sources = [ + { + "url": "git+https://github.com/edgedb/edgedb-postgis.git", + "extras": { + "exclude_submodules": ["postgis"], + }, + }, + ] + + @classmethod + def get_pgext_ver(cls) -> str | None: + return "3.4.3" + + def get_make_install_destdir_subdir( + self, + build: targets.Build, + ) -> pathlib.Path: + if build.target.is_portable(): + return build.get_rel_install_prefix(self) + else: + return super().get_make_install_destdir_subdir(build) diff --git a/edgedbpkg/edgedb_ext/postgis/install.list b/edgedbpkg/edgedb_ext/postgis/install.list new file mode 100644 index 00000000..fa6f3945 --- /dev/null +++ b/edgedbpkg/edgedb_ext/postgis/install.list @@ -0,0 +1,4 @@ +{prefix}/*.toml +{prefix}/*.edgeql +{datadir}/data/extensions/{name}-{version}/*.toml +{datadir}/data/extensions/{name}-{version}/*.edgeql diff --git a/edgedbpkg/edgedb_ext/postgis/no_install.list b/edgedbpkg/edgedb_ext/postgis/no_install.list new file mode 100644 index 00000000..8bfdc159 --- /dev/null +++ b/edgedbpkg/edgedb_ext/postgis/no_install.list @@ -0,0 +1,4 @@ +{prefix}/LICENSE* +{prefix}/NOTICE* +{datadir}/data/extensions/{name}-{version}/LICENSE* +{datadir}/data/extensions/{name}-{version}/NOTICE* diff --git a/edgedbpkg/edgedb_grafana_backend/__init__.py b/edgedbpkg/edgedb_grafana_backend/__init__.py index 84ca4d92..3ecb16c3 100644 --- a/edgedbpkg/edgedb_grafana_backend/__init__.py +++ b/edgedbpkg/edgedb_grafana_backend/__init__.py @@ -1,7 +1,6 @@ from __future__ import annotations from typing import TYPE_CHECKING -import shlex import textwrap from metapkg import packages @@ -30,12 +29,9 @@ class EdgeDBGrafanaBackend(packages.BundledPackage): mage.Mage("v1.15.0"), ] - def get_configure_script(self, build: targets.Build) -> str: - sdir = shlex.quote( - str(build.get_source_dir(self, relative_to="pkgbuild")) - ) - copy_sources = f"test ./ -ef {sdir} || cp -a {sdir}/* ./" - return copy_sources + @property + def supports_out_of_tree_builds(self) -> bool: + return False def get_build_script(self, build: targets.Build) -> str: gopath = build.get_temp_dir(self, relative_to="pkgbuild") @@ -49,9 +45,9 @@ def get_build_script(self, build: targets.Build) -> str: def get_build_install_script(self, build: targets.Build) -> str: script = super().get_build_install_script(build) - installdest = build.get_install_dir( + installdest = build.get_build_install_dir( self, relative_to="pkgbuild" - ) / build.get_full_install_prefix().relative_to("/") + ) / build.get_rel_install_prefix(self) return textwrap.dedent( f"""\ {script} diff --git a/edgedbpkg/edgedb_ls/__init__.py b/edgedbpkg/edgedb_ls/__init__.py index 97ea7bb0..0f752778 100644 --- a/edgedbpkg/edgedb_ls/__init__.py +++ b/edgedbpkg/edgedb_ls/__init__.py @@ -4,7 +4,6 @@ import base64 import os import pathlib -import shlex import textwrap from poetry.core.packages import dependency as poetry_dep @@ -84,6 +83,7 @@ def resolve( revision: str | None = None, is_release: bool = False, target: targets.Target, + requires: list[poetry_dep.Dependency] | None = None, ) -> EdgeDBLanguageServer: os.environ["EDGEDB_BUILD_OFFICIAL"] = "yes" os.environ["EDGEDB_BUILD_TARGET"] = ( @@ -114,6 +114,7 @@ def resolve( revision=revision, is_release=is_release, target=target, + requires=requires, ) .with_features(["language-server"]) ) @@ -169,12 +170,7 @@ def canonicalize_version( def get_package_repository( cls, target: targets.Target, io: cleo_io.IO ) -> python.PyPiRepository: - repo = super().get_package_repository(target, io) - repo.register_package_impl("cryptography", edgedb_server.Cryptography) - repo.register_package_impl("cffi", edgedb_server.Cffi) - repo.register_package_impl("jwcrypto", edgedb_server.JWCrypto) - repo.register_package_impl("edgedb", edgedb_server.EdgeDBPython) - return repo + return edgedb_server.EdgeDB.get_package_repository(target, io) @property def base_slot(self) -> str: @@ -211,14 +207,20 @@ def version_includes_revision(self) -> bool: return True def sh_get_build_wheel_env( - self, build: targets.Build, *, site_packages_var: str - ) -> dict[str, str]: + self, + build: targets.Build, + *, + site_packages: str, + wd: str, + ) -> packages.Args: env = dict( super().sh_get_build_wheel_env( - build, site_packages_var=site_packages_var + build, site_packages=site_packages, wd=wd ) ) - shared_dir = (build.get_install_path("data") / "data").relative_to("/") + shared_dir = ( + build.get_install_path(self, "data") / "data" + ).relative_to("/") temp_root = build.get_temp_root(relative_to="pkgsource") src_python = build.sh_get_command( "python", package=self, relative_to="pkgsource" @@ -228,7 +230,7 @@ def sh_get_build_wheel_env( ( "import os.path", "rp = os.path.relpath", - f"sp = rp('{site_packages_var}', start='{temp_root}')", + f"sp = rp('{site_packages}', start='{temp_root}')", f"print(rp('{shared_dir}', start=os.path.join(sp, 'edb')))", ) ) @@ -243,6 +245,27 @@ def sh_get_build_wheel_env( build.get_build_dir(self, relative_to="pkgsource") / "share" ) + openssl_pkg = build.get_package("openssl") + if build.is_bundled(openssl_pkg): + build.sh_replace_quoted_paths( + env, + "OPENSSL_LIB_DIR", + build.sh_must_get_bundled_pkg_lib_path( + openssl_pkg, + relative_to="pkgsource", + wd=wd, + ), + ) + build.sh_replace_quoted_paths( + env, + "OPENSSL_INCLUDE_DIR", + build.sh_must_get_bundled_pkg_include_path( + openssl_pkg, + relative_to="pkgsource", + wd=wd, + ), + ) + return env def get_build_script(self, build: targets.Build) -> str: @@ -258,9 +281,9 @@ def get_build_script(self, build: targets.Build) -> str: def get_build_install_script(self, build: targets.Build) -> str: script = super().get_build_install_script(build) - dest = build.get_install_dir(self, relative_to="pkgbuild") + dest = build.get_build_install_dir(self, relative_to="pkgbuild") - datadir = build.get_install_path("data") + datadir = build.get_install_path(self, "data") script += textwrap.dedent( f"""\ mkdir -p "{dest}/{datadir}" @@ -268,7 +291,7 @@ def get_build_install_script(self, build: targets.Build) -> str: """ ) - bindir = build.get_install_path("bin").relative_to("/") + bindir = build.get_install_path(self, "bin").relative_to("/") ep_helper_pkg = build.get_package("pyentrypoint") ep_helper = ( @@ -296,7 +319,7 @@ def get_private_libraries(self, build: targets.Build) -> list[str]: return ["libcrypto.*", "libssl.*"] def get_exposed_commands(self, build: targets.Build) -> list[pathlib.Path]: - bindir = build.get_install_path("bin") + bindir = build.get_install_path(self, "bin") return [ bindir / "edgedb-ls", diff --git a/edgedbpkg/icu/__init__.py b/edgedbpkg/icu/__init__.py index a7e83fa9..59fd774e 100644 --- a/edgedbpkg/icu/__init__.py +++ b/edgedbpkg/icu/__init__.py @@ -1,10 +1,12 @@ from __future__ import annotations +import shlex + from metapkg import packages from metapkg import targets -class ICU(packages.BundledCPackage): +class ICU(packages.BundledCAutoconfPackage): title = "ICU" name = packages.canonicalize_name("icu") aliases = ["icu-dev"] @@ -21,15 +23,20 @@ class ICU(packages.BundledCPackage): } ] - def get_configure_script(self, build: targets.Build) -> str: + def sh_get_configure_command(self, build: targets.Build) -> str: sdir = build.get_source_dir(self, relative_to="pkgbuild") - configure = sdir / "source" / "configure" - configure_flags = { + return shlex.quote(str(sdir / "source" / "configure")) + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd) | { "--disable-samples": None, "--disable-tests": None, "--enable-rpath": None, } - return self.sh_configure(build, configure, configure_flags) def get_shlibs(self, build: targets.Build) -> list[str]: return ["icui18n", "icuuc", "icudata"] diff --git a/edgedbpkg/libabseil/__init__.py b/edgedbpkg/libabseil/__init__.py new file mode 100644 index 00000000..100c1766 --- /dev/null +++ b/edgedbpkg/libabseil/__init__.py @@ -0,0 +1,149 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibAbseil(packages.BundledCMakePackage): + title = "libabsl" + name = packages.canonicalize_name("libabsl") + aliases = ["libabsl-dev"] + + _server = "https://github.com/abseil/abseil-cpp/archive/" + + sources = [ + { + "url": _server + "{version}.tar.gz", + }, + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "ABSL" + + def get_configure_script(self, build: targets.Build) -> str: + sdir = build.get_source_dir(self, relative_to="pkgbuild") + sed = build.sh_get_command("sed") + copts = sdir / "absl/copts/copts.py" + + script = f"""\ + {sed} -i \ + -e '/"-maes",/d' \ + -e '/"-msse4.1",/d' \ + -e '/"-mfpu=neon"/d' \ + -e '/"-march=armv8-a+crypto"/d' \ + "{copts}" + python3 "{copts}" + """ + + return script + super().get_configure_script(build) + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "-DABSL_ENABLE_INSTALL": "TRUE", + "-DABSL_USE_EXTERNAL_GOOGLETEST": "ON", + "-DABSL_PROPAGATE_CXX_STD": "TRUE", + "-DABSL_BUILD_TEST_HELPERS": "OFF", + "-DABSL_BUILD_TESTING": "OFF", + } + + # abseil has ninja-specific hardcode in its CMakeFiles + def get_target_build_system( + self, + build: targets.Build, + ) -> packages.CMakeTargetBuildSystem: + return "ninja" + + def get_shlibs(self, build: targets.Build) -> list[str]: + return [ + "absl_bad_any_cast_impl", + "absl_bad_optional_access", + "absl_bad_variant_access", + "absl_base", + "absl_city", + "absl_civil_time", + "absl_cord", + "absl_cord_internal", + "absl_cordz_functions", + "absl_cordz_handle", + "absl_cordz_info", + "absl_cordz_sample_token", + "absl_crc32c", + "absl_crc_cord_state", + "absl_crc_cpu_detect", + "absl_crc_internal", + "absl_debugging_internal", + "absl_demangle_internal", + "absl_die_if_null", + "absl_examine_stack", + "absl_exponential_biased", + "absl_failure_signal_handler", + "absl_flags_commandlineflag", + "absl_flags_commandlineflag_internal", + "absl_flags_config", + "absl_flags_internal", + "absl_flags_marshalling", + "absl_flags_parse", + "absl_flags_private_handle_accessor", + "absl_flags_program_name", + "absl_flags_reflection", + "absl_flags_usage", + "absl_flags_usage_internal", + "absl_graphcycles_internal", + "absl_hash", + "absl_hashtablez_sampler", + "absl_int128", + "absl_kernel_timeout_internal", + "absl_leak_check", + "absl_log_entry", + "absl_log_flags", + "absl_log_globals", + "absl_log_initialize", + "absl_log_internal_check_op", + "absl_log_internal_conditions", + "absl_log_internal_fnmatch", + "absl_log_internal_format", + "absl_log_internal_globals", + "absl_log_internal_log_sink_set", + "absl_log_internal_message", + "absl_log_internal_nullguard", + "absl_log_internal_proto", + "absl_log_severity", + "absl_log_sink", + "absl_low_level_hash", + "absl_malloc_internal", + "absl_periodic_sampler", + "absl_random_distributions", + "absl_random_internal_distribution_test_util", + "absl_random_internal_platform", + "absl_random_internal_pool_urbg", + "absl_random_internal_randen", + "absl_random_internal_randen_hwaes", + "absl_random_internal_randen_hwaes_impl", + "absl_random_internal_randen_slow", + "absl_random_internal_seed_material", + "absl_random_seed_gen_exception", + "absl_random_seed_sequences", + "absl_raw_hash_set", + "absl_raw_logging_internal", + "absl_spinlock_wait", + "absl_stacktrace", + "absl_status", + "absl_statusor", + "absl_str_format_internal", + "absl_strerror", + "absl_string_view", + "absl_strings", + "absl_strings_internal", + "absl_symbolize", + "absl_synchronization", + "absl_throw_delegate", + "absl_time", + "absl_time_zone", + "absl_vlog_config_internal", + ] diff --git a/edgedbpkg/libabseil/install.list b/edgedbpkg/libabseil/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libabseil/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libabseil/no_install.list b/edgedbpkg/libabseil/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libabseil/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libabseil/patches/libabsl__cmake_xarch_flags_fix.patch b/edgedbpkg/libabseil/patches/libabsl__cmake_xarch_flags_fix.patch new file mode 100644 index 00000000..6d054545 --- /dev/null +++ b/edgedbpkg/libabseil/patches/libabsl__cmake_xarch_flags_fix.patch @@ -0,0 +1,49 @@ +From bd0c9c58cac4463d96b574de3097422bb78215a8 Mon Sep 17 00:00:00 2001 +From: Ruoyu Zhong +Date: Tue, 6 Aug 2024 12:26:15 -0700 +Subject: [PATCH] PR #1738: Fix shell option group handling in pkgconfig files + +Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1738 + +Since #1707 and #1710, `-Xarch_` option groups are present as single elements in the libraries' COPTS, and a `SHELL:` prefix is added to each of them. While these addressed certain build issues, they broke the handling of `-Xarch_` option groups in pkgconfig files. + +Fix that by taking care of the `SHELL:` prefix in COPTS when generating pkgconfig files. The skip-next-flag mechanism is also removed as the option groups are now present as single elements. + +Merge fd1246acbf4052d66fef66ee195cf254bca35b6c into 08850701d27544b4af6501154791d3d45e28b0f8 + +Merging this change closes #1738 + +COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1738 from ZhongRuoyu:pkgconfig-xarch-handling fd1246acbf4052d66fef66ee195cf254bca35b6c +PiperOrigin-RevId: 660055129 +Change-Id: I57a1a51b2eb8983d076a3d5336acef12acae4560 +--- + CMake/AbseilHelpers.cmake | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake +index 3c4c92fec4c..d8fb9fe5de3 100644 +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -186,15 +186,15 @@ function(absl_cc_library) + endif() + endif() + endforeach() +- set(skip_next_cflag OFF) + foreach(cflag ${ABSL_CC_LIB_COPTS}) +- if(skip_next_cflag) +- set(skip_next_cflag OFF) +- elseif(${cflag} MATCHES "^-Xarch_") ++ # Strip out the CMake-specific `SHELL:` prefix, which is used to construct ++ # a group of space-separated options. ++ # https://cmake.org/cmake/help/v3.30/command/target_compile_options.html#option-de-duplication ++ string(REGEX REPLACE "^SHELL:" "" cflag "${cflag}") ++ if(${cflag} MATCHES "^-Xarch_") + # An -Xarch_ flag implies that its successor only applies to the +- # specified platform. Filter both of them out before the successor +- # reaches the "^-m" filter. +- set(skip_next_cflag ON) ++ # specified platform. Such option groups are each specified in a single ++ # `SHELL:`-prefixed string in the COPTS list, which we simply ignore. + elseif(${cflag} MATCHES "^(-Wno|/wd)") + # These flags are needed to suppress warnings that might fire in our headers. + set(PC_CFLAGS "${PC_CFLAGS} ${cflag}") diff --git a/edgedbpkg/libb2/__init__.py b/edgedbpkg/libb2/__init__.py index 9cd931c0..c6a8b9e0 100644 --- a/edgedbpkg/libb2/__init__.py +++ b/edgedbpkg/libb2/__init__.py @@ -6,7 +6,7 @@ from metapkg import targets -class LibB2(packages.BundledCPackage): +class LibB2(packages.BundledCAutoconfPackage): title = "libb2" name = packages.canonicalize_name("libb2") aliases = ["libb2-dev"] @@ -19,31 +19,35 @@ class LibB2(packages.BundledCPackage): } ] - def get_configure_script(self, build: targets.Build) -> str: - sdir = build.get_source_dir(self, relative_to="pkgbuild") - # Restore modification times to avoid invoking the autotools. - script = ( - f'touch -r "{sdir}/aclocal.m4" "{sdir}/configure.ac"' - f' "{sdir}/configure"\n' - ) - configure = sdir / "configure" - configure_flags: dict[str, str | pathlib.Path | None] = { + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + args = dict(super().get_configure_args(build, wd=wd)) | { "--disable-openmp": None, "--disable-native": None, } + if build.target.machine_architecture == "x86_64": - configure_flags["--enable-fat"] = None + args["--enable-fat"] = None else: - configure_flags["--disable-fat"] = None + args["--disable-fat"] = None # Upstream defaults to -O3, so likely should we. build.sh_append_flags( - configure_flags, + args, "CFLAGS", ("-O3",), ) - return script + self.sh_configure(build, configure, configure_flags) + return args + + def get_configure_script(self, build: targets.Build) -> str: + # Restore modification times to avoid invoking the autotools. + sdir = build.get_source_dir(self, relative_to="pkgbuild") + touch = f'touch -r "{sdir}/aclocal.m4" "{sdir}/configure.ac"\n' + return touch + super().get_configure_script(build) def get_shlibs(self, build: targets.Build) -> list[str]: return ["b2"] diff --git a/edgedbpkg/libb2/ignore.list b/edgedbpkg/libb2/ignore.list index 527168a9..fb1ed1ce 100644 --- a/edgedbpkg/libb2/ignore.list +++ b/edgedbpkg/libb2/ignore.list @@ -1,2 +1,4 @@ -{prefix}/share/** -{prefix}/include/** +{datadir} +{datadir}/** +{includedir} +{includedir}/** diff --git a/edgedbpkg/libexpat/__init__.py b/edgedbpkg/libexpat/__init__.py new file mode 100644 index 00000000..82d0ec65 --- /dev/null +++ b/edgedbpkg/libexpat/__init__.py @@ -0,0 +1,26 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibExpat(packages.BundledCAutoconfPackage): + title = "libexpat" + name = packages.canonicalize_name("libexpat") + aliases = ["libexpat-dev"] + + _server = "https://github.com/libexpat/libexpat/releases/download/" + + sources = [ + { + "url": _server + "R_{underscore_version}/expat-{version}.tar.xz", + } + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "EXPAT" + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["expat"] diff --git a/edgedbpkg/libexpat/install.list b/edgedbpkg/libexpat/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libexpat/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libexpat/no_install.list b/edgedbpkg/libexpat/no_install.list new file mode 100644 index 00000000..45e63944 --- /dev/null +++ b/edgedbpkg/libexpat/no_install.list @@ -0,0 +1,15 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{prefix}/share +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libffi/__init__.py b/edgedbpkg/libffi/__init__.py index 22d54e81..1819c41f 100644 --- a/edgedbpkg/libffi/__init__.py +++ b/edgedbpkg/libffi/__init__.py @@ -4,7 +4,7 @@ from metapkg import targets -class LibFFI(packages.BundledCPackage): +class LibFFI(packages.BundledCAutoconfPackage): title = "libffi" name = packages.canonicalize_name("libffi") aliases = ["libffi-dev"] @@ -17,14 +17,14 @@ class LibFFI(packages.BundledCPackage): } ] - def get_configure_script(self, build: targets.Build) -> str: - sdir = build.get_source_dir(self, relative_to="pkgbuild") - configure = sdir / "configure" - configure_flags = { + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { "--disable-multi-os-directory": None, } - return self.sh_configure(build, configure, configure_flags) - def get_shlibs(self, build: targets.Build) -> list[str]: return ["ffi"] diff --git a/edgedbpkg/libgdal/__init__.py b/edgedbpkg/libgdal/__init__.py new file mode 100644 index 00000000..358d5894 --- /dev/null +++ b/edgedbpkg/libgdal/__init__.py @@ -0,0 +1,171 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import ( + libexpat, + libgeos, + libjson_c, + libpcre2, + libxml2, + libtiff, + libgeotiff, + libproj, + libsqlite3, + openssl, + zlib, +) + + +class LibGDAL(packages.BundledCMakePackage): + title = "libgdal" + name = packages.canonicalize_name("libgdal") + aliases = ["libgdal-dev"] + + _server = "https://download.osgeo.org/gdal/" + + sources = [ + { + "url": _server + "{version}/gdal-{version}.tar.gz", + }, + ] + + artifact_requirements = [ + "libexpat", + "libgeos (>=3.8.0)", + "libjson-c (>=0.13)", + "libpcre2", + "libxml2", + "libgeotiff (>=1.5.1)", + "libproj (>=6.3.1)", + "libsqlite3", + "libtiff (>=4.1.0)", + "openssl", + "zlib", + ] + + artifact_build_requirements = [ + "libexpat-dev", + "libgeos-dev (>=3.8.0)", + "libjson-c-dev (>=0.13)", + "libpcre2-dev", + "libxml2-dev", + "libtiff-dev (>=4.1.0)", + "libgeotiff-dev (>=1.5.1)", + "libproj-dev (>=6.3.1)", + "libsqlite3-dev", + "openssl-dev", + "zlib-dev", + ] + + bundle_deps = [ + libexpat.LibExpat("2.6.3"), + libgeos.LibGEOS("3.13.0"), + libjson_c.LibJsonC("0.17"), + libpcre2.LibPCRE2("10.44"), + libxml2.LibXML2("2.13.4"), + libgeotiff.LibGeoTIFF("1.7.3"), + libproj.LibProj("9.5.0"), + libsqlite3.LibSQLite3("3.46.1"), + libtiff.LibTIFF("4.7.0"), + openssl.OpenSSL("3.3.1"), + zlib.Zlib("1.3.1"), + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "GDAL" + + def get_dep_pkg_config_script(self) -> str | None: + return "gdal-config" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "-DENABLE_IPO": "OFF", + "-DGDAL_USE_EXTERNAL_LIBS": "ON", + "-DGDAL_USE_INTERNAL_LIBS": "OFF", + "-DBUILD_TESTING": "OFF", + "-DGDAL_USE_ARMADILLO": "OFF", + "-DGDAL_USE_ARROW": "OFF", + "-DGDAL_USE_BLOSC": "OFF", + "-DGDAL_USE_BRUNSLI": "OFF", + "-DGDAL_USE_CRNLIB": "OFF", + "-DGDAL_USE_CFITSIO": "OFF", + "-DGDAL_USE_CURL": "OFF", + "-DGDAL_USE_CRYPTOPP": "OFF", + "-DGDAL_USE_DEFLATE": "OFF", + "-DGDAL_USE_ECW": "OFF", + "-DGDAL_USE_EXPAT": "ON", + "-DGDAL_USE_FILEGDB": "OFF", + "-DGDAL_USE_FREEXL": "OFF", + "-DGDAL_USE_FYBA": "OFF", + "-DGDAL_USE_GEOTIFF": "ON", + "-DGDAL_USE_GEOS": "ON", + "-DGDAL_USE_GIF": "OFF", + "-DGDAL_USE_GTA": "OFF", + "-DGDAL_USE_HEIF": "OFF", + "-DGDAL_USE_HDF4": "OFF", + "-DGDAL_USE_HDF5": "OFF", + "-DGDAL_USE_HDFS": "OFF", + "-DGDAL_USE_ICONV": "ON", + "-DGDAL_USE_IDB": "OFF", + "-DGDAL_USE_JPEG": "OFF", + "-DGDAL_USE_JPEG12_INTERNAL": "ON", + "-DGDAL_USE_JSONC": "ON", + "-DGDAL_USE_JXL": "OFF", + "-DGDAL_USE_KDU": "OFF", + "-DGDAL_USE_KEA": "OFF", + "-DGDAL_USE_LERC": "OFF", + "-DGDAL_USE_LIBKML": "OFF", + "-DGDAL_USE_LIBLZMA": "OFF", + "-DGDAL_USE_LIBXML2": "ON", + "-DGDAL_USE_LURATECH": "OFF", + "-DGDAL_USE_LZ4": "OFF", + "-DGDAL_USE_MONGOCXX": "OFF", + "-DGDAL_USE_MRSID": "OFF", + "-DGDAL_USE_MSSQL_NCLI": "OFF", + "-DGDAL_USE_MSSQL_ODBC": "OFF", + "-DGDAL_USE_MYSQL": "OFF", + "-DGDAL_USE_NETCDF": "OFF", + "-DGDAL_USE_ODBC": "OFF", + "-DGDAL_USE_ODBCCPP": "OFF", + "-DGDAL_USE_OGDI": "OFF", + "-DGDAL_USE_OPENCAD": "OFF", + "-DGDAL_USE_OPENCL": "OFF", + "-DGDAL_USE_OPENEXR": "OFF", + "-DGDAL_USE_OPENJPEG": "OFF", + "-DGDAL_USE_OPENSSL": "ON", + "-DGDAL_USE_ORACLE": "OFF", + "-DGDAL_USE_PARQUET": "OFF", + "-DGDAL_USE_PCRE2": "ON", + "-DGDAL_USE_PDFIUM": "OFF", + "-DGDAL_USE_PNG": "OFF", + "-DGDAL_USE_PODOFO": "OFF", + "-DGDAL_USE_POPPLER": "OFF", + "-DGDAL_USE_POSTGRESQL": "OFF", + "-DGDAL_USE_QHULL": "OFF", + "-DGDAL_USE_RASTERLITE2": "OFF", + "-DGDAL_USE_RDB": "OFF", + "-DGDAL_USE_SPATIALITE": "OFF", + "-DGDAL_USE_SQLITE3": "ON", + "-DGDAL_USE_SFCGAL": "OFF", + "-DGDAL_USE_TEIGHA": "OFF", + "-DGDAL_USE_TIFF": "ON", + "-DGDAL_USE_TILEDB": "OFF", + "-DGDAL_USE_WEBP": "OFF", + "-DGDAL_USE_XERCESC": "OFF", + "-DGDAL_USE_ZLIB": "ON", + "-DGDAL_USE_ZSTD": "OFF", + "-DBUILD_PYTHON_BINDINGS": "OFF", + "-DBUILD_JAVA_BINDINGS": "OFF", + "-DBUILD_CSHARP_BINDINGS": "OFF", + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["gdal"] diff --git a/edgedbpkg/libgdal/ignore.list b/edgedbpkg/libgdal/ignore.list new file mode 100644 index 00000000..f72d4be9 --- /dev/null +++ b/edgedbpkg/libgdal/ignore.list @@ -0,0 +1 @@ +{prefix}/share/** diff --git a/edgedbpkg/libgdal/install.list b/edgedbpkg/libgdal/install.list new file mode 100644 index 00000000..e81d8460 --- /dev/null +++ b/edgedbpkg/libgdal/install.list @@ -0,0 +1,4 @@ +{libdir}/** +{prefix}/share +{prefix}/share/gdal +{prefix}/share/gdal/** diff --git a/edgedbpkg/libgdal/no_install.list b/edgedbpkg/libgdal/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libgdal/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libgdal/patches/libgdal__relative-data-load.patch b/edgedbpkg/libgdal/patches/libgdal__relative-data-load.patch new file mode 100644 index 00000000..0bc99c94 --- /dev/null +++ b/edgedbpkg/libgdal/patches/libgdal__relative-data-load.patch @@ -0,0 +1,145 @@ +From c2f24f8c36a108c6fd8eb7dc9c0c3eb512c88ce4 Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Thu, 26 Sep 2024 17:54:47 -0700 +Subject: [PATCH] Attempt to load data from a location relative to gdal.so + +--- + port/CMakeLists.txt | 1 + + port/cpl_conv.h | 5 ++++ + port/cpl_findfile.cpp | 13 +++++++++ + port/cpl_getdsopath.cpp | 64 +++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 83 insertions(+) + create mode 100644 port/cpl_getdsopath.cpp + +diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt +index 26469f1b47..1154d5597a 100644 +--- a/port/CMakeLists.txt ++++ b/port/CMakeLists.txt +@@ -48,6 +48,7 @@ set(CPL_SOURCES + cpl_minixml.cpp + cpl_multiproc.cpp + cpl_list.cpp ++ cpl_getdsopath.cpp + cpl_getexecpath.cpp + cplstring.cpp + cpl_vsisimple.cpp +diff --git a/port/cpl_conv.h b/port/cpl_conv.h +index 2169d9da57..38384c73df 100644 +--- a/port/cpl_conv.h ++++ b/port/cpl_conv.h +@@ -160,6 +160,11 @@ void CPL_DLL *CPLGetSymbol(const char *, const char *); + /* -------------------------------------------------------------------- */ + int CPL_DLL CPLGetExecPath(char *pszPathBuf, int nMaxLength); + ++/* -------------------------------------------------------------------- */ ++/* Fetch dynamic library path. */ ++/* -------------------------------------------------------------------- */ ++int CPL_DLL CPLGetDSOPath(char *pszPathBuf, int nMaxLength); ++ + /* -------------------------------------------------------------------- */ + /* Filename handling functions. */ + /* -------------------------------------------------------------------- */ +diff --git a/port/cpl_findfile.cpp b/port/cpl_findfile.cpp +index add825780b..2f955dc863 100644 +--- a/port/cpl_findfile.cpp ++++ b/port/cpl_findfile.cpp +@@ -30,6 +30,7 @@ + #include "cpl_port.h" + #include "cpl_conv.h" + ++#include + #include + + #include "cpl_multiproc.h" +@@ -110,6 +111,18 @@ static FindFileTLS *CPLFinderInit() + } + else + { ++ char *pszPathBuf = static_cast( ++ CPLCalloc(PATH_MAX, sizeof(char))); ++ ++ if (CPLGetDSOPath(pszPathBuf, PATH_MAX)) ++ { ++ const char *pszResult = CPLFormFilename( ++ CPLGetDirname(pszPathBuf), "../share/gdal", nullptr); ++ CPLPushFinderLocation(pszResult); ++ } ++ ++ CPLFree(pszPathBuf); ++ + #ifdef INST_DATA + CPLPushFinderLocation(INST_DATA); + #endif +diff --git a/port/cpl_getdsopath.cpp b/port/cpl_getdsopath.cpp +new file mode 100644 +index 0000000000..43b506f800 +--- /dev/null ++++ b/port/cpl_getdsopath.cpp +@@ -0,0 +1,64 @@ ++/********************************************************************** ++ * ++ * Project: CPL - Common Portability Library ++ * Purpose: Implement CPLGetDSOPath(). ++ * Author: Elvis Pranskevichus, el@prans.net ++ * ++ ********************************************************************** ++ * Copyright (c) 2005, Frank Warmerdam ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ ****************************************************************************/ ++ ++#include "cpl_port.h" ++#include "cpl_conv.h" ++ ++#if defined(HAVE_DLFCN_H) ++#include ++#endif ++ ++/************************************************************************/ ++/* CPLGetDSOPath() */ ++/************************************************************************/ ++ ++/** ++ * Fetch path of a dynamic shared object given a symbol exported from it. ++ * ++ * @param pszPathBuf the buffer into which the path is placed. ++ * @param nMaxLength the buffer size (including the nul-terminating character). ++ * MAX_PATH+1 is suggested. ++ * ++ * @return FALSE on failure or TRUE on success. ++ */ ++ ++int CPLGetDSOPath(char *pszPathBuf, int nMaxLength) ++{ ++#if !defined(HAVE_DLFCN_H) ++ return FALSE; ++#else ++ Dl_info info; ++ ++ if (dladdr(reinterpret_cast(CPLGetDSOPath), &info) != 0 && info.dli_fname) { ++ strncpy(pszPathBuf, info.dli_fname, nMaxLength); ++ return TRUE; ++ } else { ++ return FALSE; // Failed to retrieve the shared object location ++ } ++#endif ++} +-- +2.45.2 + diff --git a/edgedbpkg/libgeos/__init__.py b/edgedbpkg/libgeos/__init__.py new file mode 100644 index 00000000..54d5a90a --- /dev/null +++ b/edgedbpkg/libgeos/__init__.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibGEOS(packages.BundledCMakePackage): + title = "libgeos" + name = packages.canonicalize_name("libgeos") + aliases = ["libgeos-dev"] + + _server = "https://github.com/libgeos/geos/releases/download/" + + sources = [ + { + "url": _server + "{version}/geos-{version}.tar.bz2", + }, + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "GEOS" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_args = super().get_configure_args(build, wd=wd) | { + "-DBUILD_TESTING": "OFF", + "-DBUILD_DOCUMENTATION": "OFF", + } + + arch = build.target.machine_architecture + if arch == "arm64": + conf_args["-DDISABLE_GEOS_INLINE"] = "ON" + + return conf_args + + def get_shlibs(self, build: targets.Build) -> list[str]: + return [ + "geos", + "geos_c", + ] diff --git a/edgedbpkg/libgeos/install.list b/edgedbpkg/libgeos/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libgeos/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libgeos/no_install.list b/edgedbpkg/libgeos/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libgeos/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libgeotiff/__init__.py b/edgedbpkg/libgeotiff/__init__.py new file mode 100644 index 00000000..41b2d963 --- /dev/null +++ b/edgedbpkg/libgeotiff/__init__.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import libproj, libtiff, zlib + + +class LibGeoTIFF(packages.BundledCAutoconfPackage): + title = "libgeotiff" + name = packages.canonicalize_name("libgeotiff") + aliases = ["libgeotiff-dev"] + + _server = "https://download.osgeo.org/geotiff/" + + sources = [ + { + "url": _server + "libgeotiff/libgeotiff-{version}.tar.gz", + }, + ] + + artifact_requirements = [ + "libproj (>=6.1.0)", + "libtiff (>=3.9.1)", + "zlib", + ] + + artifact_build_requirements = [ + "libproj-dev (>=6.1.0)", + "libtiff-dev (>=3.9.1)", + "zlib-dev", + ] + + bundle_deps = [ + libproj.LibProj("9.5.0"), + libtiff.LibTIFF("4.7.0"), + zlib.Zlib("1.3.1"), + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "GEOTIFF" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_args = super().get_configure_args(build, wd=wd) | { + "--without-jpeg": None, + } + + deps = { + "libproj": "proj", + "libtiff": "libtiff", + "zlib": "zlib", + } + + for dep, key in deps.items(): + dep_pkg = build.get_package(dep) + if build.is_bundled(dep_pkg): + path = build.sh_get_bundled_install_path(dep_pkg, wd=wd) + conf_args[f"--with-{key}"] = f"!{path}" + else: + conf_args[f"--with-{key}"] = "" + + return conf_args + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["geotiff"] diff --git a/edgedbpkg/libgeotiff/install.list b/edgedbpkg/libgeotiff/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libgeotiff/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libgeotiff/no_install.list b/edgedbpkg/libgeotiff/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libgeotiff/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libjson_c/__init__.py b/edgedbpkg/libjson_c/__init__.py new file mode 100644 index 00000000..0ca12262 --- /dev/null +++ b/edgedbpkg/libjson_c/__init__.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibJsonC(packages.BundledCMakePackage): + title = "libjson-c" + name = packages.canonicalize_name("libjson-c") + aliases = ["libjson-c-dev"] + + _server = "https://s3.amazonaws.com/json-c_releases/releases/" + + sources = [ + { + "url": _server + "json-c-{version}.tar.gz", + }, + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "JSONC" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "-DBUILD_APPS": "OFF", + "-DBUILD_STATIC_LIBS": "OFF", + "-DDISABLE_EXTRA_LIBS": "ON", + "-DDISABLE_WERROR": "ON", + "-DENABLE_RDRAND": "OFF", + "-DENABLE_THREADING": "ON", + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["json-c"] diff --git a/edgedbpkg/libjson_c/install.list b/edgedbpkg/libjson_c/install.list new file mode 100644 index 00000000..c1f79bb5 --- /dev/null +++ b/edgedbpkg/libjson_c/install.list @@ -0,0 +1,2 @@ +{libdir}/** +{prefix}/share/proj/** diff --git a/edgedbpkg/libjson_c/no_install.list b/edgedbpkg/libjson_c/no_install.list new file mode 100644 index 00000000..113f7372 --- /dev/null +++ b/edgedbpkg/libjson_c/no_install.list @@ -0,0 +1,12 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir}/* +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libjsoncpp/__init__.py b/edgedbpkg/libjsoncpp/__init__.py new file mode 100644 index 00000000..af73afad --- /dev/null +++ b/edgedbpkg/libjsoncpp/__init__.py @@ -0,0 +1,33 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibJsonCpp(packages.BundledCMesonPackage): + title = "libjsoncpp" + name = packages.canonicalize_name("libjsoncpp") + aliases = ["libjsoncpp-dev"] + + _server = "https://github.com/open-source-parsers/jsoncpp/archive/" + + sources = [ + { + "url": _server + "{version}.tar.gz", + }, + ] + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "--includedir": ( + build.get_install_path(self, "include") / "jsoncpp" + ), + "-Dtests": "false", + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["jsoncpp"] diff --git a/edgedbpkg/libjsoncpp/install.list b/edgedbpkg/libjsoncpp/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libjsoncpp/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libjsoncpp/no_install.list b/edgedbpkg/libjsoncpp/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libjsoncpp/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libpcre2/__init__.py b/edgedbpkg/libpcre2/__init__.py new file mode 100644 index 00000000..2b5dc09d --- /dev/null +++ b/edgedbpkg/libpcre2/__init__.py @@ -0,0 +1,43 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibPCRE2(packages.BundledCAutoconfPackage): + title = "libpcre2" + name = packages.canonicalize_name("libpcre2") + aliases = ["libpcre2-dev"] + + _server = "https://github.com/PCRE2Project/pcre2/releases/download/" + + sources = [ + { + "url": _server + "pcre2-{version}/pcre2-{version}.tar.bz2", + } + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "PCRE2" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "--enable-pcre2-8": None, + "--disable-pcre2-16": None, + "--disable-pcre2-32": None, + "--enable-shared": None, + "--enable-jit": None, + "--enable-unicode": None, + "--disable-static": None, + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return [ + "pcre2-8", + ] diff --git a/edgedbpkg/libpcre2/ignore.list b/edgedbpkg/libpcre2/ignore.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libpcre2/ignore.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libpcre2/install.list b/edgedbpkg/libpcre2/install.list new file mode 100644 index 00000000..40dba8ee --- /dev/null +++ b/edgedbpkg/libpcre2/install.list @@ -0,0 +1 @@ +{libdir}/libpcre2-8.* diff --git a/edgedbpkg/libpcre2/no_install.list b/edgedbpkg/libpcre2/no_install.list new file mode 100644 index 00000000..7d0fa3a6 --- /dev/null +++ b/edgedbpkg/libpcre2/no_install.list @@ -0,0 +1,12 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libproj/__init__.py b/edgedbpkg/libproj/__init__.py new file mode 100644 index 00000000..ab156d71 --- /dev/null +++ b/edgedbpkg/libproj/__init__.py @@ -0,0 +1,74 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import libsqlite3, libtiff + + +class LibProj(packages.BundledCMakePackage): + title = "libproj" + name = packages.canonicalize_name("libproj") + aliases = ["libproj-dev"] + + _server = "https://github.com/OSGeo/PROJ/releases/download/" + _data_server = "https://github.com/OSGeo/PROJ-data/releases/download/" + + sources = [ + { + "url": _server + "{version}/proj-{version}.tar.gz", + }, + # { + # "url": _data_server + "1.19.0/proj-data-1.19.tar.gz", + # "path": "data/", + # "extras": { + # "strip_components": 0, + # }, + # }, + ] + + artifact_requirements = [ + "libsqlite3 (>=3.31)", + "libtiff (>=4.0)", + ] + + artifact_build_requirements = [ + "libsqlite3-dev (>=3.31)", + "libtiff-dev (>=4.0)", + ] + + bundle_deps = [ + libsqlite3.LibSQLite3("3.46.1"), + libtiff.LibTIFF("4.7.0"), + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "PROJ" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_args = super().get_configure_args(build, wd=wd) | { + "-DBUILD_TESTING": "OFF", + "-DBUILD_PROJSYNC": "OFF", + "-DENABLE_CURL": "OFF", + "-DENABLE_TIFF": "ON", + "-DBUILD_APPS": "OFF", + "-DEMBED_PROJ_DATA_PATH": "OFF", + } + + sqlite_pkg = build.get_package("libsqlite3") + if build.is_bundled(sqlite_pkg): + sqlite_bin_path = build.sh_get_bundled_pkg_bin_path( + sqlite_pkg, relative_to="pkgbuild" + ) + conf_args["-DEXE_SQLITE3"] = f"!{sqlite_bin_path}/sqlite3" + + return conf_args + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["proj"] diff --git a/edgedbpkg/libproj/install.list b/edgedbpkg/libproj/install.list new file mode 100644 index 00000000..c1f79bb5 --- /dev/null +++ b/edgedbpkg/libproj/install.list @@ -0,0 +1,2 @@ +{libdir}/** +{prefix}/share/proj/** diff --git a/edgedbpkg/libproj/no_install.list b/edgedbpkg/libproj/no_install.list new file mode 100644 index 00000000..80df33eb --- /dev/null +++ b/edgedbpkg/libproj/no_install.list @@ -0,0 +1,16 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir}/* +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libproj/patches/libproj__relative_share_fix.patch b/edgedbpkg/libproj/patches/libproj__relative_share_fix.patch new file mode 100644 index 00000000..b3c7f4c9 --- /dev/null +++ b/edgedbpkg/libproj/patches/libproj__relative_share_fix.patch @@ -0,0 +1,55 @@ +From c371db9767f27cd53ad6813a8959bbb3b76cf9f0 Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Thu, 26 Sep 2024 22:01:47 -0700 +Subject: [PATCH] Fix `pj_get_relative_share_proj...` when the DSO is loaded + with relative rpath + +When relative rpath is used `dli_fname` will contain `..` and the like, +so use `realpath` to canonicalize the path before attempting to operate +on it. +--- + src/filemanager.cpp | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/filemanager.cpp b/src/filemanager.cpp +index c176c70c..8888c036 100644 +--- a/src/filemanager.cpp ++++ b/src/filemanager.cpp +@@ -42,6 +42,7 @@ + + #include + #include ++#include + #include + + #include "filemanager.hpp" +@@ -1330,7 +1331,15 @@ static std::string pj_get_relative_share_proj_internal_no_check() { + if (!dladdr((void *)pj_get_relative_share_proj, &info)) { + return std::string(); + } +- std::string out(info.dli_fname); ++ std::vector abspath(PATH_MAX + 1); ++ if (!realpath(info.dli_fname, &abspath[0])) { ++ return std::string(); ++ } ++ std::string out(abspath.data()); ++ ++ pj_log(pj_get_default_ctx(), PJ_LOG_ERROR, ++ "pj_get_relative_share_proj_internal_no_check(): dli_fname: %s, realpath: %s", ++ info.dli_fname, out.c_str()); + constexpr char dir_sep = '/'; + // "optimization" for cmake builds where RUNPATH is set to ${prefix}/lib + out = replaceAll(out, "/bin/../", "/"); +@@ -1377,6 +1386,9 @@ pj_get_relative_share_proj_internal_check_exists(PJ_CONTEXT *ctx) { + ctx = pj_get_default_ctx(); + } + std::string path(pj_get_relative_share_proj_internal_no_check()); ++ pj_log(ctx, PJ_LOG_ERROR, ++ "pj_get_relative_share_proj_internal_check_exists(%s)", ++ path.c_str()); + if (!path.empty() && NS_PROJ::FileManager::exists(ctx, path.c_str())) { + return path; + } +-- +2.45.2 + diff --git a/edgedbpkg/libprotobuf_c/__init__.py b/edgedbpkg/libprotobuf_c/__init__.py new file mode 100644 index 00000000..50a83a57 --- /dev/null +++ b/edgedbpkg/libprotobuf_c/__init__.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +# from edgedbpkg import protobuf + + +class LibProtoBufC(packages.BundledCAutoconfPackage): + title = "libprotobuf-c" + name = packages.canonicalize_name("libprotobuf-c") + aliases = ["libprotobuf-c-dev"] + + _server = "https://github.com/protobuf-c/protobuf-c/releases/download/" + + sources = [ + { + "url": _server + "v{version}/protobuf-c-{version}.tar.gz", + }, + ] + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "--disable-protoc": None, + } + + def get_make_args( + self, + build: targets.Build, + ) -> packages.Args: + return super().get_make_args(build) | { + "V": "100", + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["protobuf-c"] diff --git a/edgedbpkg/libprotobuf_c/install.list b/edgedbpkg/libprotobuf_c/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libprotobuf_c/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libprotobuf_c/no_install.list b/edgedbpkg/libprotobuf_c/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libprotobuf_c/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libprotobuf_c/patches/libprotobuf-c__build_fixes.patch b/edgedbpkg/libprotobuf_c/patches/libprotobuf-c__build_fixes.patch new file mode 100644 index 00000000..38a36b50 --- /dev/null +++ b/edgedbpkg/libprotobuf_c/patches/libprotobuf-c__build_fixes.patch @@ -0,0 +1,117 @@ +From a6cf1aa386067e26d582cc1d1e327787595c9f13 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Wed, 20 Mar 2024 21:48:10 -0400 +Subject: [PATCH 01/11] FileGenerator::GenerateHeader(): Set + `min_header_version` unconditionally + +Previously, we were conditionally trying to set `min_header_version` to +the lowest possible value, and relying on a "legacy" Google interface to +determine the file descriptor's syntax version as part of that +determination. + +Instead, simply bump the minimum version to 1003000 (1.3.0). This +release was almost 7 years ago. In practice protobuf-c users should not +be shipping pre-compiled .pb-c.c/.pb-c.h files, anyway. +--- + protoc-c/c_file.cc | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc +index ca0ad34e..c6d8a240 100644 +--- a/protoc-c/c_file.cc ++++ b/protoc-c/c_file.cc +@@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {} + void FileGenerator::GenerateHeader(io::Printer* printer) { + std::string filename_identifier = FilenameIdentifier(file_->name()); + +- int min_header_version = 1000000; +-#if GOOGLE_PROTOBUF_VERSION >= 4023000 +- if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) { +-#else +- if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) { +-#endif +- min_header_version = 1003000; +- } ++ const int min_header_version = 1003000; + + // Generate top of header. + printer->Print( + +From ee3d9e5423c93ee6b828fdda8e7fef13a77634eb Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Wed, 20 Mar 2024 22:25:54 -0400 +Subject: [PATCH 02/11] Reimplement FieldSyntax() to maximize compatibility + across protobuf versions + +Recent versions of Google protobuf have broken the interfaces for +determining the syntax version of a .proto file. The current protobuf-c +1.5.0 release does not compile with Google protobuf 26.0 due to the most +recentage breakage. There is a possible workaround involving the Google +protobuf `FileDescriptorLegacy` class, which is documented as: + +// TODO Remove this deprecated API entirely. + +So we probably shouldn't rely on it. + +Instead, this commit obtains the `FileDescriptorProto` corresponding +to the passed in `FieldDescriptor` and interrogates the `syntax` field +directly. This is a single implementation with no version-specific +workarounds. Hopefully this won't break in the next Google protobuf +release. + +I tested the `FieldSyntax()` implementation in this commit across a +number of different Google protobuf releases and found that it worked +(`make && make check`) on all of them: + +- Google protobuf 3.6.1.3 (Ubuntu 20.04) +- Google protobuf 3.12.4 (Ubuntu 22.04) +- Google protobuf 3.21.12 (Debian 12 + Debian unstable) +- Google protobuf 3.25.2 (Debian experimental) +- Google protobuf 26.1-dev +--- + protoc-c/c_helpers.h | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h +index 062d330b..be28b601 100644 +--- a/protoc-c/c_helpers.h ++++ b/protoc-c/c_helpers.h +@@ -70,10 +70,6 @@ + #include + #include + +-#if GOOGLE_PROTOBUF_VERSION >= 4023000 +-# include +-#endif +- + namespace google { + namespace protobuf { + namespace compiler { +@@ -173,13 +169,21 @@ struct NameIndex + int compare_name_indices_by_name(const void*, const void*); + + // Return the syntax version of the file containing the field. +-// This wrapper is needed to be able to compile against protobuf2. + inline int FieldSyntax(const FieldDescriptor* field) { +-#if GOOGLE_PROTOBUF_VERSION >= 4023000 +- return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2; +-#else +- return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2; +-#endif ++ auto proto = FileDescriptorProto(); ++ field->file()->CopyTo(&proto); ++ ++ if (proto.has_syntax()) { ++ auto syntax = proto.syntax(); ++ assert(syntax == "proto2" || syntax == "proto3"); ++ if (syntax == "proto2") { ++ return 2; ++ } else if (syntax == "proto3") { ++ return 3; ++ } ++ } ++ ++ return 2; + } + + // Work around changes in protobuf >= 22.x without breaking compilation against diff --git a/edgedbpkg/libsqlite3/__init__.py b/edgedbpkg/libsqlite3/__init__.py new file mode 100644 index 00000000..8d67e38b --- /dev/null +++ b/edgedbpkg/libsqlite3/__init__.py @@ -0,0 +1,123 @@ +from __future__ import annotations +from typing import ( + Dict, +) + +import shlex + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import zlib + + +class LibSQLite3(packages.BundledCAutoconfPackage): + title = "libsqlite3" + name = packages.canonicalize_name("libsqlite3") + aliases = ["libsqlite3-dev"] + + _server = "https://www.sqlite.org/2024/" + + sources = [ + { + "url": _server + "sqlite-src-{sqlitever}.zip", + } + ] + + artifact_requirements = [ + "zlib", + ] + + artifact_build_requirements = [ + "zlib-dev", + ] + + bundle_deps = [ + zlib.Zlib("1.3.1"), + ] + + @classmethod + def get_source_url_variables(cls, version: str) -> Dict[str, str]: + p = [int(v) for v in version.split(".")] + if len(p) < 4: + p.append(0) + return { + "sqlitever": "{p[0]:d}{p[1]:02d}{p[2]:02d}{p[3]:02d}".format(p=p) + } + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "SQLite3" + + @property + def provides_build_tools(self) -> bool: + return True + + def sh_get_configure_command(self, build: targets.Build) -> str: + sdir = build.get_source_dir(self, relative_to="pkgbuild") + return f'/bin/sh {shlex.quote(str(sdir / "configure"))}' + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_args = super().get_configure_args(build, wd=wd) | { + "--enable-load-extension": None, + "--enable-threadsafe": None, + "--disable-static": None, + "--enable-fts5": None, + "--disable-editline": None, + "--disable-readline": None, + "--disable-tcl": None, + "--disable-debug": None, + } + + flags = [ + "SQLITE_ENABLE_API_ARMOR", + "SQLITE_ENABLE_BYTECODE_VTAB", + "SQLITE_ENABLE_COLUMN_METADATA", + "SQLITE_ENABLE_DBPAGE_VTAB", + "SQLITE_ENABLE_DBSTAT_VTAB", + "SQLITE_ENABLE_DESERIALIZE", + "SQLITE_ENABLE_EXPLAIN_COMMENTS", + "SQLITE_ENABLE_FTS3", + "SQLITE_ENABLE_FTS3_PARENTHESIS", + "SQLITE_ENABLE_FTS4", + "SQLITE_ENABLE_HIDDEN_COLUMNS", + "SQLITE_ENABLE_MEMSYS5", + "SQLITE_ENABLE_NORMALIZE", + "SQLITE_ENABLE_OFFSET_SQL_FUNC", + "SQLITE_ENABLE_PREUPDATE_HOOK", + "SQLITE_ENABLE_RBU", + "SQLITE_ENABLE_RTREE", + "SQLITE_ENABLE_GEOPOLY", + "SQLITE_ENABLE_SESSION", + "SQLITE_ENABLE_STMT_SCANSTATUS", + "SQLITE_ENABLE_STMTVTAB", + "SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION", + "SQLITE_ENABLE_UNLOCK_NOTIFY", + "SQLITE_ENABLE_UPDATE_DELETE_LIMIT", + "SQLITE_SOUNDEX", + "SQLITE_USE_URI", + ] + + build.sh_append_flags( + conf_args, + "CPPFLAGS", + [f"-D{f}" for f in flags], + ) + + arch = build.target.machine_architecture + if arch == "x86_64": + build.sh_append_flags( + conf_args, + "CFLAGS", + ("-mfpmath=sse",), + ) + + return conf_args + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["sqlite3"] diff --git a/edgedbpkg/libsqlite3/install.list b/edgedbpkg/libsqlite3/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libsqlite3/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libsqlite3/no_install.list b/edgedbpkg/libsqlite3/no_install.list new file mode 100644 index 00000000..d3327635 --- /dev/null +++ b/edgedbpkg/libsqlite3/no_install.list @@ -0,0 +1,7 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.la +{bindir} +{bindir}/* +{includedir} +{includedir}/** diff --git a/edgedbpkg/libtiff/__init__.py b/edgedbpkg/libtiff/__init__.py new file mode 100644 index 00000000..9d4dfcd5 --- /dev/null +++ b/edgedbpkg/libtiff/__init__.py @@ -0,0 +1,63 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import zlib + + +class LibTIFF(packages.BundledCAutoconfPackage): + title = "libtiff" + name = packages.canonicalize_name("libtiff") + aliases = ["libtiff-dev"] + + _server = "https://download.osgeo.org/libtiff/" + + sources = [ + { + "url": _server + "tiff-{version}.tar.xz", + }, + ] + + artifact_requirements = [ + "zlib", + ] + + artifact_build_requirements = [ + "zlib-dev", + ] + + bundle_deps = [ + zlib.Zlib("1.3.1"), + ] + + @classmethod + def get_dep_pkg_name(cls) -> str: + """Name used by pkg-config or CMake to refer to this package.""" + return "TIFF" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "--disable-sphinx": None, + "--disable-cxx": None, + "--disable-jbig": None, + "--disable-jpeg": None, + "--disable-opengl": None, + "--disable-lzma": None, + "--disable-static": None, + "--disable-tests": None, + "--disable-webp": None, + "--enable-zlib": None, + "--disable-zstd": None, + "--disable-libdeflate": None, + "--disable-docs": None, + "--disable-contrib": None, + "--disable-tools": None, + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["tiff"] diff --git a/edgedbpkg/libtiff/install.list b/edgedbpkg/libtiff/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libtiff/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libtiff/no_install.list b/edgedbpkg/libtiff/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/libtiff/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/libuuid/__init__.py b/edgedbpkg/libuuid/__init__.py index 703028e3..82624bc0 100644 --- a/edgedbpkg/libuuid/__init__.py +++ b/edgedbpkg/libuuid/__init__.py @@ -4,7 +4,7 @@ from metapkg import targets -class LibUUID(packages.BundledCPackage): +class LibUUID(packages.BundledCAutoconfPackage): title = "uuid" name = packages.canonicalize_name("uuid") aliases = ["uuid-dev"] @@ -17,14 +17,15 @@ class LibUUID(packages.BundledCPackage): } ] - def get_configure_script(self, build: targets.Build) -> str: - sdir = build.get_source_dir(self, relative_to="pkgbuild") - configure = sdir / "configure" - configure_flags = { + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { "--disable-all-programs": None, "--enable-libuuid": None, } - return self.sh_configure(build, configure, configure_flags) def get_shlibs(self, build: targets.Build) -> list[str]: return ["uuid"] diff --git a/edgedbpkg/libxml2/__init__.py b/edgedbpkg/libxml2/__init__.py new file mode 100644 index 00000000..08103dc6 --- /dev/null +++ b/edgedbpkg/libxml2/__init__.py @@ -0,0 +1,38 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + + +class LibXML2(packages.BundledCAutoconfPackage): + title = "libxml2" + name = packages.canonicalize_name("libxml2") + aliases = ["libxml2-dev"] + + _server = "https://download.gnome.org/sources/libxml2/" + + sources = [ + { + "url": _server + "{major_minor_v}/libxml2-{version}.tar.xz", + }, + ] + + def get_dep_pkg_config_script(self) -> str | None: + return "xml2-config" + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "--without-icu": None, + "--without-lzma": None, + "--disable-static": None, + "--without-readline": None, + "--without-history": None, + "--without-python": None, + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return ["xml2"] diff --git a/edgedbpkg/libxml2/install.list b/edgedbpkg/libxml2/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/libxml2/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/libxml2/no_install.list b/edgedbpkg/libxml2/no_install.list new file mode 100644 index 00000000..41e7eb5b --- /dev/null +++ b/edgedbpkg/libxml2/no_install.list @@ -0,0 +1,19 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{prefix}/share +{prefix}/share/aclocal +{prefix}/share/aclocal/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** +{prefix}/share/gtk-doc +{prefix}/share/gtk-doc/** diff --git a/edgedbpkg/openssl/__init__.py b/edgedbpkg/openssl/__init__.py index 9617e769..acb7b1de 100644 --- a/edgedbpkg/openssl/__init__.py +++ b/edgedbpkg/openssl/__init__.py @@ -1,5 +1,4 @@ from __future__ import annotations -from typing import * import platform import re @@ -24,18 +23,27 @@ class OpenSSL(packages.BundledCPackage): } ] - def get_configure_script(self, build: targets.Build) -> str: - sdir = shlex.quote( - str(build.get_source_dir(self, relative_to="pkgbuild")) - ) - copy_sources = f"test ./ -ef {sdir} || cp -a {sdir}/* ./" - - configure = "./Configure" - configure_flags = { - "--openssldir": str( - build.get_full_install_prefix() / "etc" / "ssl" - ), - "--libdir": str(build.get_install_path("lib")), + @property + def supports_out_of_tree_builds(self) -> bool: + return False + + def sh_get_configure_command(self, build: targets.Build) -> str: + if self.supports_out_of_tree_builds: + sdir = build.get_source_dir(self, relative_to="pkgbuild") + else: + sdir = build.get_build_dir(self, relative_to="pkgbuild") + + return shlex.quote(str(sdir / "Configure")) + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_args = super().get_configure_args(build, wd=wd) | { + "--prefix": build.get_install_prefix(self), + "--openssldir": build.get_install_path(self, "sysconf") / "ssl", + "--libdir": build.get_install_path(self, "lib"), "no-ssl3": None, "shared": None, } @@ -43,31 +51,32 @@ def get_configure_script(self, build: targets.Build) -> str: arch = build.target.machine_architecture if arch == "x86_64": if platform.system() == "Darwin": - configure_flags["darwin64-x86_64-cc"] = None - configure_flags["enable-ec_nistp_64_gcc_128"] = None + conf_args["darwin64-x86_64-cc"] = None + conf_args["enable-ec_nistp_64_gcc_128"] = None elif arch == "aarch64": if platform.system() == "Darwin": - configure_flags["darwin64-arm64-cc"] = None + conf_args["darwin64-arm64-cc"] = None else: raise RuntimeError(f"unexpected architecture: {arch}") if self.options.get("shared", True): - configure_flags["shared"] = None + conf_args["shared"] = None else: - configure_flags["no-shared"] = None - configure_flags["no-legacy"] = None + conf_args["no-shared"] = None + conf_args["no-legacy"] = None + + return conf_args - cfgcmd = self.sh_configure(build, configure, configure_flags) + def get_configure_env( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_env = super().get_configure_env(build, wd=wd) if platform.system() == "Darwin": # Force 64-bit build - cfgcmd = f"KERNEL_BITS=64 {cfgcmd}" - - return "\n\n".join( - [ - copy_sources, - cfgcmd, - ] - ) + conf_env["KERNEL_BITS"] = "64" + return conf_env def get_make_install_target(self, build: targets.Build) -> str: # Don't bother installing a gazillion of man pages. diff --git a/edgedbpkg/openssl/no_install.list b/edgedbpkg/openssl/no_install.list index c5c70cbb..51877a7b 100644 --- a/edgedbpkg/openssl/no_install.list +++ b/edgedbpkg/openssl/no_install.list @@ -4,3 +4,5 @@ {libdir}/pkgconfig/** {libdir}/*.a {libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** diff --git a/edgedbpkg/pgbundle/__init__.py b/edgedbpkg/pgbundle/__init__.py index 1650e313..bbd8e71a 100644 --- a/edgedbpkg/pgbundle/__init__.py +++ b/edgedbpkg/pgbundle/__init__.py @@ -9,7 +9,7 @@ from metapkg import packages from metapkg import targets -from edgedbpkg.pgext import pgvector +from edgedbpkg.pgext import pgvector, postgis from edgedbpkg import postgresql if TYPE_CHECKING: @@ -35,6 +35,7 @@ class PostgreSQLBundle(packages.BundledPackage): ], ">=16.0": [ "pgext-pgvector (~= 0.6.0)", + "pgext-postgis (~= 3.4.3)", ], } @@ -47,6 +48,7 @@ def resolve( revision: str | None = None, is_release: bool = False, target: targets.Target, + requires: list[poetry_dep.Dependency] | None = None, ) -> PostgreSQLBundle: postgres = postgresql.PostgreSQL.resolve( io, @@ -54,6 +56,7 @@ def resolve( revision=revision, is_release=is_release, target=target, + requires=requires, ) bundle = cls( @@ -65,6 +68,7 @@ def resolve( postgres, pgvector.PgVector("v0.4.2"), pgvector.PgVector("v0.6.0"), + postgis.PostGIS("3.4.3"), ] return bundle @@ -78,8 +82,5 @@ def get_requirements(self) -> list[poetry_dep.Dependency]: ) return reqs - def get_configure_script(self, build: targets.Build) -> str: - return "" - def get_build_script(self, build: targets.Build) -> str: return "" diff --git a/edgedbpkg/pgext/__init__.py b/edgedbpkg/pgext/__init__.py index e69de29b..378f59c6 100644 --- a/edgedbpkg/pgext/__init__.py +++ b/edgedbpkg/pgext/__init__.py @@ -0,0 +1,3 @@ +from .base import PostgresCExtension + +__all__ = ("PostgresCExtension",) diff --git a/edgedbpkg/pgext/base.py b/edgedbpkg/pgext/base.py new file mode 100644 index 00000000..b55e79fd --- /dev/null +++ b/edgedbpkg/pgext/base.py @@ -0,0 +1,157 @@ +from __future__ import annotations +from typing import ( + Any, + TYPE_CHECKING, +) + +import pathlib +import re +import shlex + +from poetry.core.constraints import version as poetry_version +from poetry.core.packages import dependency as poetry_dep + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import postgresql + +if TYPE_CHECKING: + from cleo.io import io as cleo_io + + +class PostgresCExtension(packages.BundledCAutoconfPackage): + # Populated in resolve() when this is built as top-level package. + bundle_deps: list[packages.BundledPackage] = [] + _pg: postgresql.PostgreSQL + + @classmethod + def resolve( + cls, + io: cleo_io.IO, + *, + version: str | None = None, + revision: str | None = None, + is_release: bool = False, + target: targets.Target, + requires: list[poetry_dep.Dependency] | None = None, + ) -> PostgresCExtension: + slot: str | None = None + if version is not None: + slot, _, version = version.rpartition("!") + + if not slot: + raise RuntimeError( + "must specify PostgreSQL major version as epoch, eg 16!4.0.0" + ) + + pg_ver = slot + if "." not in pg_ver: + pg_ver = f"{pg_ver}.0" + + pg = postgresql.PostgreSQL(version=pg_ver) + + ext = super().resolve( + io, + version=version, + revision=revision, + is_release=is_release, + target=target, + requires=requires, + ) + + ext.bundle_deps.append(pg) + ext.build_requires.append(pg.to_dependency()) + ext._pg = pg + + if slot is not None: + ext.set_slot(str(slot)) + + return ext + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self._slot = "" + + def set_slot(self, slot: str) -> None: + self._slot = slot + + @property + def slot(self) -> str: + return self._slot + + def version_includes_slot(self) -> bool: + return False + + @property + def supports_out_of_tree_builds(self) -> bool: + return True + + def get_configure_script(self, build: targets.Build) -> str: + source = build.get_source_dir(self, relative_to="pkgbuild") + return ( + f"if [ -x {shlex.quote(str(source))}/configure ]; then\n" + + super().get_configure_script(build) + + "\nfi\n" + ) + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + if wd is None: + wd = "$(pwd -P)" + pg_config = f'{wd}/{build.sh_get_command("pg_config")}' + return super().get_configure_args(build, wd=wd) | { + "PG_CONFIG": f"!{pg_config}", + } + + def get_build_env(self, build: targets.Build, wd: str) -> packages.Args: + pg_config = f'{wd}/{build.sh_get_command("pg_config")}' + return super().get_build_env(build, wd=wd) | { + "PG_CONFIG": f"!{pg_config}", + "USE_PGXS": "1", + } + + def get_build_install_env( + self, build: targets.Build, wd: str + ) -> packages.Args: + pg_config = f'{wd}/{build.sh_get_command("pg_config_install")}' + return super().get_build_install_env(build, wd=wd) | { + "PG_CONFIG": f"!{pg_config}", + "USE_PGXS": "1", + } + + def get_patches(self) -> dict[str, list[tuple[str, str]]]: + v = f"{self.version.major}{self.version.minor:02}" + + patches = dict(super().get_patches()) + for pkg, pkg_patches in patches.items(): + if pkg == self.name: + filtered = [] + for i, (pn, pfile) in enumerate(list(pkg_patches)): + m = re.match(r"^.*-(\d+)$", pn) + if m and m.group(1) != v: + pass + else: + filtered.append((pn, pfile)) + patches[pkg] = filtered + break + + return patches + + def get_root_install_subdir(self, build: targets.Build) -> pathlib.Path: + return pathlib.Path(self._pg.name_slot) + + def get_dep_install_subdir( + self, + build: targets.Build, + pkg: packages.BasePackage, + ) -> pathlib.Path: + prefix = build.get_install_prefix(self) + lib_dir = build.get_install_path(self, "lib").relative_to(prefix) + if pkg.name != "postgresql-edgedb": + return lib_dir / "postgresql" / pathlib.Path(self.unique_name) + else: + return pathlib.Path("") diff --git a/edgedbpkg/pgext/pgvector/__init__.py b/edgedbpkg/pgext/pgvector/__init__.py index acae9cfc..fc137d75 100644 --- a/edgedbpkg/pgext/pgvector/__init__.py +++ b/edgedbpkg/pgext/pgvector/__init__.py @@ -1,24 +1,11 @@ from __future__ import annotations -from typing import ( - TYPE_CHECKING, - Any, -) - -import re -import shlex - -from poetry.core.constraints import version as poetry_version from metapkg import packages -from metapkg import targets - -from edgedbpkg import postgresql -if TYPE_CHECKING: - from cleo.io import io as cleo_io +from edgedbpkg import pgext -class PgVector(packages.BundledCPackage): +class PgVector(pgext.PostgresCExtension): title = "pgvector extension" name = packages.canonicalize_name("pgext-pgvector") description = "Open-source vector similarity search for Postgres" @@ -35,101 +22,6 @@ class PgVector(packages.BundledCPackage): "postgresql-edgedb (>=13)", ] - # Populated in resolve() when this is built as top-level package. - bundle_deps: list[packages.BundledPackage] = [] - - @classmethod - def resolve( - cls, - io: cleo_io.IO, - *, - version: str | None = None, - revision: str | None = None, - is_release: bool = False, - target: targets.Target, - ) -> PgVector: - slot: int | None = None - if version is not None: - ver = poetry_version.Version.parse(version) - if ver.epoch != 0: - slot = ver.epoch - version = f"v{ver.replace(epoch=0).to_string()}" - - if slot is not None: - pg_ver = str(slot) - else: - pg_ver = "15" - - cls.bundle_deps.append(postgresql.PostgreSQL(version=pg_ver)) - - pgvector = super().resolve( - io, - version=version, - revision=revision, - is_release=is_release, - target=target, - ) - - if slot is not None: - pgvector.set_slot(str(slot)) - - return pgvector - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._slot = "" - - def set_slot(self, slot: str) -> None: - self._slot = slot - @property - def slot(self) -> str: - return self._slot - - def version_includes_slot(self) -> bool: + def supports_out_of_tree_builds(self) -> bool: return False - - def get_configure_script(self, build: targets.Build) -> str: - srcdir = build.get_source_dir(self, relative_to="pkgbuild") - sdir = shlex.quote(str(srcdir)) - copy_sources = f"test ./ -ef {sdir} || cp -a {sdir}/* ./" - - return copy_sources - - def get_make_env(self, build: targets.Build, wd: str) -> str: - return build.sh_format_args( - { - "PG_CONFIG": build.sh_get_command("pg_config"), - "USE_PGXS": "1", - }, - linebreaks=False, - force_args_eq=True, - ) - - def get_make_install_env(self, build: targets.Build, wd: str) -> str: - return build.sh_format_args( - { - "PG_CONFIG": build.sh_get_command("pg_config_install"), - "USE_PGXS": "1", - }, - linebreaks=False, - force_args_eq=True, - ) - - def get_patches(self) -> dict[str, list[tuple[str, str]]]: - v = f"{self.version.major}{self.version.minor}" - - patches = dict(super().get_patches()) - for pkg, pkg_patches in patches.items(): - if pkg == self.name: - filtered = [] - for i, (pn, pfile) in enumerate(list(pkg_patches)): - m = re.match(r"^.*-(\d+)$", pn) - if m and m.group(1) != v: - pass - else: - filtered.append((pn, pfile)) - patches[pkg] = filtered - break - - return patches diff --git a/edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-04.patch b/edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-004.patch similarity index 100% rename from edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-04.patch rename to edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-004.patch diff --git a/edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-06.patch b/edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-006.patch similarity index 100% rename from edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-06.patch rename to edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-CFLAGS-006.patch diff --git a/edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-build-warning-04.patch b/edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-build-warning-004.patch similarity index 100% rename from edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-build-warning-04.patch rename to edgedbpkg/pgext/pgvector/patches/pgext-pgvector__Fix-build-warning-004.patch diff --git a/edgedbpkg/pgext/postgis/__init__.py b/edgedbpkg/pgext/postgis/__init__.py new file mode 100644 index 00000000..af224951 --- /dev/null +++ b/edgedbpkg/pgext/postgis/__init__.py @@ -0,0 +1,74 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import libgeos +from edgedbpkg import libgdal +from edgedbpkg import libjson_c +from edgedbpkg import libpcre2 +from edgedbpkg import libproj +from edgedbpkg import libprotobuf_c +from edgedbpkg import libxml2 +from edgedbpkg import protoc_c + +from edgedbpkg import pgext + + +class PostGIS(pgext.PostgresCExtension): + title = "postgis extension" + name = packages.canonicalize_name("pgext-postgis") + description = "Geographic Objects for PostgreSQL" + license_id = "GPL-3" + group = "Applications/Databases" + + _server = "https://download.osgeo.org/postgis/source/" + + sources = [ + { + "url": _server + "postgis-{version}.tar.gz", + }, + ] + + artifact_requirements = [ + "libgdal (>=2.0.0)", + "libgeos (>=3.9.0)", + "libjson-c", + "libpcre2-dev", + "libproj (>=6.1.0)", + "libprotobuf-c (>=1.1.0)", + "libxml2", + ] + + artifact_build_requirements = [ + "postgresql-edgedb (>=13)", + "libgdal-dev (>=2.0.0)", + "libgeos-dev (>=3.9.0)", + "libjson-c-dev", + "libpcre2-dev", + "libproj-dev (>=6.1.0)", + "libprotobuf-c-dev (>=1.1.0)", + "protoc-c (>=1.1.0)", + "libxml2-dev", + ] + + bundle_deps = [ + libgdal.LibGDAL("3.9.2"), + libgeos.LibGEOS("3.13.0"), + libjson_c.LibJsonC("0.17"), + libpcre2.LibPCRE2("10.44"), + libproj.LibProj("9.5.0"), + libprotobuf_c.LibProtoBufC("1.5.0"), + protoc_c.ProtoCompilerC("1.5.0"), + libxml2.LibXML2("2.13.4"), + ] + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + return super().get_configure_args(build, wd=wd) | { + "--without-gui": None, + "--with-address-standardizer": None, + } diff --git a/edgedbpkg/pgext/postgis/ignore.list b/edgedbpkg/pgext/postgis/ignore.list new file mode 100644 index 00000000..6e780acb --- /dev/null +++ b/edgedbpkg/pgext/postgis/ignore.list @@ -0,0 +1 @@ +{includedir}/**/*.h diff --git a/edgedbpkg/pgext/postgis/install.list b/edgedbpkg/pgext/postgis/install.list new file mode 100644 index 00000000..47d31a05 --- /dev/null +++ b/edgedbpkg/pgext/postgis/install.list @@ -0,0 +1,6 @@ +{bundlelibdir}/postgresql/*.so +{bundlelibdir}/postgresql/*.dylib +{bundledatadir}/postgresql/contrib +{bundledatadir}/postgresql/contrib/** +{bundledatadir}/postgresql/extension +{bundledatadir}/postgresql/extension/* diff --git a/edgedbpkg/pgext/postgis/no_install.list b/edgedbpkg/pgext/postgis/no_install.list new file mode 100644 index 00000000..72bb74fb --- /dev/null +++ b/edgedbpkg/pgext/postgis/no_install.list @@ -0,0 +1,16 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** +{bundledocdir} +{bundledocdir}/** diff --git a/edgedbpkg/pgext/postgis/patches/pgext-postgis__fix-out-of-tree.patch b/edgedbpkg/pgext/postgis/patches/pgext-postgis__fix-out-of-tree.patch new file mode 100644 index 00000000..32a16904 --- /dev/null +++ b/edgedbpkg/pgext/postgis/patches/pgext-postgis__fix-out-of-tree.patch @@ -0,0 +1,43 @@ +From b83c4860e9b323cad0b9031e99676a363c537b9e Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Fri, 4 Oct 2024 13:08:50 -0700 +Subject: [PATCH] Fix out-of-tree builds without xsltproc + +--- + configure | 4 ++-- + configure.ac | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/configure b/configure +index a2ad1b50b..efbf46631 100755 +--- a/configure ++++ b/configure +@@ -25824,8 +25824,8 @@ EXTENSIONS="" + if test "x$PG_CONFIG" != "xno"; then + if test \ + "x$XSLTPROC" != "x" -o \ +- -e doc/postgis_comments.sql -a \ +- -e doc/raster_comments.sql; ++ -e ${srcdir}/doc/postgis_comments.sql -a \ ++ -e ${srcdir}/doc/raster_comments.sql; + then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling PostgreSQL extension support..." >&5 + $as_echo "enabling PostgreSQL extension support..." >&6; } +diff --git a/configure.ac b/configure.ac +index e55fabe87..6eb1d8de7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1821,8 +1821,8 @@ EXTENSIONS="" + if test "x$PG_CONFIG" != "xno"; then + if test \ + "x$XSLTPROC" != "x" -o \ +- -e doc/postgis_comments.sql -a \ +- -e doc/raster_comments.sql; ++ -e ${srcdir}/doc/postgis_comments.sql -a \ ++ -e ${srcdir}/doc/raster_comments.sql; + then + AC_MSG_RESULT([enabling PostgreSQL extension support...]) + EXTENSIONS=extensions +-- +2.45.2 + diff --git a/edgedbpkg/pgext/postgis/patches/pgext-postgis__geos-pkgconfig-304.patch b/edgedbpkg/pgext/postgis/patches/pgext-postgis__geos-pkgconfig-304.patch new file mode 100644 index 00000000..e13b5858 --- /dev/null +++ b/edgedbpkg/pgext/postgis/patches/pgext-postgis__geos-pkgconfig-304.patch @@ -0,0 +1,514 @@ +From 016e36165161455b67420a5ee012eed1eff2b78c Mon Sep 17 00:00:00 2001 +From: Paul Ramsey +Date: Wed, 22 Nov 2023 13:21:09 -0800 +Subject: [PATCH] In configure.ac, rework GEOS pkgconfig support to use + pkgconfig preferentially in the "no arguments" case. Simplify version number + parsing a little and try to linearize the flow more. + +--- + configure | 215 +++++++++++++++++++++++++++++++++++++++++---------- + configure.ac | 129 ++++++++++++++++++++----------- + 2 files changed, 259 insertions(+), 85 deletions(-) + +diff --git a/configure b/configure +index 37cd5d46b..51d5af97c 100755 +--- a/configure ++++ b/configure +@@ -728,10 +728,12 @@ SFCGAL_CPPFLAGS + SFCGAL_VERSION + POSTGIS_SFCGAL_VERSION + SFCGAL_CONFIG +-POSTGIS_GEOS_VERSION + GEOS_CPPFLAGS + GEOS_LDFLAGS ++POSTGIS_GEOS_VERSION + GEOSCONFIG ++GEOS_LIBS ++GEOS_CFLAGS + POSTGIS_LIBXML2_VERSION + XCRUN + LIBXML2_LIBS +@@ -940,6 +942,8 @@ CUNIT_LIBS + PG_CONFIG + LIBXML2_CFLAGS + LIBXML2_LIBS ++GEOS_CFLAGS ++GEOS_LIBS + PROJ_CFLAGS + PROJ_LIBS + JSONC_CFLAGS +@@ -1676,6 +1680,8 @@ Some influential environment variables: + C compiler flags for LIBXML2, overriding pkg-config + LIBXML2_LIBS + linker flags for LIBXML2, overriding pkg-config ++ GEOS_CFLAGS C compiler flags for GEOS, overriding pkg-config ++ GEOS_LIBS linker flags for GEOS, overriding pkg-config + PROJ_CFLAGS C compiler flags for PROJ, overriding pkg-config + PROJ_LIBS linker flags for PROJ, overriding pkg-config + JSONC_CFLAGS +@@ -15580,6 +15586,9 @@ _ACEOF + + + ++GEOS_MIN_VERSION=3.8.0 ++GEOS_MIN_VERSION_NUMERIC=`echo $GEOS_MIN_VERSION | $PERL -nle 'printf "%d%02d%02d\n",$1,$2,$3 if /(\d+)\.(\d+)\.(\d+)/'` ++ + + # Check whether --with-geosconfig was given. + if test "${with_geosconfig+set}" = set; then : +@@ -15589,8 +15598,127 @@ else + fi + + +-if test "x$GEOSCONFIG" = "x"; then +- # Extract the first word of "geos-config", so it can be a program name with args. ++if test ! -z "$GEOSCONFIG"; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking that $GEOSCONFIG exists" >&5 ++$as_echo_n "checking that $GEOSCONFIG exists... " >&6; } ++ if test -f "$GEOSCONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking that $GEOSCONFIG is executable" >&5 ++$as_echo_n "checking that $GEOSCONFIG is executable... " >&6; } ++ if test -x "$GEOSCONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ as_fn_error $? "use --with-geosconfig=/path/to/executable/geos-config" "$LINENO" 5 ++ fi ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ as_fn_error $? "use --with-geosconfig=/path/to/geos-config" "$LINENO" 5 ++ fi ++ ++ GEOS_VERSION=`$GEOSCONFIG --version` ++ GEOS_LDFLAGS=`$GEOSCONFIG --clibs` ++ GEOS_CPPFLAGS=`$GEOSCONFIG --cflags` ++ GEOS_CONFIG_SRC=$GEOSCONFIG ++ ++else ++ ++ if test ! -z "$PKG_CONFIG"; then ++ ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GEOS" >&5 ++$as_echo_n "checking for GEOS... " >&6; } ++ ++if test -n "$GEOS_CFLAGS"; then ++ pkg_cv_GEOS_CFLAGS="$GEOS_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"geos\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "geos") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_GEOS_CFLAGS=`$PKG_CONFIG --cflags "geos" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$GEOS_LIBS"; then ++ pkg_cv_GEOS_LIBS="$GEOS_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"geos\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "geos") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_GEOS_LIBS=`$PKG_CONFIG --libs "geos" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ GEOS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "geos" 2>&1` ++ else ++ GEOS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "geos" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$GEOS_PKG_ERRORS" >&5 ++ ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for geos-config on the path..." >&5 ++$as_echo "checking for geos-config on the path..." >&6; } ++ ++ ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for geos-config on the path..." >&5 ++$as_echo "checking for geos-config on the path..." >&6; } ++ ++ ++else ++ GEOS_CFLAGS=$pkg_cv_GEOS_CFLAGS ++ GEOS_LIBS=$pkg_cv_GEOS_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++ GEOS_VERSION=`$PKG_CONFIG geos --modversion` ++ GEOS_LDFLAGS=`$PKG_CONFIG geos --libs` ++ GEOS_CPPFLAGS=`$PKG_CONFIG geos --cflags` ++ GEOS_PKGCONFIG=yes ++ GEOS_CONFIG_SRC="$PKG_CONFIG geos" ++ ++fi ++ fi ++ ++ if test -z "$GEOS_PKGCONFIG"; then ++ # Extract the first word of "geos-config", so it can be a program name with args. + set dummy geos-config; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } +@@ -15630,38 +15758,46 @@ $as_echo "no" >&6; } + fi + + +- +- if test "x$GEOSCONFIG" = "x"; then +- as_fn_error $? "could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter." "$LINENO" 5 +- fi +-else +- if test "x$GEOSCONFIG" = "xyes"; then +- as_fn_error $? "you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config" "$LINENO" 5 +- else +- if test -f $GEOSCONFIG; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using user-specified geos-config file: $GEOSCONFIG" >&5 +-$as_echo "Using user-specified geos-config file: $GEOSCONFIG" >&6; } ++ if test -z "$GEOSCONFIG"; then ++ as_fn_error $? "could not find geos-config on the current path, try using the --with-geosconfig parameter." "$LINENO" 5 + else +- as_fn_error $? "the user-specified geos-config file $GEOSCONFIG does not exist" "$LINENO" 5 ++ GEOS_VERSION=`$GEOSCONFIG --version` ++ GEOS_LDFLAGS=`$GEOSCONFIG --clibs` ++ GEOS_CPPFLAGS=`$GEOSCONFIG --cflags` ++ GEOS_CONFIG_SRC="$GEOSCONFIG" + fi + fi + fi + +-GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[^0-9]//g'` +-GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[^0-9]//g'` +-GEOS_PATCH_VERSION=`$GEOSCONFIG --version | cut -d. -f3 | sed 's/[^0-9]//g'` +-if test "x$GEOS_PATCH_VERSION" = "x"; then +- GEOS_PATCH_VERSION="0"; +-fi +-GEOS_FULL_VERSION=`$GEOSCONFIG --version` +-GEOS_NUMERIC_PATCH_VERSION=`printf "%02d" $GEOS_PATCH_VERSION` +-GEOS_NUMERIC_MINOR_VERSION=`printf "%02d" $GEOS_MINOR_VERSION` +-POSTGIS_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_NUMERIC_MINOR_VERSION$GEOS_NUMERIC_PATCH_VERSION" ++POSTGIS_GEOS_VERSION=`echo $GEOS_VERSION | $PERL -nle 'printf "%d%02d%02d\n",$1,$2,$3 if /(\d+)\.(\d+)\.(\d+)/'` ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking GEOS version" >&5 ++$as_echo_n "checking GEOS version... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GEOS_VERSION" >&5 ++$as_echo "$GEOS_VERSION" >&6; } ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking GEOS numeric version" >&5 ++$as_echo_n "checking GEOS numeric version... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $POSTGIS_GEOS_VERSION" >&5 ++$as_echo "$POSTGIS_GEOS_VERSION" >&6; } ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking GEOS link flags" >&5 ++$as_echo_n "checking GEOS link flags... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GEOS_LDFLAGS" >&5 ++$as_echo "$GEOS_LDFLAGS" >&6; } ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking GEOS compile flags" >&5 ++$as_echo_n "checking GEOS compile flags... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GEOS_CPPFLAGS" >&5 ++$as_echo "$GEOS_CPPFLAGS" >&6; } + +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking GEOS version... $GEOS_FULL_VERSION" >&5 +-$as_echo "checking GEOS version... $GEOS_FULL_VERSION" >&6; } +-if test ! "$POSTGIS_GEOS_VERSION" -ge 30600; then +- as_fn_error $? "PostGIS requires GEOS >= 3.6.0" "$LINENO" 5 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking GEOS version is supported" >&5 ++$as_echo_n "checking GEOS version is supported... " >&6; } ++if test "$POSTGIS_GEOS_VERSION" -ge "$GEOS_MIN_VERSION_NUMERIC"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++else ++ as_fn_error $? "PostGIS requires GEOS >= $GEOS_MIN_VERSION" "$LINENO" 5 + fi + + # +@@ -15681,11 +15817,6 @@ $as_echo "checking for GEOS_RPATH under MacOS... $GEOS_RPATH" >&6; } + ;; + esac + +-GEOS_LDFLAGS=`$GEOSCONFIG --clibs` +-GEOS_CPPFLAGS=`$GEOSCONFIG --cflags` +- +- +- + CPPFLAGS_SAVE="$CPPFLAGS" + CPPFLAGS="$GEOS_CPPFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "geos_c.h" "ac_cv_header_geos_c_h" "$ac_includes_default" +@@ -18624,7 +18755,7 @@ $as_echo "yes" >&6; } + + PROJ_CPPFLAGS="$PROJ_CFLAGS" + PROJ_LDFLAGS="$PROJ_LIBS" +- POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | sed 's/\([0-9]\).*\([0-9]\).*\([0-9]\)/\1\2/'` ++ POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | $PERL -nle 'print "$1$2" if /(\d+)\.(\d+)\.(\d+)/'` + + fi + else +@@ -19162,7 +19293,7 @@ if test "$CHECK_PROTOBUF" != "no"; then + + CPPFLAGS_SAVE="$CPPFLAGS" + LDFLAGS_SAVE="$LDFLAGS" +- LIBS_SAVE="$LIBS" ++ LIBS_SAVE="$LIBS" + + if test -n "$PKG_CONFIG"; then + +@@ -28230,10 +28361,10 @@ fi + $as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: -------------- Dependencies -------------- " >&5 + $as_echo " -------------- Dependencies -------------- " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: GEOS config: ${GEOSCONFIG}" >&5 +-$as_echo " GEOS config: ${GEOSCONFIG}" >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: GEOS version: ${GEOS_FULL_VERSION}" >&5 +-$as_echo " GEOS version: ${GEOS_FULL_VERSION}" >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: GEOS config: ${GEOS_CONFIG_SRC}" >&5 ++$as_echo " GEOS config: ${GEOS_CONFIG_SRC}" >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: GEOS version: ${GEOS_VERSION}" >&5 ++$as_echo " GEOS version: ${GEOS_VERSION}" >&6; } + if test "x$RASTER" = "xraster"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: GDAL config: ${GDAL_CONFIG}" >&5 + $as_echo " GDAL config: ${GDAL_CONFIG}" >&6; } +@@ -28343,8 +28474,8 @@ $as_echo "" >&6; } + if test "$POSTGIS_GEOS_VERSION" -lt 31200; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --------- GEOS VERSION WARNING ------------ " >&5 + $as_echo "$as_me: WARNING: --------- GEOS VERSION WARNING ------------ " >&2;} +-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You are building against GEOS ${GEOS_FULL_VERSION}." >&5 +-$as_echo "$as_me: WARNING: You are building against GEOS ${GEOS_FULL_VERSION}." >&2;} ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You are building against GEOS ${GEOS_VERSION}." >&5 ++$as_echo "$as_me: WARNING: You are building against GEOS ${GEOS_VERSION}." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: " >&5 + $as_echo "$as_me: WARNING: " >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: To take advantage of _all_ the features of " >&5 +diff --git a/configure.ac b/configure.ac +index baa0f1762..1be18424b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -718,50 +718,97 @@ dnl =========================================================================== + dnl Detect the version of GEOS installed on the system + dnl =========================================================================== + ++dnl ++dnl Set the min version number here ++dnl ++GEOS_MIN_VERSION=3.8.0 ++GEOS_MIN_VERSION_NUMERIC=`echo $GEOS_MIN_VERSION | $PERL -nle 'printf "%d%02d%02d\n",$1,$2,$3 if /(\d+)\.(\d+)\.(\d+)/'` ++ + AC_ARG_WITH([geosconfig], + [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])], + [GEOSCONFIG="$withval"], [GEOSCONFIG=""]) + +-if test "x$GEOSCONFIG" = "x"; then +- dnl GEOSCONFIG was not specified, so search within the current path +- AC_PATH_PROG([GEOSCONFIG], [geos-config]) ++if test ! -z "$GEOSCONFIG"; then + +- dnl If we couldn't find geos-config, display an error +- if test "x$GEOSCONFIG" = "x"; then +- AC_MSG_ERROR([could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter.]) ++ dnl the --with-geosconfig argument was set ++ AC_MSG_CHECKING([that $GEOSCONFIG exists]) ++ if test -f "$GEOSCONFIG"; then ++ AC_MSG_RESULT([yes]) ++ AC_MSG_CHECKING([that $GEOSCONFIG is executable]) ++ if test -x "$GEOSCONFIG"; then ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no]) ++ AC_MSG_ERROR([use --with-geosconfig=/path/to/executable/geos-config]) ++ fi ++ else ++ AC_MSG_RESULT([no]) ++ AC_MSG_ERROR([use --with-geosconfig=/path/to/geos-config]) + fi ++ ++ dnl a usable geos-config was specified ++ GEOS_VERSION=`$GEOSCONFIG --version` ++ GEOS_LDFLAGS=`$GEOSCONFIG --clibs` ++ GEOS_CPPFLAGS=`$GEOSCONFIG --cflags` ++ GEOS_CONFIG_SRC=$GEOSCONFIG ++ + else +- dnl GEOSCONFIG was specified; display a message to the user +- if test "x$GEOSCONFIG" = "xyes"; then +- AC_MSG_ERROR([you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config]) +- else +- if test -f $GEOSCONFIG; then +- AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG]) ++ ++ dnl the --with-geosconfig argument was NOT set ++ if test ! -z "$PKG_CONFIG"; then ++ dnl look in pkg-config first ++ dnl GEOS_LDFLAGS and GEOS_CPPFLAGS get set automatically ++ ++ PKG_CHECK_MODULES([GEOS], [geos], [ ++ GEOS_VERSION=`$PKG_CONFIG geos --modversion` ++ GEOS_LDFLAGS=`$PKG_CONFIG geos --libs` ++ GEOS_CPPFLAGS=`$PKG_CONFIG geos --cflags` ++ GEOS_PKGCONFIG=yes ++ GEOS_CONFIG_SRC="$PKG_CONFIG geos" ++ ], [ ++ AC_MSG_RESULT([checking for geos-config on the path...]) ++ ++ ]) ++ fi ++ ++ if test -z "$GEOS_PKGCONFIG"; then ++ dnl pkg-config failed, so try to use geos-config from path ++ AC_PATH_PROG([GEOSCONFIG], [geos-config]) ++ if test -z "$GEOSCONFIG"; then ++ AC_MSG_ERROR([could not find geos-config on the current path, try using the --with-geosconfig parameter.]) + else +- AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist]) ++ GEOS_VERSION=`$GEOSCONFIG --version` ++ GEOS_LDFLAGS=`$GEOSCONFIG --clibs` ++ GEOS_CPPFLAGS=`$GEOSCONFIG --cflags` ++ GEOS_CONFIG_SRC="$GEOSCONFIG" + fi + fi + fi + +-dnl Extract the version information from geos_config +-dnl Note: we extract the major & minor separately, ensure they are numeric, +-dnl and then combine to give the final version. +-dnl This is to guard against user error... +-GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'` +-GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'` +-GEOS_PATCH_VERSION=`$GEOSCONFIG --version | cut -d. -f3 | sed 's/[[^0-9]]//g'` +-if test "x$GEOS_PATCH_VERSION" = "x"; then +- GEOS_PATCH_VERSION="0"; +-fi +-GEOS_FULL_VERSION=`$GEOSCONFIG --version` +-GEOS_NUMERIC_PATCH_VERSION=`printf "%02d" $GEOS_PATCH_VERSION` +-GEOS_NUMERIC_MINOR_VERSION=`printf "%02d" $GEOS_MINOR_VERSION` +-POSTGIS_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_NUMERIC_MINOR_VERSION$GEOS_NUMERIC_PATCH_VERSION" +- +-dnl Ensure that we are using GEOS >= 3.6.0 +-AC_MSG_RESULT([checking GEOS version... $GEOS_FULL_VERSION]) +-if test ! "$POSTGIS_GEOS_VERSION" -ge 30600; then +- AC_MSG_ERROR([PostGIS requires GEOS >= 3.6.0]) ++dnl ++dnl Convert human form (3.1.12) of version ++dnl to numeric form (30112) for version checking ++dnl ++POSTGIS_GEOS_VERSION=`echo $GEOS_VERSION | $PERL -nle 'printf "%d%02d%02d\n",$1,$2,$3 if /(\d+)\.(\d+)\.(\d+)/'` ++ ++AC_MSG_CHECKING([GEOS version]) ++AC_MSG_RESULT([$GEOS_VERSION]) ++ ++AC_MSG_CHECKING([GEOS numeric version]) ++AC_MSG_RESULT([$POSTGIS_GEOS_VERSION]) ++ ++AC_MSG_CHECKING([GEOS link flags]) ++AC_MSG_RESULT([$GEOS_LDFLAGS]) ++ ++AC_MSG_CHECKING([GEOS compile flags]) ++AC_MSG_RESULT([$GEOS_CPPFLAGS]) ++ ++dnl Ensure that we are using GEOS >= GEOS_MIN_VERSION ++AC_MSG_CHECKING([GEOS version is supported]) ++if test "$POSTGIS_GEOS_VERSION" -ge "$GEOS_MIN_VERSION_NUMERIC"; then ++ AC_MSG_RESULT([yes]) ++else ++ AC_MSG_ERROR([PostGIS requires GEOS >= $GEOS_MIN_VERSION]) + fi + + # +@@ -780,12 +827,6 @@ case $host_os in + ;; + esac + +-dnl Extract the linker and include flags +-GEOS_LDFLAGS=`$GEOSCONFIG --clibs` +-GEOS_CPPFLAGS=`$GEOSCONFIG --cflags` +-AC_SUBST([GEOS_LDFLAGS]) +-AC_SUBST([GEOS_CPPFLAGS]) +- + dnl Ensure that we can parse geos_c.h + CPPFLAGS_SAVE="$CPPFLAGS" + CPPFLAGS="$GEOS_CPPFLAGS" +@@ -803,6 +844,8 @@ LIBS="$LIBS_SAVE" + + AC_DEFINE_UNQUOTED([POSTGIS_GEOS_VERSION], [$POSTGIS_GEOS_VERSION], [GEOS library version]) + AC_SUBST([POSTGIS_GEOS_VERSION]) ++AC_SUBST([GEOS_LDFLAGS]) ++AC_SUBST([GEOS_CPPFLAGS]) + + + dnl =========================================================================== +@@ -928,7 +971,7 @@ elif test ! -z "$PKG_CONFIG"; then + [ + PROJ_CPPFLAGS="$PROJ_CFLAGS" + PROJ_LDFLAGS="$PROJ_LIBS" +- POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\1\2/'` ++ POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | $PERL -nle 'print "$1$2" if /(\d+)\.(\d+)\.(\d+)/'` + ], + [ + PROJ_LDFLAGS="-lproj" +@@ -1076,7 +1119,7 @@ if test "$CHECK_PROTOBUF" != "no"; then + + CPPFLAGS_SAVE="$CPPFLAGS" + LDFLAGS_SAVE="$LDFLAGS" +- LIBS_SAVE="$LIBS" ++ LIBS_SAVE="$LIBS" + + dnl Try pkgconfig first + if test -n "$PKG_CONFIG"; then +@@ -1869,8 +1912,8 @@ fi + + AC_MSG_RESULT() + AC_MSG_RESULT([ -------------- Dependencies -------------- ]) +-AC_MSG_RESULT([ GEOS config: ${GEOSCONFIG}]) +-AC_MSG_RESULT([ GEOS version: ${GEOS_FULL_VERSION}]) ++AC_MSG_RESULT([ GEOS config: ${GEOS_CONFIG_SRC}]) ++AC_MSG_RESULT([ GEOS version: ${GEOS_VERSION}]) + if test "x$RASTER" = "xraster"; then + AC_MSG_RESULT([ GDAL config: ${GDAL_CONFIG}]) + AC_MSG_RESULT([ GDAL version: ${GDAL_FULL_VERSION}]) +@@ -1943,7 +1986,7 @@ AC_MSG_RESULT() + + if test "$POSTGIS_GEOS_VERSION" -lt 31200; then + AC_MSG_WARN([ --------- GEOS VERSION WARNING ------------ ]) +-AC_MSG_WARN([ You are building against GEOS ${GEOS_FULL_VERSION}.]) ++AC_MSG_WARN([ You are building against GEOS ${GEOS_VERSION}.]) + AC_MSG_WARN([]) + AC_MSG_WARN([ To take advantage of _all_ the features of ]) + AC_MSG_WARN([ PostGIS, GEOS 3.12.0 or higher is required.]) +-- +2.44.2 + diff --git a/edgedbpkg/pgext/postgis/patches/pgext-postgis__macos-fix-304.patch b/edgedbpkg/pgext/postgis/patches/pgext-postgis__macos-fix-304.patch new file mode 100644 index 00000000..9778a04a --- /dev/null +++ b/edgedbpkg/pgext/postgis/patches/pgext-postgis__macos-fix-304.patch @@ -0,0 +1,62 @@ +From 33167ddb21e17f74cce006e78f743e2b89ca52bd Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Thu, 3 Oct 2024 17:37:17 -0700 +Subject: [PATCH] Fix building on macOS + +topology/Makefile clobbers bindir, which, in turn breaks the +`-bundle_loader` flag set by pgxs.mk. +--- + topology/Makefile.in | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/topology/Makefile.in b/topology/Makefile.in +index be2afd862..9365c94e1 100644 +--- a/topology/Makefile.in ++++ b/topology/Makefile.in +@@ -83,7 +83,7 @@ include $(PGXS) + # Set prefix variables _after_ the include of PGXS + prefix = @prefix@ + exec_prefix = @exec_prefix@ +-bindir = @bindir@ ++my_bindir = @bindir@ + + # Set PERL _after_ the include of PGXS + PERL=@PERL@ +@@ -99,7 +99,7 @@ $(OBJS): ../liblwgeom/.libs/liblwgeom.a ../libpgcommon/libpgcommon.a ../postgis_ + # so that no prefix is included. This allows us to relocate to a temporary + # directory for regression testing. + ifeq ($(REGRESS),1) +- bindir=/bin ++ my_bindir=/bin + pkglibdir=/lib + datadir=/share + datamoduledir=contrib/postgis +@@ -176,20 +176,20 @@ distclean: clean + rm -f Makefile test/Makefile + + installdir: +- mkdir -p $(DESTDIR)$(bindir) ++ mkdir -p $(DESTDIR)$(my_bindir) + + install: install-importer install-exporter + + install-importer: loader/pgtopo_import | installdir +- $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(bindir)/pgtopo_import" ++ $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(my_bindir)/pgtopo_import" + + install-exporter: loader/pgtopo_export | installdir +- $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(bindir)/pgtopo_export" ++ $(LIBTOOL) --mode=install $(INSTALL) $^ "$(DESTDIR)$(my_bindir)/pgtopo_export" + + uninstall: uninstall-importer uninstall-exporter + + uninstall-importer: +- rm -f '$(DESTDIR)$(bindir)/pgtopo_import' ++ rm -f '$(DESTDIR)$(my_bindir)/pgtopo_import' + + uninstall-exporter: +- rm -f '$(DESTDIR)$(bindir)/pgtopo_export' ++ rm -f '$(DESTDIR)$(my_bindir)/pgtopo_export' +-- +2.45.2 + diff --git a/edgedbpkg/pgext/postgis/patches/pgext-postgis__mkdir-p-config-fix.patch b/edgedbpkg/pgext/postgis/patches/pgext-postgis__mkdir-p-config-fix.patch new file mode 100644 index 00000000..e3f0deb9 --- /dev/null +++ b/edgedbpkg/pgext/postgis/patches/pgext-postgis__mkdir-p-config-fix.patch @@ -0,0 +1,94 @@ +From 3c252be7e51d923a60fa87aa1104d809f6f95319 Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Thu, 3 Oct 2024 23:12:22 -0700 +Subject: [PATCH] Fix `make install` with gettext disabled + +--- + configure | 44 +++++++++++++++++++++++++++++++++++++++++++- + configure.ac | 1 + + 2 files changed, 44 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 19bd71236..a2ad1b50b 100755 +--- a/configure ++++ b/configure +@@ -718,7 +718,6 @@ GMSGFMT + MSGFMT + GETTEXT_MACRO_VERSION + USE_NLS +-MKDIR_P + SET_MAKE + HAVE_SFCGAL + SFCGAL +@@ -836,6 +835,7 @@ build_vendor + build_cpu + build + LIBTOOL ++MKDIR_P + INSTALL_DATA + INSTALL_SCRIPT + INSTALL_PROGRAM +@@ -2737,6 +2737,48 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 ++$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } ++if test -z "$MKDIR_P"; then ++ if ${ac_cv_path_mkdir+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_prog in mkdir gmkdir; do ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue ++ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( ++ 'mkdir (GNU coreutils) '* | \ ++ 'mkdir (coreutils) '* | \ ++ 'mkdir (fileutils) '4.1*) ++ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext ++ break 3;; ++ esac ++ done ++ done ++ done ++IFS=$as_save_IFS ++ ++fi ++ ++ test -d ./--version && rmdir ./--version ++ if test "${ac_cv_path_mkdir+set}" = set; then ++ MKDIR_P="$ac_cv_path_mkdir -p" ++ else ++ # As a last resort, use the slow shell script. Don't cache a ++ # value for MKDIR_P within a source directory, because that will ++ # break other packages using the cache if that directory is ++ # removed, or if the value is a relative name. ++ MKDIR_P="$ac_install_sh -d" ++ fi ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 ++$as_echo "$MKDIR_P" >&6; } ++ + + # _LT_PROG_AR + +diff --git a/configure.ac b/configure.ac +index 82fca382f..e55fabe87 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -25,6 +25,7 @@ AH_TEMPLATE([HAVE_ASPRINTF]) + AC_CONFIG_MACRO_DIR([macros]) + AC_CONFIG_AUX_DIR([build-aux]) + AC_PROG_INSTALL ++AC_PROG_MKDIR_P + + dnl Overwrite _LT_PROG_AR + m4_pushdef([_LT_PROG_AR], +-- +2.45.2 + diff --git a/edgedbpkg/pgext/postgis/patches/pgext-postgis__protocc-pkgconfig-304.patch b/edgedbpkg/pgext/postgis/patches/pgext-postgis__protocc-pkgconfig-304.patch new file mode 100644 index 00000000..85342443 --- /dev/null +++ b/edgedbpkg/pgext/postgis/patches/pgext-postgis__protocc-pkgconfig-304.patch @@ -0,0 +1,77 @@ +From de1855185053b924448ba63862c6db999d8b446d Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Mon, 23 Sep 2024 11:37:32 -0700 +Subject: [PATCH] Look for protoc-c in directories provided by `pkg-config` + +--- + configure | 41 +++++++++++++++++++++++++++++++++++++++++ + configure.ac | 1 + + 2 files changed, 42 insertions(+) + +diff --git a/configure b/configure +index 51d5af97c..6b3d2d06b 100755 +--- a/configure ++++ b/configure +@@ -19375,6 +19375,47 @@ $as_echo "yes" >&6; } + PROTOBUF_CPPFLAGS="$PROTOBUFC_CFLAGS"; + PROTOBUF_LDFLAGS="$PROTOBUFC_LIBS"; + PROTOC_VERSION=`$PKG_CONFIG libprotobuf-c --modversion | sed 's/\([0-9]\).*\([0-9]\).*\([0-9]\)/\100\200\3/'` ++ # Extract the first word of "protoc-c", so it can be a program name with args. ++set dummy protoc-c; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_PROTOCC+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PROTOCC in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PROTOCC="$PROTOCC" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++as_dummy="`$PKG_CONFIG --variable=exec_prefix libprotobuf-c`/bin:$PATH" ++for as_dir in $as_dummy ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_PROTOCC="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PROTOCC=$ac_cv_path_PROTOCC ++if test -n "$PROTOCC"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROTOCC" >&5 ++$as_echo "$PROTOCC" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ + + fi + fi +diff --git a/configure.ac b/configure.ac +index 1be18424b..be4c49739 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1128,6 +1128,7 @@ if test "$CHECK_PROTOBUF" != "no"; then + PROTOBUF_CPPFLAGS="$PROTOBUFC_CFLAGS"; + PROTOBUF_LDFLAGS="$PROTOBUFC_LIBS"; + PROTOC_VERSION=`$PKG_CONFIG libprotobuf-c --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\100\200\3/'` ++ AC_PATH_PROG(PROTOCC, protoc-c, [], [`$PKG_CONFIG --variable=exec_prefix libprotobuf-c`/bin:$PATH]) + ], [ + AC_MSG_RESULT([libprotobuf-c not found in pkg-config]) + ]) +-- +2.44.2 + diff --git a/edgedbpkg/pgext/postgis/patches/pgext-postgis__remove-explicit-libstdcpp-link-304.patch b/edgedbpkg/pgext/postgis/patches/pgext-postgis__remove-explicit-libstdcpp-link-304.patch new file mode 100644 index 00000000..f2c7d221 --- /dev/null +++ b/edgedbpkg/pgext/postgis/patches/pgext-postgis__remove-explicit-libstdcpp-link-304.patch @@ -0,0 +1,57 @@ +From cba7d5e60bbc3b892bd50b81b89f6936fd3e52e7 Mon Sep 17 00:00:00 2001 +From: Elvis Pranskevichus +Date: Tue, 24 Sep 2024 22:01:15 -0700 +Subject: [PATCH] Avoid linking with libstdc++ explicitly + +--- + configure | 4 ++-- + configure.ac | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/configure b/configure +index 6b3d2d06b..19bd71236 100755 +--- a/configure ++++ b/configure +@@ -25002,7 +25002,7 @@ fi + if test "x$HAVE_CPP" = "xyes"; then + WAGYU_LDFLAGS="-lc++" + elif test "x$HAVE_STDCPP" = "xyes"; then +- WAGYU_LDFLAGS="-lstdc++" ++ WAGYU_LDFLAGS="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Could not find a C++ standard library\"" >&5 + $as_echo "$as_me: WARNING: \"Could not find a C++ standard library\"" >&2;} +@@ -25749,7 +25749,7 @@ fi + if test "x$HAVE_CPP" = "xyes"; then + FLATGEOBUF_LDFLAGS="-lc++" + elif test "x$HAVE_STDCPP" = "xyes"; then +- FLATGEOBUF_LDFLAGS="-lstdc++" ++ FLATGEOBUF_LDFLAGS="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Could not find a C++ standard library\"" >&5 + $as_echo "$as_me: WARNING: \"Could not find a C++ standard library\"" >&2;} +diff --git a/configure.ac b/configure.ac +index be4c49739..82fca382f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1713,7 +1713,7 @@ if test "x$HAVE_PROTOBUF" = "xyes"; then + if test "x$HAVE_CPP" = "xyes"; then + WAGYU_LDFLAGS="-lc++" + elif test "x$HAVE_STDCPP" = "xyes"; then +- WAGYU_LDFLAGS="-lstdc++" ++ WAGYU_LDFLAGS="" + else + AC_MSG_WARN("Could not find a C++ standard library") + WAGYU_LDFLAGS="" +@@ -1786,7 +1786,7 @@ AC_CHECK_LIB(stdc++, main, [HAVE_STDCPP=yes], [HAVE_STDCPP=no]) + if test "x$HAVE_CPP" = "xyes"; then + FLATGEOBUF_LDFLAGS="-lc++" + elif test "x$HAVE_STDCPP" = "xyes"; then +- FLATGEOBUF_LDFLAGS="-lstdc++" ++ FLATGEOBUF_LDFLAGS="" + else + AC_MSG_WARN("Could not find a C++ standard library") + FLATGEOBUF_LDFLAGS="" +-- +2.45.2 + diff --git a/edgedbpkg/postgresql/__init__.py b/edgedbpkg/postgresql/__init__.py index f7391bcd..5d46db01 100644 --- a/edgedbpkg/postgresql/__init__.py +++ b/edgedbpkg/postgresql/__init__.py @@ -13,7 +13,7 @@ from edgedbpkg import icu, libuuid, openssl, zlib -class PostgreSQL(packages.BundledCPackage): +class PostgreSQL(packages.BundledCAutoconfPackage): title = "PostgreSQL" name = packages.canonicalize_name("postgresql-edgedb") group = "Applications/Databases" @@ -90,7 +90,11 @@ def get_patches(self) -> dict[str, list[tuple[str, str]]]: return patches - def get_configure_script(self, build: targets.Build) -> str: + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: extra_version = "" system = platform.system() @@ -102,15 +106,7 @@ def get_configure_script(self, build: targets.Build) -> str: else: raise NotImplementedError(f"unsupported target system: {system}") - sdir = build.get_source_dir(self, relative_to="pkgbuild") - configure = sdir / "configure" - - configure_flags: dict[str, str | pathlib.Path | None] = { - "--sysconfdir": build.get_install_path("sysconf"), - "--datarootdir": build.get_install_path("data"), - "--bindir": build.get_install_path("bin"), - "--libdir": build.get_install_path("lib"), - "--includedir": build.get_install_path("include"), + conf_args = super().get_configure_args(build, wd=wd) | { "--with-extra-version": extra_version, "--with-icu": None, "--without-pam": None, @@ -119,17 +115,12 @@ def get_configure_script(self, build: targets.Build) -> str: "--without-readline": None, } - self.configure_dependency(build, configure_flags, "icu", "ICU") - self.configure_dependency(build, configure_flags, "uuid", "UUID") - self.configure_dependency(build, configure_flags, "zlib", "ZLIB") - self.configure_dependency(build, configure_flags, "openssl", "OPENSSL") - if build.target.has_capability("tzdata"): zoneinfo = build.target.get_resource_path(build, "tzdata") - configure_flags["--with-system-tzdata"] = zoneinfo + conf_args["--with-system-tzdata"] = zoneinfo if build.target.has_capability("systemd"): - configure_flags["--with-systemd"] = None + conf_args["--with-systemd"] = None if ( build.extra_optimizations_enabled() @@ -137,7 +128,7 @@ def get_configure_script(self, build: targets.Build) -> str: and build.uses_modern_gcc() ): build.sh_append_flags( - configure_flags, + conf_args, "CFLAGS", ( "-flto", @@ -147,36 +138,40 @@ def get_configure_script(self, build: targets.Build) -> str: ), ) - return self.sh_configure(build, configure, configure_flags) + return conf_args def get_build_script(self, build: targets.Build) -> str: - make = build.sh_get_command("make") - - return textwrap.dedent( - f"""\ - {make} - {make} -C contrib - {make} DESTDIR=$(pwd)/_install install - {make} -C contrib DESTDIR=$(pwd)/_install install - """ + args = self.get_make_args(build) + ddir = '!"${_wd}"/_install' + return "\n".join( + [ + self.get_build_command(build, args), + self.get_build_command( + build, args | {"--directory": "contrib"} + ), + self.get_build_command( + build, args | {"DESTDIR": ddir}, "install" + ), + self.get_build_command( + build, + args | {"--directory": "contrib", "DESTDIR": ddir}, + "install", + ), + ] ) def get_build_install_script(self, build: targets.Build) -> str: script = super().get_build_install_script(build) - installdest = build.get_install_dir(self, relative_to="pkgbuild") - make = build.sh_get_command("make") - - return script + textwrap.dedent( - f"""\ - {make} DESTDIR=$(pwd)/"{installdest}" -C contrib install - """ - ) + args = self.get_make_install_args(build) | {"--directory": "contrib"} + script += "\n" + self.get_build_install_command(build, args, "install") + return script def get_build_tools(self, build: targets.Build) -> dict[str, pathlib.Path]: - bindir = build.get_install_path("bin").relative_to("/") - datadir = build.get_install_path("data") - libdir = build.get_install_path("lib") - includedir = build.get_install_path("include") + bindir = build.get_install_path(self, "bin").relative_to("/") + datadir = build.get_install_path(self, "data") + docdir = build.get_install_path(self, "doc") + libdir = build.get_install_path(self, "lib") + includedir = build.get_install_path(self, "include") builddir_hlp = build.get_build_dir(self, relative_to="helpers") # Since we are using a temporary Postgres installation, @@ -202,14 +197,18 @@ def get_build_tools(self, build: targets.Build) -> dict[str, pathlib.Path]: for line in proc.stdout.split('\\n'): if ('{datadir}' in line or + '{docdir}' in line or ('{libdir}' in line and 'pgxs' not in line)): line = line.replace(str(path), '') print(line) """ ) - wrapper_cmd = build.write_helper( - "pg_config_wrapper.py", wrapper, relative_to="sourceroot" + wrapper_cmd = build.sh_write_python_helper( + "pg_config_wrapper.py", + wrapper, + relative_to="pkgbuild", + helper_path_relative_to="sourceroot", ) # Same, but for install-time, so includes more paths @@ -232,6 +231,7 @@ def get_build_tools(self, build: targets.Build) -> dict[str, pathlib.Path]: for line in proc.stdout.split('\\n'): if ('{datadir}' in line or + '{docdir}' in line or '{includedir}' in line or ('{libdir}' in line and 'pgxs' not in line)): line = line.replace(str(path), '') @@ -239,11 +239,19 @@ def get_build_tools(self, build: targets.Build) -> dict[str, pathlib.Path]: """ ) - install_wrapper_cmd = build.write_helper( - "pg_config_install_wrapper.py", wrapper, relative_to="sourceroot" + install_wrapper_cmd = build.sh_write_python_helper( + "pg_config_install_wrapper.py", + wrapper, + relative_to="pkgbuild", + helper_path_relative_to="sourceroot", ) return { - "pg_config": wrapper_cmd, - "pg_config_install": install_wrapper_cmd, + "pg_config": pathlib.Path(wrapper_cmd), + "pg_config_install": pathlib.Path(install_wrapper_cmd), } + + def get_shlibs(self, build: targets.Build) -> list[str]: + return [ + "pq", + ] diff --git a/edgedbpkg/postgresql/ignore.list b/edgedbpkg/postgresql/ignore.list index d8367074..b465f7b8 100644 --- a/edgedbpkg/postgresql/ignore.list +++ b/edgedbpkg/postgresql/ignore.list @@ -5,5 +5,5 @@ {libdir}/postgresql/pgxs {libdir}/postgresql/pgxs/** {includedir}/**/*.h -{datadir}/doc/postgresql -{datadir}/doc/postgresql/** +{docdir}/postgresql +{docdir}/postgresql/** diff --git a/edgedbpkg/postgresql/patches/postgresql-edgedb__pkgconfig-16.patch b/edgedbpkg/postgresql/patches/postgresql-edgedb__pkgconfig-16.patch index 7852230d..4274cb4d 100644 --- a/edgedbpkg/postgresql/patches/postgresql-edgedb__pkgconfig-16.patch +++ b/edgedbpkg/postgresql/patches/postgresql-edgedb__pkgconfig-16.patch @@ -1,7 +1,7 @@ -From 703463c8ff99e003b08f6ec0bab746ccf0eb0f93 Mon Sep 17 00:00:00 2001 +From cd9ca68583a77db766a9ca2b4a5b7de775ee42d1 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Mon, 11 Feb 2019 20:28:00 -0500 -Subject: [PATCH 5/5] Use pkg-config for libuuid, openssl and zlib +Subject: [PATCH] Use pkg-config for libuuid, openssl and zlib --- configure | 650 +++++++++++++++++++++++++++++-- @@ -19,7 +19,7 @@ Subject: [PATCH 5/5] Use pkg-config for libuuid, openssl and zlib 12 files changed, 755 insertions(+), 35 deletions(-) diff --git a/configure b/configure -index 7279c98da0..ca58d52b07 100755 +index 6140a5988f..748b081c40 100755 --- a/configure +++ b/configure @@ -652,9 +652,14 @@ OPENSSL @@ -362,7 +362,7 @@ index 7279c98da0..ca58d52b07 100755 if test "$PORTNAME" != "win32"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_new_ex_data in -lcrypto" >&5 $as_echo_n "checking for CRYPTO_new_ex_data in -lcrypto... " >&6; } -@@ -13023,6 +13293,10 @@ done +@@ -13024,6 +13294,10 @@ done $as_echo "#define USE_OPENSSL 1" >>confdefs.h @@ -373,7 +373,7 @@ index 7279c98da0..ca58d52b07 100755 elif test "$with_ssl" != no ; then as_fn_error $? "--with-ssl must specify openssl" "$LINENO" 5 fi -@@ -13521,14 +13795,85 @@ else +@@ -13522,14 +13796,85 @@ else fi elif test "$with_uuid" = e2fs ; then @@ -466,7 +466,7 @@ index 7279c98da0..ca58d52b07 100755 $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -@@ -13542,34 +13887,279 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +@@ -13543,34 +13888,279 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif @@ -755,7 +755,7 @@ index 7279c98da0..ca58d52b07 100755 elif test "$with_uuid" = ossp ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_export in -lossp-uuid" >&5 $as_echo_n "checking for uuid_export in -lossp-uuid... " >&6; } -@@ -13925,6 +14515,8 @@ done +@@ -13926,6 +14516,8 @@ done fi if test "$with_zlib" = yes; then @@ -764,7 +764,7 @@ index 7279c98da0..ca58d52b07 100755 ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : -@@ -13936,6 +14528,7 @@ Use --without-zlib to disable zlib support." "$LINENO" 5 +@@ -13937,6 +14529,7 @@ Use --without-zlib to disable zlib support." "$LINENO" 5 fi @@ -772,7 +772,7 @@ index 7279c98da0..ca58d52b07 100755 fi if test -z "$LZ4"; then -@@ -14183,6 +14776,8 @@ pgac_openssl_version="$($OPENSSL version 2> /dev/null || echo openssl not found) +@@ -14184,6 +14777,8 @@ pgac_openssl_version="$($OPENSSL version 2> /dev/null || echo openssl not found) { $as_echo "$as_me:${as_lineno-$LINENO}: using openssl: $pgac_openssl_version" >&5 $as_echo "$as_me: using openssl: $pgac_openssl_version" >&6;} if test "$with_ssl" = openssl ; then @@ -781,7 +781,7 @@ index 7279c98da0..ca58d52b07 100755 ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default" if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : -@@ -14199,6 +14794,7 @@ else +@@ -14200,6 +14795,7 @@ else fi @@ -789,7 +789,7 @@ index 7279c98da0..ca58d52b07 100755 fi if test "$with_pam" = yes ; then -@@ -14352,6 +14948,9 @@ fi +@@ -14353,6 +14949,9 @@ fi fi @@ -799,7 +799,7 @@ index 7279c98da0..ca58d52b07 100755 # for contrib/uuid-ossp if test "$with_uuid" = bsd ; then for ac_header in uuid.h -@@ -14486,6 +15085,8 @@ done +@@ -14487,6 +15086,8 @@ done fi @@ -808,7 +808,7 @@ index 7279c98da0..ca58d52b07 100755 if test "$PORTNAME" = "win32" ; then for ac_header in crtdefs.h do : -@@ -15221,6 +15822,8 @@ if test "$with_zlib" = yes; then +@@ -15222,6 +15823,8 @@ if test "$with_zlib" = yes; then # Check that defines z_streamp (versions before about 1.0.4 # did not). While we could work around the lack of z_streamp, it # seems unwise to encourage people to use such old zlib versions... @@ -817,7 +817,7 @@ index 7279c98da0..ca58d52b07 100755 ac_fn_c_check_type "$LINENO" "z_streamp" "ac_cv_type_z_streamp" "#include " if test "x$ac_cv_type_z_streamp" = xyes; then : -@@ -15230,6 +15833,7 @@ else +@@ -15231,6 +15834,7 @@ else Use --without-zlib to disable zlib support." "$LINENO" 5 fi @@ -826,7 +826,7 @@ index 7279c98da0..ca58d52b07 100755 case $host_cpu in diff --git a/configure.ac b/configure.ac -index e50ef69f82..d6338ec1c0 100644 +index 7c5c221474..e4cde96ce7 100644 --- a/configure.ac +++ b/configure.ac @@ -1321,11 +1321,39 @@ Use --without-readline to disable readline support.]) @@ -892,7 +892,7 @@ index e50ef69f82..d6338ec1c0 100644 AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])]) @@ -1393,6 +1429,10 @@ if test "$with_ssl" = openssl ; then # Function introduced in OpenSSL 1.1.1. - AC_CHECK_FUNCS([X509_get_signature_info]) + AC_CHECK_FUNCS([X509_get_signature_info SSL_CTX_set_num_tickets]) AC_DEFINE([USE_OPENSSL], 1, [Define to 1 to build with OpenSSL support. (--with-ssl=openssl)]) + + CPPFLAGS=$pgac_save_CPPFLAGS @@ -1070,7 +1070,7 @@ index f15ca4fd85..12dc768fc3 100644 ifdef PGXS override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS) diff --git a/src/backend/Makefile b/src/backend/Makefile -index 3c42003175..7812d064ed 100644 +index 82cae98a44..229e9f0872 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -44,8 +44,8 @@ OBJS = \ @@ -1138,7 +1138,7 @@ index 372f8e4d7c..d8b6dac2ac 100644 OBJS_COMMON += \ cryptohash.o \ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in -index c2e27b5416..71d67895d5 100644 +index 01770a0730..1ff8954b7f 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -289,7 +289,7 @@ @@ -1163,5 +1163,5 @@ index 0919d8f32f..e0e70ce5e6 100644 ifeq ($(with_gssapi),yes) -- -2.43.0 +2.45.2 diff --git a/edgedbpkg/protobuf/__init__.py b/edgedbpkg/protobuf/__init__.py new file mode 100644 index 00000000..7e3026f4 --- /dev/null +++ b/edgedbpkg/protobuf/__init__.py @@ -0,0 +1,75 @@ +from __future__ import annotations + +from metapkg import packages +from metapkg import targets + +from edgedbpkg import libabseil +from edgedbpkg import libjsoncpp +from edgedbpkg import zlib + + +class ProtoBuf(packages.BundledCMakePackage): + title = "protobuf" + name = packages.canonicalize_name("protobuf") + + _server = "https://github.com/protocolbuffers/protobuf/releases/download/" + + sources = [ + { + "url": _server + "v{version}/protobuf-{version}.tar.gz", + }, + ] + + artifact_requirements = [ + "libabsl (>=20230802.0)", + "libjsoncpp (>=1.7.4)", + "zlib", + ] + + artifact_build_requirements = [ + "libabsl-dev (>=20230802.0)", + "libjsoncpp-dev (>=1.7.4)", + "zlib-dev", + ] + + _libabseil = libabseil.LibAbseil("20240722.0") + + bundle_deps = [ + _libabseil, + libjsoncpp.LibJsonCpp("1.9.6"), + zlib.Zlib("1.3.1"), + ] + + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + sdir = build.get_source_dir(self, relative_to="pkgbuild") + return super().get_configure_args(build, wd=wd) | { + "-Dprotobuf_BUILD_CONFORMANCE": "no", + "-Dprotobuf_BUILD_EXAMPLES": "no", + "-Dprotobuf_BUILD_LIBPROTOC": "yes", + "-Dprotobuf_BUILD_LIBUPB": "no", + "-Dprotobuf_BUILD_PROTOBUF_BINARIES": "yes", + "-Dprotobuf_BUILD_PROTOC_BINARIES": "yes", + "-Dprotobuf_BUILD_SHARED_LIBS": "yes", + "-Dprotobuf_BUILD_TESTS": "no", + "-Dprotobuf_DISABLE_RTTI": "no", + "-Dprotobuf_INSTALL": "yes", + "-Dprotobuf_INSTALL_EXAMPLES": "no", + "-Dprotobuf_TEST_XML_OUTDIR": "no", + "-Dprotobuf_WITH_ZLIB": "yes", + "-Dprotobuf_VERBOSE": "no", + "-DCMAKE_MODULE_PATH": f"{sdir}/cmake", + "-Dprotobuf_ABSL_PROVIDER": "package", + } + + def get_shlibs(self, build: targets.Build) -> list[str]: + # pkg-config files' LDFLAGS omit various -labsl deps, + # which makes dependencies of protobuf fail to link correctly. + # work around that by pretending that libabsl is bundled here. + return [ + "protobuf", + "protoc", + ] + self._libabseil.get_shlibs(build) diff --git a/edgedbpkg/protobuf/install.list b/edgedbpkg/protobuf/install.list new file mode 100644 index 00000000..5cf09c04 --- /dev/null +++ b/edgedbpkg/protobuf/install.list @@ -0,0 +1 @@ +{libdir}/** diff --git a/edgedbpkg/protobuf/no_install.list b/edgedbpkg/protobuf/no_install.list new file mode 100644 index 00000000..d1f081ea --- /dev/null +++ b/edgedbpkg/protobuf/no_install.list @@ -0,0 +1,14 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{bindir} +{bindir}/* +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/protoc_c/__init__.py b/edgedbpkg/protoc_c/__init__.py new file mode 100644 index 00000000..bc3e9e71 --- /dev/null +++ b/edgedbpkg/protoc_c/__init__.py @@ -0,0 +1,34 @@ +from __future__ import annotations + +from metapkg import packages + +from edgedbpkg import protobuf + + +class ProtoCompilerC(packages.BundledCAutoconfPackage): + title = "protoc-c" + name = packages.canonicalize_name("protoc-c") + + _server = "https://github.com/protobuf-c/protobuf-c/releases/download/" + + sources = [ + { + "url": _server + "v{version}/protobuf-c-{version}.tar.gz", + }, + ] + + artifact_requirements = [ + "protobuf (>=3)", + ] + + artifact_build_requirements = [ + "protobuf (>=3)", + ] + + bundle_deps = [ + protobuf.ProtoBuf("28.2"), + ] + + @property + def provides_build_tools(cls) -> bool: + return True diff --git a/edgedbpkg/protoc_c/install.list b/edgedbpkg/protoc_c/install.list new file mode 100644 index 00000000..80b01f0b --- /dev/null +++ b/edgedbpkg/protoc_c/install.list @@ -0,0 +1,2 @@ +{libdir}/** +{bindir}/** diff --git a/edgedbpkg/protoc_c/no_install.list b/edgedbpkg/protoc_c/no_install.list new file mode 100644 index 00000000..09ba5abe --- /dev/null +++ b/edgedbpkg/protoc_c/no_install.list @@ -0,0 +1,12 @@ +{libdir}/pkgconfig +{libdir}/pkgconfig/** +{libdir}/*.a +{libdir}/*.la +{libdir}/cmake +{libdir}/cmake/** +{includedir} +{includedir}/** +{mandir} +{mandir}/** +{docdir} +{docdir}/** diff --git a/edgedbpkg/protoc_c/patches/protoc-c__build_fixes.patch b/edgedbpkg/protoc_c/patches/protoc-c__build_fixes.patch new file mode 100644 index 00000000..38a36b50 --- /dev/null +++ b/edgedbpkg/protoc_c/patches/protoc-c__build_fixes.patch @@ -0,0 +1,117 @@ +From a6cf1aa386067e26d582cc1d1e327787595c9f13 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Wed, 20 Mar 2024 21:48:10 -0400 +Subject: [PATCH 01/11] FileGenerator::GenerateHeader(): Set + `min_header_version` unconditionally + +Previously, we were conditionally trying to set `min_header_version` to +the lowest possible value, and relying on a "legacy" Google interface to +determine the file descriptor's syntax version as part of that +determination. + +Instead, simply bump the minimum version to 1003000 (1.3.0). This +release was almost 7 years ago. In practice protobuf-c users should not +be shipping pre-compiled .pb-c.c/.pb-c.h files, anyway. +--- + protoc-c/c_file.cc | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc +index ca0ad34e..c6d8a240 100644 +--- a/protoc-c/c_file.cc ++++ b/protoc-c/c_file.cc +@@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {} + void FileGenerator::GenerateHeader(io::Printer* printer) { + std::string filename_identifier = FilenameIdentifier(file_->name()); + +- int min_header_version = 1000000; +-#if GOOGLE_PROTOBUF_VERSION >= 4023000 +- if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) { +-#else +- if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) { +-#endif +- min_header_version = 1003000; +- } ++ const int min_header_version = 1003000; + + // Generate top of header. + printer->Print( + +From ee3d9e5423c93ee6b828fdda8e7fef13a77634eb Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Wed, 20 Mar 2024 22:25:54 -0400 +Subject: [PATCH 02/11] Reimplement FieldSyntax() to maximize compatibility + across protobuf versions + +Recent versions of Google protobuf have broken the interfaces for +determining the syntax version of a .proto file. The current protobuf-c +1.5.0 release does not compile with Google protobuf 26.0 due to the most +recentage breakage. There is a possible workaround involving the Google +protobuf `FileDescriptorLegacy` class, which is documented as: + +// TODO Remove this deprecated API entirely. + +So we probably shouldn't rely on it. + +Instead, this commit obtains the `FileDescriptorProto` corresponding +to the passed in `FieldDescriptor` and interrogates the `syntax` field +directly. This is a single implementation with no version-specific +workarounds. Hopefully this won't break in the next Google protobuf +release. + +I tested the `FieldSyntax()` implementation in this commit across a +number of different Google protobuf releases and found that it worked +(`make && make check`) on all of them: + +- Google protobuf 3.6.1.3 (Ubuntu 20.04) +- Google protobuf 3.12.4 (Ubuntu 22.04) +- Google protobuf 3.21.12 (Debian 12 + Debian unstable) +- Google protobuf 3.25.2 (Debian experimental) +- Google protobuf 26.1-dev +--- + protoc-c/c_helpers.h | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h +index 062d330b..be28b601 100644 +--- a/protoc-c/c_helpers.h ++++ b/protoc-c/c_helpers.h +@@ -70,10 +70,6 @@ + #include + #include + +-#if GOOGLE_PROTOBUF_VERSION >= 4023000 +-# include +-#endif +- + namespace google { + namespace protobuf { + namespace compiler { +@@ -173,13 +169,21 @@ struct NameIndex + int compare_name_indices_by_name(const void*, const void*); + + // Return the syntax version of the file containing the field. +-// This wrapper is needed to be able to compile against protobuf2. + inline int FieldSyntax(const FieldDescriptor* field) { +-#if GOOGLE_PROTOBUF_VERSION >= 4023000 +- return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2; +-#else +- return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2; +-#endif ++ auto proto = FileDescriptorProto(); ++ field->file()->CopyTo(&proto); ++ ++ if (proto.has_syntax()) { ++ auto syntax = proto.syntax(); ++ assert(syntax == "proto2" || syntax == "proto3"); ++ if (syntax == "proto2") { ++ return 2; ++ } else if (syntax == "proto3") { ++ return 3; ++ } ++ } ++ ++ return 2; + } + + // Work around changes in protobuf >= 22.x without breaking compilation against diff --git a/edgedbpkg/python/__init__.py b/edgedbpkg/python/__init__.py index 3ad2cfa6..756133eb 100644 --- a/edgedbpkg/python/__init__.py +++ b/edgedbpkg/python/__init__.py @@ -1,7 +1,4 @@ from __future__ import annotations -from typing import ( - Mapping, -) import pathlib import platform @@ -20,7 +17,7 @@ from edgedbpkg import zlib -class Python(packages.BundledCPackage): +class Python(packages.BundledCAutoconfPackage): title = "Python" name = packages.canonicalize_name("python-edgedb") @@ -35,6 +32,7 @@ class Python(packages.BundledCPackage): artifact_requirements = [ "openssl (>=1.1.1)", "libb2 (>=0.98.1)", + "libffi (>=3.0.13)", "uuid", "zlib", ] @@ -80,18 +78,12 @@ def get_patches(self) -> dict[str, list[tuple[str, str]]]: return patches - def get_configure_script(self, build: targets.Build) -> str: - sdir = build.get_source_dir(self, relative_to="pkgbuild") - - configure = sdir / "configure" - - configure_flags = { - "--prefix": build.get_full_install_prefix(), - "--sysconfdir": build.get_install_path("sysconf"), - "--datarootdir": build.get_install_path("data"), - "--bindir": build.get_install_path("bin"), - "--libdir": build.get_install_path("lib"), - "--includedir": build.get_install_path("include"), + def get_configure_args( + self, + build: targets.Build, + wd: str | None = None, + ) -> packages.Args: + conf_args = super().get_configure_args(build, wd=wd) | { "--enable-ipv6": None, "--with-dbmliborder": "bdb:gdbm", "--with-computed-gotos": None, @@ -99,12 +91,12 @@ def get_configure_script(self, build: targets.Build) -> str: if build.extra_optimizations_enabled(): if build.supports_pgo(): - configure_flags["--enable-optimizations"] = None + conf_args["--enable-optimizations"] = None if build.supports_lto(): - configure_flags["--with-lto"] = None + conf_args["--with-lto"] = None if build.uses_modern_gcc(): build.sh_append_flags( - configure_flags, + conf_args, "CFLAGS", ("-fno-semantic-interposition",), ) @@ -114,65 +106,46 @@ def get_configure_script(self, build: targets.Build) -> str: # low to support the default recursion limit. # See https://github.com/python/cpython/issues/76488 build.sh_append_flags( - configure_flags, + conf_args, "LDFLAGS", ("-Wl,-z,stack-size=1000000",), ) if platform.system() == "Darwin": - configure_flags["--enable-universalsdk"] = ( - "!$(xcrun --show-sdk-path)" - ) + conf_args["--enable-universalsdk"] = "!$(xcrun --show-sdk-path)" arch = build.target.machine_architecture if arch == "x86_64": - configure_flags["--with-universal-archs"] = "intel-64" + conf_args["--with-universal-archs"] = "intel-64" elif arch == "aarch64": - configure_flags["--with-universal-archs"] = "arm-64" + conf_args["--with-universal-archs"] = "arm-64" else: raise RuntimeError(f"unexpected architecture: {arch}") - self.configure_dependency(build, configure_flags, "libffi", "LIBFFI") libffi_pkg = build.get_package("libffi") if not build.is_bundled(libffi_pkg): # This is somewhat confusing, but Python treats # --without-system-ffi on macOS as instruction to actually # _use_ the native system libffi (as opposed to pkg-config), # and ignores this option on other platforms. - configure_flags["--without-system-ffi"] = None + conf_args["--without-system-ffi"] = None openssl_pkg = build.get_package("openssl") if build.is_bundled(openssl_pkg): - openssl_path = build.get_install_dir( - openssl_pkg, relative_to="pkgbuild" + build.sh_replace_quoted_paths( + conf_args, + "--with-openssl", + build.sh_get_bundled_install_path(openssl_pkg, wd=wd), ) - openssl_path /= build.get_full_install_prefix().relative_to("/") - configure_flags["--with-openssl"] = openssl_path - configure_flags["--with-openssl-rpath"] = ( - openssl_pkg.get_shlib_paths(build)[0] + build.sh_replace_paths( + conf_args, + "--with-openssl-rpath", + build.get_install_path(openssl_pkg, "lib"), ) - self.configure_dependency(build, configure_flags, "uuid", "LIBUUID") - self.configure_dependency(build, configure_flags, "zlib", "ZLIB") - self.configure_dependency(build, configure_flags, "libb2", "LIBB2") - - return build.sh_configure(configure, configure_flags) - - def get_make_env(self, build: targets.Build, wd: str) -> str: - env = super().get_make_env(build, wd) - openssl_pkg = build.get_package("openssl") - libffi_pkg = build.get_package("libffi") - libb2_pkg = build.get_package("libb2") - uuid_pkg = build.get_package("uuid") - zlib_pkg = build.get_package("zlib") - ld_env = build.get_ld_env( - [openssl_pkg, libffi_pkg, uuid_pkg, zlib_pkg, libb2_pkg], wd - ) - return env + " ".join(ld_env) + return conf_args def get_build_script(self, build: targets.Build) -> str: - make = build.sh_get_command("make") - - prefix = build.get_full_install_prefix().relative_to("/") + prefix = build.get_rel_install_prefix(self) dest = build.get_temp_root(relative_to="pkgbuild") if platform.system() == "Darwin": @@ -188,7 +161,11 @@ def get_build_script(self, build: targets.Build) -> str: python = f"python{exe_suffix}" - wrapper_env = self.get_make_env(build, "${d}") + wrapper_env = build.sh_format_args( + self.get_build_env(build, wd="${d}"), + force_args_eq=True, + linebreaks=False, + ) bash = build.sh_get_command("bash") make_wrapper = textwrap.dedent( @@ -227,7 +204,7 @@ def get_build_script(self, build: targets.Build) -> str: "spwd", ] - make_env = self.get_make_env(build, "$(pwd)") + make = self.get_build_command(build, self.get_make_args(build)) return textwrap.dedent( f"""\ @@ -240,26 +217,29 @@ def get_build_script(self, build: targets.Build) -> str: # make sure config.c is regenerated reliably by make rm Modules/config.c ls -al Modules/ - {make} {make_env} + _wd=$(pwd -P) + {make} ./{python} -m ensurepip --root "{dest}" {make_wrapper}""" ) - def get_make_install_env(self, build: targets.Build, wd: str) -> str: - env = super().get_make_install_env(build, wd) - return f"{env} ENSUREPIP=no" + def get_build_install_env( + self, build: targets.Build, wd: str + ) -> packages.Args: + return super().get_build_install_env(build, wd=wd) | { + "ENSUREPIP": "no", + } def get_make_install_args( self, build: targets.Build, - ) -> Mapping[str, str | pathlib.Path | None]: - args = dict(super().get_make_args(build)) - args["-j"] = "1" - return args + ) -> packages.Args: + # Python's make install isn't thread-safe + return super().get_make_args(build) | {"-j1": None} def get_build_install_script(self, build: targets.Build) -> str: script = super().get_build_install_script(build) - installdest = build.get_install_dir(self, relative_to="pkgbuild") + installdest = build.get_build_install_dir(self, relative_to="pkgbuild") openssl_pkg = build.get_package("openssl") if build.is_bundled(openssl_pkg): @@ -286,7 +266,7 @@ def get_build_install_script(self, build: targets.Build) -> str: else: extra_install = "" - bin_dir = build.get_install_path("bin") + bin_dir = build.get_install_path(self, "bin") minorv = self.version.minor extra_install += textwrap.dedent( f"""\ diff --git a/edgedbpkg/python/ignore.list b/edgedbpkg/python/ignore.list index 992d40dd..cfc0eefa 100644 --- a/edgedbpkg/python/ignore.list +++ b/edgedbpkg/python/ignore.list @@ -2,4 +2,5 @@ {includedir}/python*/*.h {includedir}/python*/cpython/*.h {includedir}/python*/internal/*.h -{datadir}/man/man*/* +{mandir} +{mandir}/** diff --git a/edgedbpkg/zlib/__init__.py b/edgedbpkg/zlib/__init__.py index 4c00f007..e0bd7ba6 100644 --- a/edgedbpkg/zlib/__init__.py +++ b/edgedbpkg/zlib/__init__.py @@ -4,7 +4,7 @@ from metapkg import targets -class Zlib(packages.BundledCPackage): +class Zlib(packages.BundledCMakePackage): title = "zlib" name = packages.canonicalize_name("zlib") aliases = ["zlib-dev"] @@ -17,24 +17,5 @@ class Zlib(packages.BundledCPackage): } ] - def get_configure_script(self, build: targets.Build) -> str: - sdir = build.get_source_dir(self, relative_to="pkgbuild") - configure = sdir / "configure" - - configure_flags = { - "--prefix": str(build.get_full_install_prefix()), - } - - return build.sh_format_command(configure, configure_flags) - - def get_build_script(self, build: targets.Build) -> str: - global_flags = build.sh_append_global_flags() - return build.sh_get_command( - "make", args=global_flags, force_args_eq=True - ) - - def get_license_files_pattern(self) -> str: - return "README" - def get_shlibs(self, build: targets.Build) -> list[str]: return ["z"] diff --git a/integration/linux/build/Dockerfile-centos.template b/integration/linux/build/Dockerfile-centos.template index e9f0c3e1..2c699c7f 100644 --- a/integration/linux/build/Dockerfile-centos.template +++ b/integration/linux/build/Dockerfile-centos.template @@ -1,7 +1,7 @@ FROM centos:%%PLACEHOLDER%% # ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH +ENV PATH /usr/local/bin:/usr/local/cargo/bin:/usr/local/go/bin:$PATH # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. @@ -45,7 +45,7 @@ RUN ulimit -n 1024 \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext glibc-langpack-en \ perl-Getopt-Long perl-IPC-Cmd perl-Data-Dumper \ - sudo ca-certificates + sudo ca-certificates cmake tcl file zip unzip bzip2 %%IF VARIANT=7%% RUN printf "#!/bin/bash\nsource scl_source enable devtoolset-${GCC_VERSION}" \ @@ -67,15 +67,19 @@ ENV RUST_VERSION %%PLACEHOLDER%% ENV NODE_VERSION %%PLACEHOLDER%% ENV YARN_VERSION %%PLACEHOLDER%% ENV CMAKE_VERSION %%PLACEHOLDER%% +ENV GO_VERSION %%PLACEHOLDER%% +ENV NINJA_VERSION 1.12.1 +ENV PKGCONF_VERSION 2.3.0 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && curl -fsSLo git.tar.xz "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ - && curl -fsSLo git.tar.sign "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ + && curl -fsSLo git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ && curl -fsSLo tar.tar.xz "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz" \ && curl -fsSLo tar.tar.xz.sign "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz.sig" \ + && curl -fsSLo pkgconf.tar.xz "https://distfiles.ariadne.space/pkgconf/pkgconf-${PKGCONF_VERSION}.tar.xz" \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -151,6 +155,16 @@ RUN set -ex \ && make prefix=/usr/local V=1 -j $(nproc) all \ && make prefix=/usr/local install \ && rm -rf /usr/src/git \ + && cd / \ + && mkdir -p /usr/src/pkgconf \ + && tar -xJC /usr/src/pkgconf --strip-components=1 -f pkgconf.tar.xz \ + && rm pkgconf.tar.xz \ + && cd /usr/src/pkgconf \ + && ./configure \ + && make -j $(nproc) \ + && make install \ + && rm -rf /usr/src/pkgconf \ + && ln -sf /usr/local/bin/pkgconf /usr/local/bin/pkg-config \ && cd /usr/src/tar \ && env FORCE_UNSAFE_CONFIGURE=1 ./configure \ --bindir=/usr/local/bin/ \ @@ -170,31 +184,37 @@ RUN set -ex \ NODE_ARCH='x64' \ GO_ARCH='amd64' \ CMAKE_ARCH='x86_64' \ + NINJA_ARCH='' \ ;; \ ppc64el) \ NODE_ARCH='ppc64le' \ GO_ARCH='ppc64le' \ CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ s390x) \ NODE_ARCH='s390x' \ GO_ARCH='s390x' \ CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ arm64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='' \ + NINJA_ARCH='aarch64' \ ;; \ aarch64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='aarch64' \ + NINJA_ARCH='aarch64' \ ;; \ i386) \ NODE_ARCH='x86' \ GO_ARCH='386' \ CMAKE_ARCH='' \ + CMAKE_ARCH='' \ ;; \ *) echo "unsupported architecture"; exit 1 ;; \ esac \ @@ -236,16 +256,22 @@ RUN set -ex \ rm -rf cmake-build; \ fi \ && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH:+-$NINJA_ARCH}.zip" -o "ninja.zip" \ + && unzip ninja.zip -d /usr/local/bin \ + && rm -f ninja.zip \ + && chmod +x /usr/local/bin/ninja \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ && python3 --version \ && rustc --version \ + && go version \ && node --version \ && npm --version \ && yarn --version \ && git --version \ - && tar --version + && tar --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ diff --git a/integration/linux/build/Dockerfile-debian.template b/integration/linux/build/Dockerfile-debian.template index b7eca35d..180c2f81 100644 --- a/integration/linux/build/Dockerfile-debian.template +++ b/integration/linux/build/Dockerfile-debian.template @@ -8,10 +8,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ %%IFNOT VARIANT=bionic%% cmake \ @@ -25,14 +29,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION %%PLACEHOLDER%% ENV NODE_VERSION %%PLACEHOLDER%% ENV YARN_VERSION %%PLACEHOLDER%% -%%IF VARIANT=bionic%% ENV CMAKE_VERSION %%PLACEHOLDER%% -%%ENDIF%% +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -53,14 +60,12 @@ RUN set -ex \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ -%%IF VARIANT=bionic%% && for key in \ "${CMAKE_KEYS[@]}" ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ -%%ENDIF%% && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ && mkdir -p /usr/src/python \ @@ -118,7 +123,6 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ -%%IF VARIANT=bionic%% && case "${dpkgArch##*-}" in \ amd64) CMAKE_ARCH='x86_64';; \ arm64) CMAKE_ARCH='aarch64';; \ @@ -143,7 +147,6 @@ RUN set -ex \ rm -rf cmake-build; \ fi \ && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ -%%ENDIF%% && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -152,7 +155,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ diff --git a/integration/linux/build/Dockerfile-fedora.template b/integration/linux/build/Dockerfile-fedora.template index 64df64e0..68ce6eaf 100644 --- a/integration/linux/build/Dockerfile-fedora.template +++ b/integration/linux/build/Dockerfile-fedora.template @@ -12,7 +12,8 @@ ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib" RUN yum install -y \ wget gcc make zlib-devel openssl-devel sqlite-devel bzip2-devel \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ - curl-devel xz-devel libffi-devel gettext glibc-langpack-en cmake + curl-devel xz-devel libffi-devel gettext glibc-langpack-en cmake \ + tcl file zip unzip ENV GPG_KEY %%PLACEHOLDER%% ENV PYTHON_VERSION %%PLACEHOLDER%% @@ -21,13 +22,18 @@ ENV RUSTUP_HOME /usr/local/rustup ENV CARGO_HOME /usr/local/cargo ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION %%PLACEHOLDER%% +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ - && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ - && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && wget -O git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ - && wget -O git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ + && curl -fsSLo git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && (try=1; while [ $try -le 5 ]; do \ @@ -74,7 +80,8 @@ RUN set -ex \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ - && rustc --version + && rustc --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ diff --git a/integration/linux/build/Dockerfile-linux.template b/integration/linux/build/Dockerfile-linux.template index a32d7b25..86ed292b 100644 --- a/integration/linux/build/Dockerfile-linux.template +++ b/integration/linux/build/Dockerfile-linux.template @@ -25,6 +25,8 @@ ENV GCC_VERSION 10 %%IFNOT VARIANT=aarch64%% ENV GCC_VERSION 11 %%ENDIF%% +ENV NINJA_VERSION 1.12.1 +ENV PKGCONF_VERSION 2.3.0 # rpm on centos 7 iterates over all fds up to the limit, which is # extremely slow. Force it to be small with ulimit. @@ -56,7 +58,7 @@ RUN case "$HOSTTYPE" in \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext \ perl-Getopt-Long perl-IPC-Cmd perl-Data-Dumper \ - sudo ca-certificates zstd + sudo ca-certificates zstd tcl file zip unzip RUN printf "#!/bin/bash\nsource scl_source enable devtoolset-${GCC_VERSION}" \ > /etc/profile.d/enabledevtoolset${GCC_VERSION}.sh @@ -75,6 +77,7 @@ RUN set -ex \ && curl -fsSLo patchelf.tar.bz2 "https://github.com/NixOS/patchelf/releases/download/${PATCHELF_VERSION}/patchelf-${PATCHELF_VERSION}.tar.bz2" \ && curl -fsSLo tar.tar.xz "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz" \ && curl -fsSLo tar.tar.xz.sign "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz.sig" \ + && curl -fsSLo pkgconf.tar.xz "https://distfiles.ariadne.space/pkgconf/pkgconf-${PKGCONF_VERSION}.tar.xz" \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -123,6 +126,9 @@ RUN set -ex \ && mkdir -p /usr/src/patchelf \ && tar -xjC /usr/src/patchelf --strip-components=1 -f patchelf.tar.bz2 \ && rm patchelf.tar.bz2 \ + && mkdir -p /usr/src/pkgconf \ + && tar -xJC /usr/src/pkgconf --strip-components=1 -f pkgconf.tar.xz \ + && rm pkgconf.tar.xz \ && cd /usr/src/python \ && sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure \ \ @@ -162,6 +168,12 @@ RUN set -ex \ && make -j $(nproc) \ && make install \ && rm -rf /usr/src/patchelf \ + && cd /usr/src/pkgconf \ + && ./configure \ + && make -j $(nproc) \ + && make install \ + && rm -rf /usr/src/pkgconf \ + && ln -sf /usr/local/bin/pkgconf /usr/bin/pkg-config \ && cd / \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal \ @@ -174,31 +186,19 @@ RUN set -ex \ NODE_ARCH='x64' \ GO_ARCH='amd64' \ CMAKE_ARCH='x86_64' \ - ;; \ - ppc64el) \ - NODE_ARCH='ppc64le' \ - GO_ARCH='ppc64le' \ - CMAKE_ARCH='' \ - ;; \ - s390x) \ - NODE_ARCH='s390x' \ - GO_ARCH='s390x' \ - CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ arm64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ - CMAKE_ARCH='' \ + CMAKE_ARCH='aarch64' \ + NINJA_ARCH='aarch64' \ ;; \ aarch64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='aarch64' \ - ;; \ - i386) \ - NODE_ARCH='x86' \ - GO_ARCH='386' \ - CMAKE_ARCH='' \ + NINJA_ARCH='aarch64' \ ;; \ *) echo "unsupported architecture"; exit 1 ;; \ esac \ @@ -221,6 +221,10 @@ RUN set -ex \ https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz -o /tmp/go.tgz \ && tar -C /usr/local -xzf /tmp/go.tgz \ && rm /tmp/go.tgz \ + && curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH:+-$NINJA_ARCH}.zip" -o "ninja.zip" \ + && unzip ninja.zip -d /usr/local/bin \ + && rm -f ninja.zip \ + && chmod +x /usr/local/bin/ninja \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ @@ -245,12 +249,15 @@ RUN set -ex \ \ && python3 --version \ && rustc --version \ + && go version \ && node --version \ && npm --version \ && yarn --version \ && git --version \ && tar --version \ - && cmake --version + && cmake --version \ + && ninja --version \ + && pkg-config --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ diff --git a/integration/linux/build/Dockerfile-linuxmusl.template b/integration/linux/build/Dockerfile-linuxmusl.template index 0b7524bf..3c31155f 100644 --- a/integration/linux/build/Dockerfile-linuxmusl.template +++ b/integration/linux/build/Dockerfile-linuxmusl.template @@ -26,13 +26,19 @@ RUN apk add --no-cache \ tar \ yarn \ zstd \ - cmake + cmake \ + tcl \ + protobuf-dev \ + ninja \ + file \ + zip RUN set -x; \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ - && rustc --version + && rustc --version \ + && ninja --version RUN ln -s /usr/bin/python3 /usr/bin/python diff --git a/integration/linux/build/Dockerfile-rockylinux.template b/integration/linux/build/Dockerfile-rockylinux.template index 4c2d3ae2..7006393a 100644 --- a/integration/linux/build/Dockerfile-rockylinux.template +++ b/integration/linux/build/Dockerfile-rockylinux.template @@ -14,15 +14,19 @@ RUN (echo precedence ::ffff:0:0/96 100 >> /etc/gai.conf \ && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* \ && yum update -y) || true) -RUN yum install --enablerepo=devel -y \ +RUN dnf install --enablerepo=devel --enablerepo=crb -y \ + 'dnf-command(config-manager)' \ wget gcc gcc-c++ make patch zlib-devel openssl-devel sqlite-devel bzip2-devel \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext glibc-langpack-en \ perl-Getopt-Long perl-File-Copy perl-IPC-Cmd perl-Data-Dumper perl-FindBin \ - perl-File-Compare python3-pip python3-devel \ - systemd-rpm-macros sudo ca-certificates git tar xz cmake + perl-File-Compare \ + systemd-rpm-macros sudo ca-certificates \ + git tar xz cmake tcl file unzip bzip2 zip +RUN dnf config-manager --set-enabled devel,crb +ENV PYTHON_VERSION %%PLACEHOLDER%% ENV GPG_KEY %%PLACEHOLDER%% ENV RUSTUP_HOME /usr/local/rustup ENV CARGO_HOME /usr/local/cargo @@ -30,8 +34,21 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION %%PLACEHOLDER%% ENV NODE_VERSION %%PLACEHOLDER%% ENV YARN_VERSION %%PLACEHOLDER%% +ENV NINJA_VERSION 1.12.1 RUN set -ex \ + && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ + && for key in \ + "${PYTHON_KEYS[@]}" + ; do \ + gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ && for key in \ "${NODE_KEYS[@]}" ; do \ @@ -44,6 +61,33 @@ RUN set -ex \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && rm -rf python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + && cd /usr/src/python \ + && gnuArch="$(gcc -dumpmachine)" \ + && ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + --with-system-expat \ + --with-system-ffi \ + --without-ensurepip \ + && make -j "$(nproc)" \ + && make install \ + && ldconfig \ + \ + && find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python \ + \ + && cd / \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ @@ -83,12 +127,35 @@ RUN set -ex \ && npm --version \ && yarn --version \ && git --version \ - && tar --version + && tar --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s /usr/bin/python3 python \ - && ln -s /usr/bin/python3-config python-config + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% + +RUN set -ex; \ + \ + curl -fsSLo get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py %%WRITE_ENTRYPOINT%% RUN chmod +x /entrypoint.sh diff --git a/integration/linux/build/centos-7/Dockerfile b/integration/linux/build/centos-7/Dockerfile index 5fae5b16..acc569f6 100644 --- a/integration/linux/build/centos-7/Dockerfile +++ b/integration/linux/build/centos-7/Dockerfile @@ -7,7 +7,7 @@ FROM centos:7 # ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH +ENV PATH /usr/local/bin:/usr/local/cargo/bin:/usr/local/go/bin:$PATH # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. @@ -45,7 +45,7 @@ RUN ulimit -n 1024 \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext glibc-langpack-en \ perl-Getopt-Long perl-IPC-Cmd perl-Data-Dumper \ - sudo ca-certificates + sudo ca-certificates cmake tcl file zip unzip bzip2 RUN printf "#!/bin/bash\nsource scl_source enable devtoolset-${GCC_VERSION}" \ > /etc/profile.d/enabledevtoolset${GCC_VERSION}.sh @@ -65,15 +65,19 @@ ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 ENV CMAKE_VERSION 3.30.2 +ENV GO_VERSION 1.21.6 +ENV NINJA_VERSION 1.12.1 +ENV PKGCONF_VERSION 2.3.0 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && curl -fsSLo git.tar.xz "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ - && curl -fsSLo git.tar.sign "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ + && curl -fsSLo git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ && curl -fsSLo tar.tar.xz "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz" \ && curl -fsSLo tar.tar.xz.sign "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz.sig" \ + && curl -fsSLo pkgconf.tar.xz "https://distfiles.ariadne.space/pkgconf/pkgconf-${PKGCONF_VERSION}.tar.xz" \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -161,6 +165,16 @@ RUN set -ex \ && make prefix=/usr/local V=1 -j $(nproc) all \ && make prefix=/usr/local install \ && rm -rf /usr/src/git \ + && cd / \ + && mkdir -p /usr/src/pkgconf \ + && tar -xJC /usr/src/pkgconf --strip-components=1 -f pkgconf.tar.xz \ + && rm pkgconf.tar.xz \ + && cd /usr/src/pkgconf \ + && ./configure \ + && make -j $(nproc) \ + && make install \ + && rm -rf /usr/src/pkgconf \ + && ln -sf /usr/local/bin/pkgconf /usr/local/bin/pkg-config \ && cd /usr/src/tar \ && env FORCE_UNSAFE_CONFIGURE=1 ./configure \ --bindir=/usr/local/bin/ \ @@ -180,31 +194,37 @@ RUN set -ex \ NODE_ARCH='x64' \ GO_ARCH='amd64' \ CMAKE_ARCH='x86_64' \ + NINJA_ARCH='' \ ;; \ ppc64el) \ NODE_ARCH='ppc64le' \ GO_ARCH='ppc64le' \ CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ s390x) \ NODE_ARCH='s390x' \ GO_ARCH='s390x' \ CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ arm64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='' \ + NINJA_ARCH='aarch64' \ ;; \ aarch64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='aarch64' \ + NINJA_ARCH='aarch64' \ ;; \ i386) \ NODE_ARCH='x86' \ GO_ARCH='386' \ CMAKE_ARCH='' \ + CMAKE_ARCH='' \ ;; \ *) echo "unsupported architecture"; exit 1 ;; \ esac \ @@ -246,16 +266,22 @@ RUN set -ex \ rm -rf cmake-build; \ fi \ && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH:+-$NINJA_ARCH}.zip" -o "ninja.zip" \ + && unzip ninja.zip -d /usr/local/bin \ + && rm -f ninja.zip \ + && chmod +x /usr/local/bin/ninja \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ && python3 --version \ && rustc --version \ + && go version \ && node --version \ && npm --version \ && yarn --version \ && git --version \ - && tar --version + && tar --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -297,6 +323,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/centos-8/Dockerfile b/integration/linux/build/centos-8/Dockerfile index 97a17543..e97b25fe 100644 --- a/integration/linux/build/centos-8/Dockerfile +++ b/integration/linux/build/centos-8/Dockerfile @@ -7,7 +7,7 @@ FROM centos:8 # ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH +ENV PATH /usr/local/bin:/usr/local/cargo/bin:/usr/local/go/bin:$PATH # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. @@ -38,7 +38,7 @@ RUN ulimit -n 1024 \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext glibc-langpack-en \ perl-Getopt-Long perl-IPC-Cmd perl-Data-Dumper \ - sudo ca-certificates + sudo ca-certificates cmake tcl file zip unzip bzip2 # Needed to pick up SCL stuff from profile.d/ @@ -56,15 +56,19 @@ ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 ENV CMAKE_VERSION 3.30.2 +ENV GO_VERSION 1.21.6 +ENV NINJA_VERSION 1.12.1 +ENV PKGCONF_VERSION 2.3.0 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && curl -fsSLo git.tar.xz "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ - && curl -fsSLo git.tar.sign "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ + && curl -fsSLo git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ && curl -fsSLo tar.tar.xz "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz" \ && curl -fsSLo tar.tar.xz.sign "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz.sig" \ + && curl -fsSLo pkgconf.tar.xz "https://distfiles.ariadne.space/pkgconf/pkgconf-${PKGCONF_VERSION}.tar.xz" \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -151,6 +155,16 @@ RUN set -ex \ && make prefix=/usr/local V=1 -j $(nproc) all \ && make prefix=/usr/local install \ && rm -rf /usr/src/git \ + && cd / \ + && mkdir -p /usr/src/pkgconf \ + && tar -xJC /usr/src/pkgconf --strip-components=1 -f pkgconf.tar.xz \ + && rm pkgconf.tar.xz \ + && cd /usr/src/pkgconf \ + && ./configure \ + && make -j $(nproc) \ + && make install \ + && rm -rf /usr/src/pkgconf \ + && ln -sf /usr/local/bin/pkgconf /usr/local/bin/pkg-config \ && cd /usr/src/tar \ && env FORCE_UNSAFE_CONFIGURE=1 ./configure \ --bindir=/usr/local/bin/ \ @@ -170,31 +184,37 @@ RUN set -ex \ NODE_ARCH='x64' \ GO_ARCH='amd64' \ CMAKE_ARCH='x86_64' \ + NINJA_ARCH='' \ ;; \ ppc64el) \ NODE_ARCH='ppc64le' \ GO_ARCH='ppc64le' \ CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ s390x) \ NODE_ARCH='s390x' \ GO_ARCH='s390x' \ CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ arm64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='' \ + NINJA_ARCH='aarch64' \ ;; \ aarch64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='aarch64' \ + NINJA_ARCH='aarch64' \ ;; \ i386) \ NODE_ARCH='x86' \ GO_ARCH='386' \ CMAKE_ARCH='' \ + CMAKE_ARCH='' \ ;; \ *) echo "unsupported architecture"; exit 1 ;; \ esac \ @@ -236,16 +256,22 @@ RUN set -ex \ rm -rf cmake-build; \ fi \ && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH:+-$NINJA_ARCH}.zip" -o "ninja.zip" \ + && unzip ninja.zip -d /usr/local/bin \ + && rm -f ninja.zip \ + && chmod +x /usr/local/bin/ninja \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ && python3 --version \ && rustc --version \ + && go version \ && node --version \ && npm --version \ && yarn --version \ && git --version \ - && tar --version + && tar --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -287,6 +313,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/debian-bookworm/Dockerfile b/integration/linux/build/debian-bookworm/Dockerfile index 07d9e664..169aff1b 100644 --- a/integration/linux/build/debian-bookworm/Dockerfile +++ b/integration/linux/build/debian-bookworm/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/debian-bullseye/Dockerfile b/integration/linux/build/debian-bullseye/Dockerfile index d99d0609..82781329 100644 --- a/integration/linux/build/debian-bullseye/Dockerfile +++ b/integration/linux/build/debian-bullseye/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/debian-buster/Dockerfile b/integration/linux/build/debian-buster/Dockerfile index 4accb836..426857d3 100644 --- a/integration/linux/build/debian-buster/Dockerfile +++ b/integration/linux/build/debian-buster/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/entrypoint.sh b/integration/linux/build/entrypoint.sh index 5bde044f..d760cb82 100755 --- a/integration/linux/build/entrypoint.sh +++ b/integration/linux/build/entrypoint.sh @@ -10,6 +10,7 @@ rm -rf "${CARGO_HOME}"/{git,registry} ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry" ln -s ~/.cache/cargo/git "${CARGO_HOME}/git" +python -m pip install meson python -m pip install -U git+https://github.com/edgedb/edgedb-pkg if [ -n "${METAPKG_PATH}" ]; then diff --git a/integration/linux/build/fedora-29/Dockerfile b/integration/linux/build/fedora-29/Dockerfile index 972a4fcb..b75a0785 100644 --- a/integration/linux/build/fedora-29/Dockerfile +++ b/integration/linux/build/fedora-29/Dockerfile @@ -18,7 +18,8 @@ ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib" RUN yum install -y \ wget gcc make zlib-devel openssl-devel sqlite-devel bzip2-devel \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ - curl-devel xz-devel libffi-devel gettext glibc-langpack-en cmake + curl-devel xz-devel libffi-devel gettext glibc-langpack-en cmake \ + tcl file zip unzip ENV GPG_KEY %%PLACEHOLDER%% ENV PYTHON_VERSION 3.12.7 @@ -27,13 +28,18 @@ ENV RUSTUP_HOME /usr/local/rustup ENV CARGO_HOME /usr/local/cargo ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ - && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ - && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && wget -O git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ - && wget -O git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo git.tar.xz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" \ + && curl -fsSLo git.tar.sign "https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.sign" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && (try=1; while [ $try -le 5 ]; do \ @@ -80,7 +86,8 @@ RUN set -ex \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ - && rustc --version + && rustc --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -122,6 +129,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/linux-aarch64/Dockerfile b/integration/linux/build/linux-aarch64/Dockerfile index befe0913..1d2b9739 100644 --- a/integration/linux/build/linux-aarch64/Dockerfile +++ b/integration/linux/build/linux-aarch64/Dockerfile @@ -26,6 +26,8 @@ ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 ENV CMAKE_VERSION 3.30.2 ENV GCC_VERSION 10 +ENV NINJA_VERSION 1.12.1 +ENV PKGCONF_VERSION 2.3.0 # rpm on centos 7 iterates over all fds up to the limit, which is # extremely slow. Force it to be small with ulimit. @@ -57,7 +59,7 @@ RUN case "$HOSTTYPE" in \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext \ perl-Getopt-Long perl-IPC-Cmd perl-Data-Dumper \ - sudo ca-certificates zstd + sudo ca-certificates zstd tcl file zip unzip RUN printf "#!/bin/bash\nsource scl_source enable devtoolset-${GCC_VERSION}" \ > /etc/profile.d/enabledevtoolset${GCC_VERSION}.sh @@ -76,6 +78,7 @@ RUN set -ex \ && curl -fsSLo patchelf.tar.bz2 "https://github.com/NixOS/patchelf/releases/download/${PATCHELF_VERSION}/patchelf-${PATCHELF_VERSION}.tar.bz2" \ && curl -fsSLo tar.tar.xz "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz" \ && curl -fsSLo tar.tar.xz.sign "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz.sig" \ + && curl -fsSLo pkgconf.tar.xz "https://distfiles.ariadne.space/pkgconf/pkgconf-${PKGCONF_VERSION}.tar.xz" \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -138,6 +141,9 @@ RUN set -ex \ && mkdir -p /usr/src/patchelf \ && tar -xjC /usr/src/patchelf --strip-components=1 -f patchelf.tar.bz2 \ && rm patchelf.tar.bz2 \ + && mkdir -p /usr/src/pkgconf \ + && tar -xJC /usr/src/pkgconf --strip-components=1 -f pkgconf.tar.xz \ + && rm pkgconf.tar.xz \ && cd /usr/src/python \ && sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure \ \ @@ -177,6 +183,12 @@ RUN set -ex \ && make -j $(nproc) \ && make install \ && rm -rf /usr/src/patchelf \ + && cd /usr/src/pkgconf \ + && ./configure \ + && make -j $(nproc) \ + && make install \ + && rm -rf /usr/src/pkgconf \ + && ln -sf /usr/local/bin/pkgconf /usr/bin/pkg-config \ && cd / \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal \ @@ -189,31 +201,19 @@ RUN set -ex \ NODE_ARCH='x64' \ GO_ARCH='amd64' \ CMAKE_ARCH='x86_64' \ - ;; \ - ppc64el) \ - NODE_ARCH='ppc64le' \ - GO_ARCH='ppc64le' \ - CMAKE_ARCH='' \ - ;; \ - s390x) \ - NODE_ARCH='s390x' \ - GO_ARCH='s390x' \ - CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ arm64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ - CMAKE_ARCH='' \ + CMAKE_ARCH='aarch64' \ + NINJA_ARCH='aarch64' \ ;; \ aarch64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='aarch64' \ - ;; \ - i386) \ - NODE_ARCH='x86' \ - GO_ARCH='386' \ - CMAKE_ARCH='' \ + NINJA_ARCH='aarch64' \ ;; \ *) echo "unsupported architecture"; exit 1 ;; \ esac \ @@ -236,6 +236,10 @@ RUN set -ex \ https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz -o /tmp/go.tgz \ && tar -C /usr/local -xzf /tmp/go.tgz \ && rm /tmp/go.tgz \ + && curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH:+-$NINJA_ARCH}.zip" -o "ninja.zip" \ + && unzip ninja.zip -d /usr/local/bin \ + && rm -f ninja.zip \ + && chmod +x /usr/local/bin/ninja \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ @@ -260,12 +264,15 @@ RUN set -ex \ \ && python3 --version \ && rustc --version \ + && go version \ && node --version \ && npm --version \ && yarn --version \ && git --version \ && tar --version \ - && cmake --version + && cmake --version \ + && ninja --version \ + && pkg-config --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -307,6 +314,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/linux-x86_64/Dockerfile b/integration/linux/build/linux-x86_64/Dockerfile index 885fdf47..a2a79b76 100644 --- a/integration/linux/build/linux-x86_64/Dockerfile +++ b/integration/linux/build/linux-x86_64/Dockerfile @@ -26,6 +26,8 @@ ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 ENV CMAKE_VERSION 3.30.2 ENV GCC_VERSION 11 +ENV NINJA_VERSION 1.12.1 +ENV PKGCONF_VERSION 2.3.0 # rpm on centos 7 iterates over all fds up to the limit, which is # extremely slow. Force it to be small with ulimit. @@ -57,7 +59,7 @@ RUN case "$HOSTTYPE" in \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext \ perl-Getopt-Long perl-IPC-Cmd perl-Data-Dumper \ - sudo ca-certificates zstd + sudo ca-certificates zstd tcl file zip unzip RUN printf "#!/bin/bash\nsource scl_source enable devtoolset-${GCC_VERSION}" \ > /etc/profile.d/enabledevtoolset${GCC_VERSION}.sh @@ -76,6 +78,7 @@ RUN set -ex \ && curl -fsSLo patchelf.tar.bz2 "https://github.com/NixOS/patchelf/releases/download/${PATCHELF_VERSION}/patchelf-${PATCHELF_VERSION}.tar.bz2" \ && curl -fsSLo tar.tar.xz "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz" \ && curl -fsSLo tar.tar.xz.sign "https://alpha.gnu.org/gnu/tar/tar-${TAR_VERSION}.tar.xz.sig" \ + && curl -fsSLo pkgconf.tar.xz "https://distfiles.ariadne.space/pkgconf/pkgconf-${PKGCONF_VERSION}.tar.xz" \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -138,6 +141,9 @@ RUN set -ex \ && mkdir -p /usr/src/patchelf \ && tar -xjC /usr/src/patchelf --strip-components=1 -f patchelf.tar.bz2 \ && rm patchelf.tar.bz2 \ + && mkdir -p /usr/src/pkgconf \ + && tar -xJC /usr/src/pkgconf --strip-components=1 -f pkgconf.tar.xz \ + && rm pkgconf.tar.xz \ && cd /usr/src/python \ && sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure \ \ @@ -177,6 +183,12 @@ RUN set -ex \ && make -j $(nproc) \ && make install \ && rm -rf /usr/src/patchelf \ + && cd /usr/src/pkgconf \ + && ./configure \ + && make -j $(nproc) \ + && make install \ + && rm -rf /usr/src/pkgconf \ + && ln -sf /usr/local/bin/pkgconf /usr/bin/pkg-config \ && cd / \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal \ @@ -189,31 +201,19 @@ RUN set -ex \ NODE_ARCH='x64' \ GO_ARCH='amd64' \ CMAKE_ARCH='x86_64' \ - ;; \ - ppc64el) \ - NODE_ARCH='ppc64le' \ - GO_ARCH='ppc64le' \ - CMAKE_ARCH='' \ - ;; \ - s390x) \ - NODE_ARCH='s390x' \ - GO_ARCH='s390x' \ - CMAKE_ARCH='' \ + NINJA_ARCH='' \ ;; \ arm64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ - CMAKE_ARCH='' \ + CMAKE_ARCH='aarch64' \ + NINJA_ARCH='aarch64' \ ;; \ aarch64) \ NODE_ARCH='arm64' \ GO_ARCH='arm64' \ CMAKE_ARCH='aarch64' \ - ;; \ - i386) \ - NODE_ARCH='x86' \ - GO_ARCH='386' \ - CMAKE_ARCH='' \ + NINJA_ARCH='aarch64' \ ;; \ *) echo "unsupported architecture"; exit 1 ;; \ esac \ @@ -236,6 +236,10 @@ RUN set -ex \ https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz -o /tmp/go.tgz \ && tar -C /usr/local -xzf /tmp/go.tgz \ && rm /tmp/go.tgz \ + && curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux${NINJA_ARCH:+-$NINJA_ARCH}.zip" -o "ninja.zip" \ + && unzip ninja.zip -d /usr/local/bin \ + && rm -f ninja.zip \ + && chmod +x /usr/local/bin/ninja \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ @@ -260,12 +264,15 @@ RUN set -ex \ \ && python3 --version \ && rustc --version \ + && go version \ && node --version \ && npm --version \ && yarn --version \ && git --version \ && tar --version \ - && cmake --version + && cmake --version \ + && ninja --version \ + && pkg-config --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -307,6 +314,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/linuxmusl-aarch64/Dockerfile b/integration/linux/build/linuxmusl-aarch64/Dockerfile index 693b509e..8ea5e9ad 100644 --- a/integration/linux/build/linuxmusl-aarch64/Dockerfile +++ b/integration/linux/build/linuxmusl-aarch64/Dockerfile @@ -32,13 +32,19 @@ RUN apk add --no-cache \ tar \ yarn \ zstd \ - cmake + cmake \ + tcl \ + protobuf-dev \ + ninja \ + file \ + zip RUN set -x; \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ - && rustc --version + && rustc --version \ + && ninja --version RUN ln -s /usr/bin/python3 /usr/bin/python @@ -54,6 +60,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/linuxmusl-x86_64/Dockerfile b/integration/linux/build/linuxmusl-x86_64/Dockerfile index 693b509e..8ea5e9ad 100644 --- a/integration/linux/build/linuxmusl-x86_64/Dockerfile +++ b/integration/linux/build/linuxmusl-x86_64/Dockerfile @@ -32,13 +32,19 @@ RUN apk add --no-cache \ tar \ yarn \ zstd \ - cmake + cmake \ + tcl \ + protobuf-dev \ + ninja \ + file \ + zip RUN set -x; \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ - && rustc --version + && rustc --version \ + && ninja --version RUN ln -s /usr/bin/python3 /usr/bin/python @@ -54,6 +60,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/rockylinux-9/Dockerfile b/integration/linux/build/rockylinux-9/Dockerfile index c7b0c616..0ad17efb 100644 --- a/integration/linux/build/rockylinux-9/Dockerfile +++ b/integration/linux/build/rockylinux-9/Dockerfile @@ -20,15 +20,19 @@ RUN (echo precedence ::ffff:0:0/96 100 >> /etc/gai.conf \ && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* \ && yum update -y) || true) -RUN yum install --enablerepo=devel -y \ +RUN dnf install --enablerepo=devel --enablerepo=crb -y \ + 'dnf-command(config-manager)' \ wget gcc gcc-c++ make patch zlib-devel openssl-devel sqlite-devel bzip2-devel \ expat-devel ncurses-devel gdbm-devel readline-devel libuuid-devel \ curl-devel xz-devel libffi-devel gettext glibc-langpack-en \ perl-Getopt-Long perl-File-Copy perl-IPC-Cmd perl-Data-Dumper perl-FindBin \ - perl-File-Compare python3-pip python3-devel \ - systemd-rpm-macros sudo ca-certificates git tar xz cmake + perl-File-Compare \ + systemd-rpm-macros sudo ca-certificates \ + git tar xz cmake tcl file unzip bzip2 zip +RUN dnf config-manager --set-enabled devel,crb +ENV PYTHON_VERSION 3.12.7 ENV GPG_KEY %%PLACEHOLDER%% ENV RUSTUP_HOME /usr/local/rustup ENV CARGO_HOME /usr/local/cargo @@ -36,8 +40,23 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ + && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ + && for key in \ + E3FF2839C048B25C084DEBE9B26995E310250568 \ + a035c8c19219ba821ecea86b64e628f8d684696d \ + 7169605F62C751356D054A26A821E680E5FA6305 \ + ; do \ + gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ 141F07595B7B3FFE74309A937405533BE57C7D57 \ @@ -61,6 +80,33 @@ RUN set -ex \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && rm -rf python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + && cd /usr/src/python \ + && gnuArch="$(gcc -dumpmachine)" \ + && ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + --with-system-expat \ + --with-system-ffi \ + --without-ensurepip \ + && make -j "$(nproc)" \ + && make install \ + && ldconfig \ + \ + && find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python \ + \ + && cd / \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- \ -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION \ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME \ @@ -100,12 +146,35 @@ RUN set -ex \ && npm --version \ && yarn --version \ && git --version \ - && tar --version + && tar --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s /usr/bin/python3 python \ - && ln -s /usr/bin/python3-config python-config + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +ENV PYTHON_PIP_VERSION 24.2 + +RUN set -ex; \ + \ + curl -fsSLo get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py RUN /bin/echo -e '#!/bin/bash\n\ \n\ @@ -119,6 +188,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/ubuntu-bionic/Dockerfile b/integration/linux/build/ubuntu-bionic/Dockerfile index c67030ce..86c99c6f 100644 --- a/integration/linux/build/ubuntu-bionic/Dockerfile +++ b/integration/linux/build/ubuntu-bionic/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,16 @@ ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -162,7 +171,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -204,6 +214,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/ubuntu-focal/Dockerfile b/integration/linux/build/ubuntu-focal/Dockerfile index d9e72efd..aad964c7 100644 --- a/integration/linux/build/ubuntu-focal/Dockerfile +++ b/integration/linux/build/ubuntu-focal/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/ubuntu-hirsute/Dockerfile b/integration/linux/build/ubuntu-hirsute/Dockerfile index 4fc20299..072c5fea 100644 --- a/integration/linux/build/ubuntu-hirsute/Dockerfile +++ b/integration/linux/build/ubuntu-hirsute/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/ubuntu-jammy/Dockerfile b/integration/linux/build/ubuntu-jammy/Dockerfile index 7f5c813b..ae236836 100644 --- a/integration/linux/build/ubuntu-jammy/Dockerfile +++ b/integration/linux/build/ubuntu-jammy/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/linux/build/ubuntu-noble/Dockerfile b/integration/linux/build/ubuntu-noble/Dockerfile index 07b0ac00..ee83d25a 100644 --- a/integration/linux/build/ubuntu-noble/Dockerfile +++ b/integration/linux/build/ubuntu-noble/Dockerfile @@ -14,10 +14,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ libssl-dev \ tk-dev \ + tcl \ sudo \ bison \ flex \ + file \ patchelf \ + libprotobuf-dev \ + zip \ zstd \ cmake \ && rm -rf /var/lib/apt/lists/* @@ -29,11 +33,17 @@ ENV PATH /usr/local/cargo/bin:$PATH ENV RUST_VERSION 1.76.0 ENV NODE_VERSION 16.16.0 ENV YARN_VERSION 1.22.19 +ENV CMAKE_VERSION 3.30.2 +ENV NINJA_VERSION 1.12.1 RUN set -ex \ \ && curl -fsSLo python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && curl -fsSLo python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && curl -fsSLo ninja-linux.zip "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-linux.zip" \ + && unzip ninja-linux.zip -d /usr/local/bin \ + && rm -f ninja-linux.zip \ + && chmod +x /usr/local/bin/ninja \ && export GNUPGHOME="$(mktemp -d)" \ && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ && for key in \ @@ -66,6 +76,12 @@ RUN set -ex \ ; do \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ + done \ + && for key in \ + CBA23971357C2E6590D9EFD3EC8FEF3A7BFB4EDA \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" ; \ done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf python.tar.xz.asc \ @@ -124,6 +140,30 @@ RUN set -ex \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ + && case "${dpkgArch##*-}" in \ + amd64) CMAKE_ARCH='x86_64';; \ + arm64) CMAKE_ARCH='aarch64';; \ + *) CMAKE_ARCH='' ;; \ + esac \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt" \ + && curl -fsSLO --compressed "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ + && gpg --batch --verify cmake-$CMAKE_VERSION-SHA-256.txt.asc cmake-$CMAKE_VERSION-SHA-256.txt \ + && grep " cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz\$" cmake-$CMAKE_VERSION-SHA-256.txt | sha256sum -c - \ + && if [ -n "$CMAKE_ARCH" ]; then \ + echo $CMAKE_ARCH; \ + tar -xzf "cmake-$CMAKE_VERSION-linux-$CMAKE_ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner; \ + else \ + mkdir cmake-build; \ + tar -xzf "cmake-$CMAKE_VERSION.tar.gz" -C cmake-build --strip-components=1; \ + cd cmake-build; \ + ./bootstrap --parallel="$(nproc)"; \ + make -j "$(nproc)"; \ + make install; \ + cd ..; \ + rm -rf cmake-build; \ + fi \ + && rm "cmake-$CMAKE_VERSION${CMAKE_ARCH:+-linux-$CMAKE_ARCH}.tar.gz" "cmake-$CMAKE_VERSION-SHA-256.txt" "cmake-$CMAKE_VERSION-SHA-256.txt.asc" \ && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ && rm -rf "$GNUPGHOME" \ \ @@ -132,7 +172,8 @@ RUN set -ex \ && node --version \ && npm --version \ && yarn --version \ - && cmake --version + && cmake --version \ + && ninja --version # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ @@ -174,6 +215,7 @@ rm -rf "${CARGO_HOME}"/{git,registry}\n\ ln -s ~/.cache/cargo/registry "${CARGO_HOME}/registry"\n\ ln -s ~/.cache/cargo/git "${CARGO_HOME}/git"\n\ \n\ +python -m pip install meson\n\ python -m pip install -U git+https://github.com/edgedb/edgedb-pkg\n\ \n\ if [ -n "${METAPKG_PATH}" ]; then\n\ diff --git a/integration/macos/build.sh b/integration/macos/build.sh index 80e9053b..807d2075 100755 --- a/integration/macos/build.sh +++ b/integration/macos/build.sh @@ -61,7 +61,7 @@ if [ -z "${VIRTUAL_ENV}"]; then fi ${PYTHON} -m pip install --upgrade --upgrade-strategy=eager \ - git+https://github.com/edgedb/edgedb-pkg + git+https://github.com/edgedb/edgedb-pkg@postgis for old in "${dest}"/*.tar; do rm -f "${old}" diff --git a/setup.py b/setup.py index 3b329174..7d1c07f4 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,6 @@ packages=["edgedbpkg"], include_package_data=True, install_requires=[ - "metapkg@git+https://github.com/edgedb/metapkg.git", + "metapkg@git+https://github.com/edgedb/metapkg.git@refactor", ], )