Skip to content

Commit

Permalink
Use the version of oniguruma distributed with jq
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilliamson committed Nov 10, 2023
1 parent 9def21d commit b345d2c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog

* Include tox.ini in sdist.

* Use the version of oniguruma distributed with jq.

1.6.0
-----

Expand Down
Binary file removed deps/onig-6.9.8.tar.gz
Binary file not shown.
21 changes: 2 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,19 @@ def _read(fname):
jq_lib_tarball_path = _dep_source_path("jq-1.7.tar.gz")
jq_lib_dir = _dep_build_path("jq-1.7")

oniguruma_version = "6.9.8"
oniguruma_lib_tarball_path = _dep_source_path("onig-{}.tar.gz".format(oniguruma_version))
oniguruma_lib_build_dir = _dep_build_path("onig-{}".format(oniguruma_version))
oniguruma_lib_install_dir = _dep_build_path("onig-install-{}".format(oniguruma_version))

class jq_with_deps_build_ext(build_ext):
def run(self):
if not os.path.exists(_dep_build_path(".")):
os.makedirs(_dep_build_path("."))
self._build_oniguruma()
self._build_libjq()
build_ext.run(self)

def _build_oniguruma(self):
self._build_lib(
tarball_path=oniguruma_lib_tarball_path,
lib_dir=oniguruma_lib_build_dir,
commands=[
["./configure", "CFLAGS=-fPIC", "--prefix=" + oniguruma_lib_install_dir],
["make"],
["make", "install"],
])


def _build_libjq(self):
self._build_lib(
tarball_path=jq_lib_tarball_path,
lib_dir=jq_lib_dir,
commands=[
["./configure", "CFLAGS=-fPIC -pthread", "--disable-maintainer-mode", "--with-oniguruma=" + oniguruma_lib_install_dir],
["./configure", "CFLAGS=-fPIC -pthread", "--disable-maintainer-mode", "--with-oniguruma=builtin"],
["make"],
])

Expand Down Expand Up @@ -95,7 +78,7 @@ def _extract_tarball(self, tarball_path, lib_dir):
link_args_deps = []
extra_objects = [
os.path.join(jq_lib_dir, ".libs/libjq.a"),
os.path.join(oniguruma_lib_install_dir, "lib/libonig.a"),
os.path.join(jq_lib_dir, "modules/oniguruma/src/.libs/libonig.a"),
]


Expand Down

0 comments on commit b345d2c

Please sign in to comment.