Skip to content

Commit

Permalink
Merge pull request #143 from pycompression/furthersimplifybuild
Browse files Browse the repository at this point in the history
Do not use autotools for unix build
  • Loading branch information
rhpvorderman authored Mar 6, 2023
2 parents 2db9740 + 0898c81 commit fd66618
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11-dev"
- "3.11"
- "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Install build dependencies (Macos)
# Install yasm because nasm does not work when building wheels.
# Probably because of nasm-filter.sh not filtering all flags that can not be used.
run: brew install nasm automake autoconf
run: brew install nasm
if: runner.os == 'macOS'
- name: Set MSVC developer prompt
uses: ilammy/[email protected]
Expand All @@ -107,10 +107,6 @@ jobs:
matrix:
python_version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -198,7 +194,7 @@ jobs:
- name: Install cibuildwheel twine wheel
run: python -m pip install cibuildwheel twine wheel
- name: Install build dependencies (Macos)
run: brew install nasm automake autoconf
run: brew install nasm
if: runner.os == 'macOS'
- name: Set MSVC developer prompt
uses: ilammy/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Changelog
version 1.2.0-dev
-----------------
+ Speed-up source build by using ISA-L Unix-specific makefile rather than the
autotools build.
+ Simplify build setup. ISA-L release flags are now used and not
overwritten with python release flags when building the included static
library.
Expand Down
16 changes: 11 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import functools
import os
import platform
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -74,7 +75,7 @@ def build_extension(self, ext):
isa_l_build_dir = build_isa_l()
if SYSTEM_IS_UNIX:
ext.extra_objects = [
os.path.join(isa_l_build_dir, ".libs", "libisal.a")]
os.path.join(isa_l_build_dir, "bin", "isa-l.a")]
elif SYSTEM_IS_WINDOWS:
ext.extra_objects = [
os.path.join(isa_l_build_dir, "isa-l_static.lib")]
Expand Down Expand Up @@ -106,16 +107,21 @@ def build_isa_l():
# it.
build_env = os.environ.copy()
if SYSTEM_IS_UNIX:
build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -O2 -fPIC"
build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -fPIC"
if hasattr(os, "sched_getaffinity"):
cpu_count = len(os.sched_getaffinity(0))
else: # sched_getaffinity not available on all platforms
cpu_count = os.cpu_count() or 1 # os.cpu_count() can return None
run_args = dict(cwd=build_dir, env=build_env)
if SYSTEM_IS_UNIX:
subprocess.run(os.path.join(build_dir, "autogen.sh"), **run_args)
subprocess.run([os.path.join(build_dir, "configure")], **run_args)
subprocess.run(["make", "-j", str(cpu_count)], **run_args)
if platform.machine() == "aarch64":
cflags_param = "CFLAGS_aarch64"
else:
cflags_param = "CFLAGS_"
subprocess.run(["make", "-j", str(cpu_count), "-f", "Makefile.unx",
"isa-l.h", "bin/isa-l.a",
f"{cflags_param}={build_env.get('CFLAGS', '')}"],
**run_args)
elif SYSTEM_IS_WINDOWS:
subprocess.run(["nmake", "/f", "Makefile.nmake"], **run_args)
else:
Expand Down

0 comments on commit fd66618

Please sign in to comment.