Skip to content

Commit

Permalink
sys-firmware/iopmod: Add "modules +tools" USE flags
Browse files Browse the repository at this point in the history
Modules are typically built with a cross-compiler, such as with

USE="modules -tools" mipsr5900el-unknown-linux-gnu-emerge -v sys-firmware/iopmod

The modules will then be installed in the directory
/usr/mipsr5900el-unknown-linux-gnu/lib/firmware/ps2

It's possible to cross-compile the tools as well, but then with

USE="modules tools static" mipsr5900el-unknown-linux-gnu-emerge -v sys-firmware/iopmod

where "static" is needed for the tools to run with QEMU during
building. A typical error would otherwise be

qemu-mipsel:    Could not open '/lib/ld.so.1': No such file or directory

Also, if the error

qemu-mipsel: unable to find CPU model 'R5900'

occurs, the app-emulation/qemu-mipsr5900el package needs to be
installed and "interpreter /usr/bin/qemu-mipsr5900el" set in
/proc/sys/fs/binfmt_misc/qemu-mipsel.
  • Loading branch information
frno7 committed Apr 23, 2022
1 parent cde495d commit 17665bd
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions sys-firmware/iopmod/iopmod-9999.ebuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
EAPI=7

inherit toolchain-funcs

DESCRIPTION="PlayStation 2 input/output processor (IOP) modules and tools"
HOMEPAGE="https://github.com/frno7/iopmod"

Expand All @@ -17,7 +19,7 @@ fi

LICENSE="GPL-2 MIT"
SLOT="0"
IUSE="static"
IUSE="modules +tools static"

RDEPEND=""
DEPEND=""
Expand All @@ -34,11 +36,32 @@ src_compile() {

use static && LDFLAGS+=" -static"

emake LDFLAGS="${LDFLAGS}" V=1 tool || die
if use tools
then
emake CC="$(tc-getCC)" AR="$(tc-getAR)" \
LDFLAGS="${LDFLAGS}" V=1 tool || die
fi

if use modules
then
emake CC="$(tc-getBUILD_CC)" AR="$(tc-getBUILD_AR)" \
CCC="$(tc-getCC)" CLD="$(tc-getLD)" \
CFLAGS="-Wall -Iinclude" \
LDFLAGS="${LDFLAGS}" V=1 module || die
fi
}

src_install() {
dobin tool/iopmod-info
dobin tool/iopmod-link
dobin tool/iopmod-symc
if use tools
then
dobin tool/iopmod-info
dobin tool/iopmod-link
dobin tool/iopmod-symc
fi

if use modules
then
insinto /lib/firmware/ps2
doins module/*.irx
fi
}

0 comments on commit 17665bd

Please sign in to comment.