Skip to content

Commit 205cc7a

Browse files
committed
Revert "Enable PIC rather than relying on environment to do so"
This reverts commit b5b0980.
1 parent b5b0980 commit 205cc7a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

setup.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,25 @@ def build_isa_l():
101101
build_dir = tempfile.mktemp()
102102
shutil.copytree(ISA_L_SOURCE, build_dir)
103103

104+
# Build environment is a copy of OS environment to allow user to influence
105+
# it.
106+
build_env = os.environ.copy()
107+
if SYSTEM_IS_UNIX:
108+
build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -fPIC"
104109
if hasattr(os, "sched_getaffinity"):
105110
cpu_count = len(os.sched_getaffinity(0))
106111
else: # sched_getaffinity not available on all platforms
107112
cpu_count = os.cpu_count() or 1 # os.cpu_count() can return None
113+
run_args = dict(cwd=build_dir, env=build_env)
108114
if SYSTEM_IS_UNIX:
109115
make_cmd = "make"
110116
if SYSTEM_IS_BSD:
111117
make_cmd = "gmake"
112-
subprocess.run(os.path.join(build_dir, "autogen.sh"), cwd=build_dir)
113-
subprocess.run(
114-
[os.path.join(build_dir, "configure"), "--enable-pic"],
115-
cwd=build_dir)
116-
subprocess.run([make_cmd, "-j", str(cpu_count)], cwd=build_dir)
118+
subprocess.run(os.path.join(build_dir, "autogen.sh"), **run_args)
119+
subprocess.run([os.path.join(build_dir, "configure")], **run_args)
120+
subprocess.run([make_cmd, "-j", str(cpu_count)], **run_args)
117121
elif SYSTEM_IS_WINDOWS:
118-
subprocess.run(["nmake", "/f", "Makefile.nmake"], cwd=build_dir)
122+
subprocess.run(["nmake", "/f", "Makefile.nmake"], **run_args)
119123
else:
120124
raise NotImplementedError(f"Unsupported platform: {sys.platform}")
121125
shutil.copytree(os.path.join(build_dir, "include"),

0 commit comments

Comments
 (0)