From b11bbda837749534318fda0cfe44b46d137f2783 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 17 Feb 2024 00:34:27 -0600 Subject: [PATCH] fix: Use environment CXX to configure fastjet-contrib .Makefile.inc * fastjet-contrib's .Makefile.inc is created at ./configure time, which means that if the environment's CXX is accessible inside of setup.py it can be passed as an argument to configure. Use this to set CXX for fastjet-contrib/.Makefile.inc and use a default value of g++ if no environment value is set. * As this supersedes the need for patching .Makefile.inc, which was being overwritten, remove that patch file and the .Makefile.inc patching step from setup.py. --- MANIFEST.in | 2 +- patch_makefileinc.txt | 21 --------------------- setup.py | 9 ++------- 3 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 patch_makefileinc.txt diff --git a/MANIFEST.in b/MANIFEST.in index 07ce3061..75f26f72 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,5 +4,5 @@ graft fastjet-core graft fastjet-contrib graft pybind11 global-exclude .git .gitmodules -include LICENSE README.md pyproject.toml setup.py setup.cfg patch_fastjet_i.txt patch_clustersequence.txt patch_makefileinc.txt +include LICENSE README.md pyproject.toml setup.py setup.cfg patch_fastjet_i.txt patch_clustersequence.txt exclude .cirrus.yml diff --git a/patch_makefileinc.txt b/patch_makefileinc.txt deleted file mode 100644 index 01ae6dd1..00000000 --- a/patch_makefileinc.txt +++ /dev/null @@ -1,21 +0,0 @@ -From 8044976424439224824e4dd265380bb2f750be1a Mon Sep 17 00:00:00 2001 -From: Matthew Feickert -Date: Fri, 16 Feb 2024 18:00:36 -0600 -Subject: [PATCH] Add .Makefile.inc for fastjet - ---- - .Makefile.inc | 3 +++ - 1 file changed, 3 insertions(+) - create mode 100644 .Makefile.inc - -diff --git a/.Makefile.inc b/.Makefile.inc -new file mode 100644 -index 0000000..595b3aa ---- /dev/null -+++ b/.Makefile.inc -@@ -0,0 +1,3 @@ -+# undefine variables defined in Makefile.in and each contrib Makefile -+undefine CXX=g++ -+undefine CXXFLAGS=-O2 -Wall -g --- -2.34.1 diff --git a/setup.py b/setup.py index 4f8d2fe5..0ae0cc57 100644 --- a/setup.py +++ b/setup.py @@ -97,21 +97,16 @@ def build_extensions(self): raise env = os.environ.copy() + env["CXX"] = env.get("CXX", "g++") env["ORIGIN"] = "$ORIGIN" # if evaluated, it will still be '$ORIGIN' subprocess.run(["make", "-j"], cwd=FASTJET, env=env, check=True) subprocess.run(["make", "install"], cwd=FASTJET, env=env, check=True) - subprocess.run( - ["patch", "./.Makefile.inc", DIR / "patch_makefileinc.txt"], - cwd=FASTJET_CONTRIB, - env=env, - check=True, - ) - subprocess.run( [ "./configure", f"--fastjet-config={FASTJET}/fastjet-config", + f'CXX={env["CXX"]}', "CXXFLAGS=-O3 -Bstatic -Bdynamic -std=c++17", ], cwd=FASTJET_CONTRIB,