Skip to content

Commit

Permalink
Update to current gdb and python
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Sep 4, 2024
1 parent fd6a391 commit c224c3a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down
2 changes: 1 addition & 1 deletion dockerbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
70 changes: 47 additions & 23 deletions src/relenv_gdb/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Build our python wheel.
"""
import contextlib
import logging
import os
import pathlib
import pprint
Expand Down Expand Up @@ -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(
[
Expand All @@ -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,
Expand All @@ -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",
],
Expand All @@ -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"])

Expand All @@ -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)
Expand All @@ -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)

0 comments on commit c224c3a

Please sign in to comment.