Skip to content

Gentoo multilib ebuild for glxosd - build fails when the 32-bit section is enabled / 64-bit section works fine! #97

Description

@bobwya

Hiya,

I'm trying to create a Gentoo package for your project to put on my Gentoo Overlay... Currently glxosd is not available in either the official Portage tree or any Layman-supported Overlay.

Basically I hit a roadblock some months ago and shelved the project... glxosd will build and run fine - but only the native 64-bit part. As soon as I try to build the 32-bit part - I get linker errors - because the 32-bit glxosd is trying to link against a 64-bit luajit subproject. But the 64-bit luajit subproject is being built in the 32-bit build directory!!

It's very hard to patch anything (cough, cough) - because so many subprojects are automagically pulled in by git. The MAKEFILE creation and building of luajit all occurs within a single Gentoo function in the ebuild build script (multilib_src_compile). I've tried a few hacky workarounds in my ebuild but nothing has worked around the issue...

See the full build log at https://gist.githubusercontent.com/bobwya/8cbfbef94d573a1a3f0fa53a81b83fed/raw/9e07d2e813148345d5274dab0cfbb1e707d32cdc/gistfile1.txt

# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit cmake-multilib multilib toolchain-funcs git-r3

MY_PN="GLXOSD"
MY_P="${MY_PN}-${PV}"

DESCRIPTION="GLXOSD is an on-screen overlay for X11/OpenGL applications running on Linux."
HOMEPAGE="https://glxosd.nickguletskii.com"

if [[ ${PV} == "9999" ]] ; then
	EGIT_REPO_URI="https://github.com/nickguletskii/${MY_PN}.git"
	EGIT3_STORE_DIR="${EGIT3_STORE_DIR:-${T}}"
	EGIT_CHECKOUT_DIR="${WORKDIR}/${MY_P}"
	EGIT_BRANCH="master"
else
	SRC_URI="https://github.com/nickguletskii/${MY_PN}/archive/v${PV}.tar.gz"
	KEYWORDS="-* ~amd64 ~x86"
fi

LICENSE="all-rights-reserved"
SLOT="0"
IUSE="+abi_x86_32 +abi_x86_64"
REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )"

DEPEND="media-libs/fontconfig[${MULTILIB_USEDEP}]
		media-libs/freetype:2[${MULTILIB_USEDEP}]
		media-libs/glew[${MULTILIB_USEDEP}]
		virtual/glu[${MULTILIB_USEDEP}]
		x11-libs/libXext[${MULTILIB_USEDEP}]"
RDEPEND="${DEPEND}
		media-libs/mesa[${MULTILIB_USEDEP}]
		sys-apps/lm_sensors"

S="${WORKDIR}/${MY_P}"

foreachabi() {
        if use multilib; then
                local ABI
                for ABI in $(get_all_abis); do
                        multilib_toolchain_setup ${ABI}
                        AUTOTOOLS_BUILD_DIR=${WORKDIR}/${ABI} "${@}"
                done
        else
                "${@}"
        fi
}

src_unpack() {
	if [[ "${PV}" == 9999 ]]; then
		git-r3_src_unpack
	else
		unpack "${A}"
		EGIT3_STORE_DIR="${EGIT3_STORE_DIR:-${T}}"
		EGIT_BRANCH="strdup-fix"
		EGIT_REPO_URI="https://github.com/nickguletskii/freetype-gl.git"
		EGIT_CHECKOUT_DIR="${S}/src/freetype-gl-glxosd/freetype-gl"
		git-r3_src_unpack
	fi
}

src_prepare() {
	enable_cmake-utils_src_prepare
	cmake-utils_src_prepare
	abi_prepare() {
		multilib_toolchain_setup $(get_abi)
	}
	multilib_foreach_abi abi_prepare
}

src_configure() {
	abi_configure() {
		local mycmakeargs=(
				-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
				-DCMAKE_BINARY_DIR="${EPREFIX}/usr/bin"
				-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$(get_abi_LIBDIR)"
				-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(get_abi_LIBDIR)"
				-DCMAKE_LIBRARY_PATH="$(get_abi_LIBDIR)"
		)
		if [[ "${ABI}" == "amd64" ]]; then
			mycmakeargs+=(
				-DLIB_SUFFIX="64"
				-DINSTALLATION_SUFFIX_64="$(get_abi_LIBDIR)"
			)
		else
			mycmakeargs+=(
				-DLIB_SUFFIX="32"
				-DINSTALLATION_SUFFIX_32="$(get_abi_LIBDIR)"
			)
		fi
		cmake-utils_src_configure
	}
	multilib_foreach_abi abi_configure
}

src_compile() {
	abi_src_compile() {
		debug-print-function ${FUNCNAME} "$@"
		pushd "${BUILD_DIR}" >/dev/null || die
		multilib_src_compile
		popd >/dev/null || die
	}
	multilib_foreach_abi abi_src_compile
}

src_install() {
	cmake-multilib_src_install
	sed -i	-e 's:^GLXOSD_LIBRARY_PATH_I386="/usr//lib/i386-linux-gnu//glxosd/":GLXOSD_LIBRARY_PATH_I386="/usr/lib32/glxosd/":g' \
			-e 's:^GLXOSD_LIBRARY_PATH_AMD64="/usr//lib/x86_64-linux-gnu//glxosd/":GLXOSD_LIBRARY_PATH_AMD64="/usr/lib64/glxosd/":g' \
			"${D}/usr/bin/glxosd" || die "sed failed"
	chmod 755 "${D}/usr/bin/glxosd" || die "chmod failed"
	default
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions