diff --git a/.github/workflows/package-action.yml b/.github/workflows/package-action.yml index fd3f1bb..da1d3ce 100644 --- a/.github/workflows/package-action.yml +++ b/.github/workflows/package-action.yml @@ -51,7 +51,7 @@ jobs: - name: Install OS Dependencies run: >- apt-get install -y python3 - python3-pip python3-venv patchelf build-essential m4 + python3-pip python3-venv patchelf build-essential m4 texinfo - name: Create virtualenv run: >- diff --git a/dockerbuild.sh b/dockerbuild.sh index 5383ccb..6369d4d 100755 --- a/dockerbuild.sh +++ b/dockerbuild.sh @@ -14,7 +14,7 @@ export CHOWN CMD=" apt-get update; apt-get install -y gcc python3 \ - python3-pip python3-venv build-essential patchelf m4 libexpat1-dev + python3-pip python3-venv build-essential patchelf m4 texinfo cd /src python3 -m venv venv venv/bin/pip install build wheel setuptools diff --git a/src/relenv_gdb/build.py b/src/relenv_gdb/build.py index 38b16bf..3ad88cd 100644 --- a/src/relenv_gdb/build.py +++ b/src/relenv_gdb/build.py @@ -5,6 +5,7 @@ Build our python wheel. """ import contextlib +import logging import os import pathlib import pprint @@ -41,29 +42,55 @@ def build_gdb(prefix): src = prefix / "src" src.mkdir(exist_ok=True) - url = "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" - relenv.common.download_url( - url, - src, - ) - - archive_name = str(src / pathlib.Path(url).name) - relenv.common.extract_archive(str(src), archive_name) - dir_name = archive_name.split(".tar")[0] os.environ.update(relenv.buildenv.buildenv(prefix)) - # os.environ['LDFLAGS'] = f"-Wl,-rpath,{os.environ['RELENV_PATH']}/lib {os.environ['LDFLAGS']}" os.environ["CFLAGS"] = ( f"{os.environ['CFLAGS']} -I{os.environ['RELENV_PATH']}/include/ncursesw " - # f"-I{os.environ['RELENV_PATH']}/include/python3.10" + f"-I{os.environ['RELENV_PATH']}/include/readline " + f"-I{os.environ['RELENV_PATH']}/lib/python3.10/site-packages/relenv_gdb/gdb/include" ) os.environ["CPPFLAGS"] = ( f"{os.environ['CPPFLAGS']} -I{os.environ['RELENV_PATH']}/include/ncursesw " - # f"-I{os.environ['RELENV_PATH']}/include/python3.10" + f"-I{os.environ['RELENV_PATH']}/include/readline " + f"-I{os.environ['RELENV_PATH']}/lib/python3.10/site-packages/relenv_gdb/gdb/include" + ) + os.environ["LDFLAGS"] = ( + f"{os.environ['LDFLAGS']} " + f"-L{os.environ['RELENV_PATH']}/lib/python3.10/site-packages/relenv_gdb/gdb/lib " + f"-lreadline" ) print(f"Build environment: {pprint.pformat(dict(os.environ))}") sys.stdout.flush() + url = "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" + relenv.common.download_url( + url, + src, + ) + archive_name = str(src / pathlib.Path(url).name) + relenv.common.extract_archive(str(src), archive_name) + dir_name = archive_name.split(".tar")[0] + + with pushd(src / dir_name): + subprocess.run( + [ + "./configure", + f"--prefix={os.environ['RELENV_PATH']}/lib/python3.10/site-packages/relenv_gdb/gdb", + ], + check=True, + ) + subprocess.run(["make"], check=True) + subprocess.run(["make", "install"], check=True) + + url = "https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.xz" + relenv.common.download_url( + url, + src, + ) + archive_name = str(src / pathlib.Path(url).name) + relenv.common.extract_archive(str(src), archive_name) + dir_name = archive_name.split(".tar")[0] + with pushd(src / dir_name): subprocess.run( [ @@ -75,7 +102,7 @@ def build_gdb(prefix): subprocess.run(["make"], check=True) subprocess.run(["make", "install"], check=True) - url = "https://ftp.gnu.org/gnu/gdb/gdb-13.2.tar.xz" + url = "https://ftp.gnu.org/gnu/gdb/gdb-15.1.tar.xz" relenv.common.download_url( url, src, @@ -88,7 +115,7 @@ def build_gdb(prefix): [ "./configure", f"--prefix={os.environ['RELENV_PATH']}/lib/python3.10/site-packages/relenv_gdb/gdb", - # f"--with-python={os.environ['RELENV_PATH']}/bin/python3", + f"--with-python={os.environ['RELENV_PATH']}/bin/python3", "--with-lzma", "--with-separate-debug-dir=/usr/lib/debug", ], @@ -104,7 +131,7 @@ def build_gdb(prefix): f"{os.environ['TOOLCHAIN_PATH']}/{os.environ['TRIPLET']}/sysroot/lib", _, ], - # check=True, + check=True, ) subprocess.run(["make", "install"]) @@ -121,12 +148,8 @@ def build_gdb(prefix): def build_wheel(wheel_directory, metadata_directory=None, config_settings=None): """PEP 517 wheel creation hook.""" - import logging - logging.basicConfig(level=logging.DEBUG) - # static_build_dir = os.environ.get("PY_STATIC_BUILD_DIR", "") - # XXX should be in relenv dirs = relenv.common.work_dirs() if not dirs.toolchain.exists(): os.makedirs(dirs.toolchain) @@ -135,17 +158,18 @@ def build_wheel(wheel_directory, metadata_directory=None, config_settings=None): arch = relenv.common.build_arch() triplet = relenv.common.get_triplet(machine=arch) + python = relenv.build.platform_versions()[0] + version = relenv.common.__version__ root = pathlib.Path(os.environ.get("PWD", os.getcwd())) build = root / "build" relenvdir = (build / "gdb").resolve() - print(f"** RELENV DIR IS: {relenvdir}") - sys.stdout.flush() + relenv.toolchain.fetch(arch, dirs.toolchain) - relenv.fetch.fetch(relenv.common.__version__, triplet, python) + relenv.fetch.fetch(version, triplet, python) if not relenvdir.exists(): - relenv.create.create(str(relenvdir)) + relenv.create.create(str(relenvdir), version=python) build_gdb(relenvdir) return _build_wheel(wheel_directory, metadata_directory, config_settings)