From fc6fd10b22e18f1729a45a56ccd71fca410be662 Mon Sep 17 00:00:00 2001 From: Artemis Everfree Date: Wed, 13 Nov 2024 17:50:32 -0800 Subject: dev-lang/luajit: fix LJLIBD not relative to PREFIX luajit contains a hardcoded path (LJLIBD) where it searches for some lua libraries it installs. This patch was previously defined relative to PREFIX. Upstream commit ae4735f [1] changes them to be defined relative to DPREFIX, which is in turn relative to DESTDIR. I believe this is a bug, which I've reported upstream [2]. This commit patches the Makefile to define LJLIBD relative to PREFIX again. 1: https://github.com/LuaJIT/LuaJIT/commit/ae4735f621d89d84758769b76432d2319dda9827 2: https://github.com/LuaJIT/LuaJIT/issues/1303 Closes: https://bugs.gentoo.org/943395 Closes: https://bugs.gentoo.org/943346 Signed-off-by: Artemis Everfree Closes: https://github.com/gentoo/gentoo/pull/39311 Signed-off-by: Sam James --- .../luajit-2.1.1727870382-fix-ljlibd-prefix.patch | 25 ++++++ dev-lang/luajit/luajit-2.1.1727870382-r1.ebuild | 96 ++++++++++++++++++++++ dev-lang/luajit/luajit-2.1.1727870382.ebuild | 95 --------------------- dev-lang/luajit/luajit-2.1.9999999999.ebuild | 1 + 4 files changed, 122 insertions(+), 95 deletions(-) create mode 100644 dev-lang/luajit/files/luajit-2.1.1727870382-fix-ljlibd-prefix.patch create mode 100644 dev-lang/luajit/luajit-2.1.1727870382-r1.ebuild delete mode 100644 dev-lang/luajit/luajit-2.1.1727870382.ebuild (limited to 'dev-lang') diff --git a/dev-lang/luajit/files/luajit-2.1.1727870382-fix-ljlibd-prefix.patch b/dev-lang/luajit/files/luajit-2.1.1727870382-fix-ljlibd-prefix.patch new file mode 100644 index 000000000000..98ae276fcc9f --- /dev/null +++ b/dev-lang/luajit/files/luajit-2.1.1727870382-fix-ljlibd-prefix.patch @@ -0,0 +1,25 @@ +# LJLIBD is traversed at runtime, should be relative to +# PREFIX instead of DESTDIR/PREFIX +# +# https://github.com/LuaJIT/LuaJIT/issues/1303 +# https://bugs.gentoo.org/943395 + +--- a/Makefile ++++ b/Makefile +@@ -37,12 +37,13 @@ + DPREFIX= $(DESTDIR)$(PREFIX) + INSTALL_BIN= $(DPREFIX)/bin + INSTALL_LIB= $(DPREFIX)/$(MULTILIB) +-INSTALL_SHARE= $(DPREFIX)/share ++INSTALL_SHARE_LOCAL= $(PREFIX)/share ++INSTALL_SHARE= $(DESTDIR)$(INSTALL_SHARE_LOCAL) + INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MMVERSION) + INSTALL_INC= $(INSTALL_DEFINC) + +-export INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(MMVERSION) +-INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit ++export INSTALL_LJLIBD= $(INSTALL_SHARE_LOCAL)/luajit-$(MMVERSION) ++INSTALL_JITLIB= $(DESTDIR)$(INSTALL_LJLIBD)/jit + INSTALL_LMODD= $(INSTALL_SHARE)/lua + INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER) + INSTALL_CMODD= $(INSTALL_LIB)/lua diff --git a/dev-lang/luajit/luajit-2.1.1727870382-r1.ebuild b/dev-lang/luajit/luajit-2.1.1727870382-r1.ebuild new file mode 100644 index 000000000000..c3beab8c9c1a --- /dev/null +++ b/dev-lang/luajit/luajit-2.1.1727870382-r1.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# Upstream doesn't make releases anymore and instead have a (broken) "rolling +# git tag" model. +# +# https://github.com/LuaJIT/LuaJIT/issues/665#issuecomment-784452583 +# https://www.freelists.org/post/luajit/LuaJIT-uses-rolling-releases +# +# Regular snapshots should be made from the v2.1 branch. Get the version with +# `git show -s --format=%ct` + +inherit toolchain-funcs + +# Split release channel (such as "2.1") from relver (such as "1727870382") +VER_CHANNEL=${PV%.*} +VER_RELVER=${PV##*.} + +DESCRIPTION="Just-In-Time Compiler for the Lua programming language" +HOMEPAGE="https://luajit.org/" + +if [[ ${VER_RELVER} == 9999999999 ]]; then + # Upstream recommends pulling rolling releases from versioned branches. + # > The old git master branch is phased out and stays pinned to the v2.0 + # > branch. Please follow the versioned branches instead. + # + # See http://luajit.org/status.html for additional information. + EGIT_BRANCH="v${VER_CHANNEL}" + EGIT_REPO_URI="https://luajit.org/git/luajit.git" + inherit git-r3 +else + # Update this commit hash to bump a pinned-commit ebuild. + GIT_COMMIT=97813fb924edf822455f91a5fbbdfdb349e5984f + SRC_URI="https://github.com/LuaJIT/LuaJIT/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz" + S="${WORKDIR}/LuaJIT-${GIT_COMMIT}" + + KEYWORDS="~amd64 ~arm ~arm64 -hppa ~mips ~ppc -riscv -sparc ~x86 ~amd64-linux ~x86-linux" +fi + +LICENSE="MIT" +# this should probably be pkgmoved to 2.1 for sake of consistency. +SLOT="2/${PV}" +IUSE="lua52compat static-libs" +PATCHES=( "${FILESDIR}/${PN}-2.1.1727870382-fix-ljlibd-prefix.patch" ) + +_emake() { + emake \ + Q= \ + PREFIX="${EPREFIX}/usr" \ + MULTILIB="$(get_libdir)" \ + DESTDIR="${D}" \ + CFLAGS="" \ + LDFLAGS="" \ + HOST_CC="$(tc-getBUILD_CC)" \ + HOST_CFLAGS="${BUILD_CPPFLAGS} ${BUILD_CFLAGS}" \ + HOST_LDFLAGS="${BUILD_LDFLAGS}" \ + STATIC_CC="$(tc-getCC)" \ + DYNAMIC_CC="$(tc-getCC) -fPIC" \ + TARGET_LD="$(tc-getCC)" \ + TARGET_CFLAGS="${CPPFLAGS} ${CFLAGS}" \ + TARGET_LDFLAGS="${LDFLAGS}" \ + TARGET_AR="$(tc-getAR) rcus" \ + BUILDMODE="$(usex static-libs mixed dynamic)" \ + TARGET_STRIP="true" \ + INSTALL_LIB="${ED}/usr/$(get_libdir)" \ + "$@" +} + +src_compile() { + tc-export_build_env + _emake XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")" +} + +src_install() { + _emake install + + # For tarballs downloaded from github, the relver is provided in + # ${S}/.relver, a file populated when generating the tarball as directed by + # .gitattributes. That file will contain the same relver as the relver + # in our version number. + # + # For the live build, this is not populated, but luajit's build process + # inspects the git repository directly with this command: + # + # git show -s --format=%ct + # + # In both cases, luajit puts the relver in src/luajit_relver.txt during + # the build. We read this file to ensure we're using the same source of + # truth as luajit's own build does when generating the binary's filename. + local relver="$(cat "${S}/src/luajit_relver.txt" || die 'error retrieving relver')" + dosym luajit-"${VER_CHANNEL}.${relver}" /usr/bin/luajit + + HTML_DOCS="doc/." einstalldocs +} diff --git a/dev-lang/luajit/luajit-2.1.1727870382.ebuild b/dev-lang/luajit/luajit-2.1.1727870382.ebuild deleted file mode 100644 index ba62499c0453..000000000000 --- a/dev-lang/luajit/luajit-2.1.1727870382.ebuild +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -# Upstream doesn't make releases anymore and instead have a (broken) "rolling -# git tag" model. -# -# https://github.com/LuaJIT/LuaJIT/issues/665#issuecomment-784452583 -# https://www.freelists.org/post/luajit/LuaJIT-uses-rolling-releases -# -# Regular snapshots should be made from the v2.1 branch. Get the version with -# `git show -s --format=%ct` - -inherit toolchain-funcs - -# Split release channel (such as "2.1") from relver (such as "1727870382") -VER_CHANNEL=${PV%.*} -VER_RELVER=${PV##*.} - -DESCRIPTION="Just-In-Time Compiler for the Lua programming language" -HOMEPAGE="https://luajit.org/" - -if [[ ${VER_RELVER} == 9999999999 ]]; then - # Upstream recommends pulling rolling releases from versioned branches. - # > The old git master branch is phased out and stays pinned to the v2.0 - # > branch. Please follow the versioned branches instead. - # - # See http://luajit.org/status.html for additional information. - EGIT_BRANCH="v${VER_CHANNEL}" - EGIT_REPO_URI="https://luajit.org/git/luajit.git" - inherit git-r3 -else - # Update this commit hash to bump a pinned-commit ebuild. - GIT_COMMIT=97813fb924edf822455f91a5fbbdfdb349e5984f - SRC_URI="https://github.com/LuaJIT/LuaJIT/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz" - S="${WORKDIR}/LuaJIT-${GIT_COMMIT}" - - KEYWORDS="~amd64 ~arm ~arm64 -hppa ~mips ~ppc -riscv -sparc ~x86 ~amd64-linux ~x86-linux" -fi - -LICENSE="MIT" -# this should probably be pkgmoved to 2.1 for sake of consistency. -SLOT="2/${PV}" -IUSE="lua52compat static-libs" - -_emake() { - emake \ - Q= \ - PREFIX="${EPREFIX}/usr" \ - MULTILIB="$(get_libdir)" \ - DESTDIR="${D}" \ - CFLAGS="" \ - LDFLAGS="" \ - HOST_CC="$(tc-getBUILD_CC)" \ - HOST_CFLAGS="${BUILD_CPPFLAGS} ${BUILD_CFLAGS}" \ - HOST_LDFLAGS="${BUILD_LDFLAGS}" \ - STATIC_CC="$(tc-getCC)" \ - DYNAMIC_CC="$(tc-getCC) -fPIC" \ - TARGET_LD="$(tc-getCC)" \ - TARGET_CFLAGS="${CPPFLAGS} ${CFLAGS}" \ - TARGET_LDFLAGS="${LDFLAGS}" \ - TARGET_AR="$(tc-getAR) rcus" \ - BUILDMODE="$(usex static-libs mixed dynamic)" \ - TARGET_STRIP="true" \ - INSTALL_LIB="${ED}/usr/$(get_libdir)" \ - "$@" -} - -src_compile() { - tc-export_build_env - _emake XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")" -} - -src_install() { - _emake install - - # For tarballs downloaded from github, the relver is provided in - # ${S}/.relver, a file populated when generating the tarball as directed by - # .gitattributes. That file will contain the same relver as the relver - # in our version number. - # - # For the live build, this is not populated, but luajit's build process - # inspects the git repository directly with this command: - # - # git show -s --format=%ct - # - # In both cases, luajit puts the relver in src/luajit_relver.txt during - # the build. We read this file to ensure we're using the same source of - # truth as luajit's own build does when generating the binary's filename. - local relver="$(cat "${S}/src/luajit_relver.txt" || die 'error retrieving relver')" - dosym luajit-"${VER_CHANNEL}.${relver}" /usr/bin/luajit - - HTML_DOCS="doc/." einstalldocs -} diff --git a/dev-lang/luajit/luajit-2.1.9999999999.ebuild b/dev-lang/luajit/luajit-2.1.9999999999.ebuild index f8f7cfba19d2..a27f77162d26 100644 --- a/dev-lang/luajit/luajit-2.1.9999999999.ebuild +++ b/dev-lang/luajit/luajit-2.1.9999999999.ebuild @@ -43,6 +43,7 @@ LICENSE="MIT" # this should probably be pkgmoved to 2.1 for sake of consistency. SLOT="2/${PV}" IUSE="lua52compat static-libs" +PATCHES=( "${FILESDIR}/${PN}-2.1.1727870382-fix-ljlibd-prefix.patch" ) _emake() { emake \ -- cgit v1.2.3-65-gdbad