2022-04-05 10:52:08 +02:00
|
|
|
# Copyright 1999-2022 Gentoo Authors
|
2017-11-10 12:02:18 +01:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
2022-02-23 19:17:30 +01:00
|
|
|
EAPI="7"
|
|
|
|
|
2023-04-06 11:47:15 +02:00
|
|
|
inherit toolchain-funcs linux-mod udev
|
2022-02-23 19:17:30 +01:00
|
|
|
|
|
|
|
if [[ ${PV} = 9999* ]]; then
|
2022-04-05 10:52:08 +02:00
|
|
|
inherit git-r3
|
|
|
|
EGIT_REPO_URI="https://github.com/OpenCBM/OpenCBM.git"
|
2022-02-23 19:17:30 +01:00
|
|
|
else
|
2022-04-05 10:52:08 +02:00
|
|
|
#SRC_URI="http://debian.trikaliotis.net/opencbm/opencbm_${PV}-1.tar.gz"
|
|
|
|
#SRC_URI="http://www.trikaliotis.net/Download/opencbm-${PV}/opencbm-${PV}-source.tar.bz2"
|
|
|
|
SRC_URI="https://github.com/OpenCBM/OpenCBM/archive/v${PV//./_}.tar.gz -> opencbm-${PV}-source.tar.gz
|
2023-04-06 11:47:15 +02:00
|
|
|
https://github.com/OpenCBM/nibtools/archive/master.tar.gz -> nibtools-${PV}-source.tar.gz"
|
2022-04-05 10:52:08 +02:00
|
|
|
KEYWORDS="~amd64 ~ppc ~sparc ~x86"
|
2022-02-23 19:17:30 +01:00
|
|
|
fi
|
2017-11-10 12:02:18 +01:00
|
|
|
|
|
|
|
SDIR="include libmisc arch/linux lib cbmctrl cbmformat d64copy cbmcopy libtrans cbmforng d82copy demo/flash demo/morse demo/rpm1541 sample/libtrans cbmrpm41"
|
|
|
|
|
2022-04-05 10:52:08 +02:00
|
|
|
DESCRIPTION="OpenCBM is a tool to use serial devices as used by most Commodore (CBM) machines"
|
2023-04-06 11:47:15 +02:00
|
|
|
HOMEPAGE="https://opencbm.trikaliotis.net/"
|
2017-11-10 12:02:18 +01:00
|
|
|
LICENSE="GPL-2"
|
|
|
|
SLOT="0"
|
|
|
|
IUSE="doc"
|
|
|
|
DEPEND="virtual/linux-sources
|
|
|
|
dev-embedded/cc65
|
|
|
|
app-text/linuxdoc-tools
|
|
|
|
app-text/docbook-xml-dtd:4.1.2
|
2022-04-05 10:52:08 +02:00
|
|
|
virtual/libusb:0"
|
2021-06-30 18:45:43 +02:00
|
|
|
S="${WORKDIR}"/OpenCBM-${PV//./_}
|
2017-11-10 12:02:18 +01:00
|
|
|
|
|
|
|
BUILD_PARAMS="KDIR=$KERNEL_DIR"
|
|
|
|
MODULE_NAMES="cbm(misc:${S}/opencbm/sys/linux:${S}/opencbm/sys/linux)"
|
|
|
|
BUILD_TARGETS="all"
|
|
|
|
|
|
|
|
src_prepare() {
|
|
|
|
rm -rf "${WORKDIR}"/${PN}-${PV}/{cbm4wingui,gui4cbm4win.vb6.old,windrv}
|
|
|
|
# convert linefeed
|
|
|
|
#edos2unix `find . -name '*' -type f`
|
|
|
|
# 6502 sources ar always up to date
|
|
|
|
touch `find . -name '*.?65' -type f`
|
|
|
|
# add debian patches no demo & doc & no kernel
|
2022-02-23 19:17:30 +01:00
|
|
|
eapply "${FILESDIR}/001_opencbm-0.4.99.98-ncurses6-1.patch"
|
2017-11-10 12:02:18 +01:00
|
|
|
# sed correct path
|
|
|
|
sed -e 's,^PREFIX.*,PREFIX = /usr,' \
|
2022-04-05 10:52:08 +02:00
|
|
|
-e 's,/man/man1,/share/man/man1,g' \
|
|
|
|
-e 's,etc/udev/rules.d,lib/udev/rules.d,g' \
|
|
|
|
-e 's,/info,/share/info,g' -i "${S}"/opencbm/LINUX/config.make
|
2017-11-10 12:02:18 +01:00
|
|
|
# sed correct path
|
2022-02-23 19:17:30 +01:00
|
|
|
sed -e 's,xa1541 opencbm/sys/linux/,xa1541,g' \
|
2022-04-05 10:52:08 +02:00
|
|
|
-e 's,etc/udev/rules.d,lib/udev/rules.d,g' -i "${S}"/LINUX/Makefile
|
2017-11-10 12:02:18 +01:00
|
|
|
# copy module makefile that don't intefer with gentoo kernel build system
|
2022-04-05 10:52:08 +02:00
|
|
|
cp "${FILESDIR}"/Makefile "${S}"/opencbm/sys/linux/Makefile
|
|
|
|
cp -r "${WORKDIR}"/OpenCBM-nibtools-*/* "${S}"/opencbm/nibtools/
|
2022-02-23 19:17:30 +01:00
|
|
|
eapply_user
|
2017-11-10 12:02:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
2022-02-23 19:17:30 +01:00
|
|
|
emake -j1 -f LINUX/Makefile CC="$(tc-getCC)" AR="$(tc-getAR)" LIBDIR="/usr/$(get_libdir)" all || die "make fail"
|
|
|
|
emake -j1 -f LINUX/Makefile CC="$(tc-getCC)" AR="$(tc-getAR)" LIBDIR="/usr/$(get_libdir)" opencbm || die "make fail"
|
2017-11-10 12:02:18 +01:00
|
|
|
linux-mod_src_compile
|
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
|
|
|
dodir lib/udev/rules.d
|
|
|
|
dodir etc/opencbm.conf.d
|
|
|
|
dodir usr/lib/opencbm
|
2022-02-23 19:17:30 +01:00
|
|
|
emake -f LINUX/Makefile DESTDIR="${D}" LIBDIR="/usr/$(get_libdir)" install-all
|
2017-11-10 12:02:18 +01:00
|
|
|
exeinto usr/lib/opencbm
|
|
|
|
doexe opencbm/LINUX/plugin_helper_tools
|
|
|
|
newexe debian/install_plugin.sh install_plugin
|
|
|
|
insinto lib/udev/rules.d
|
|
|
|
newins opencbm/sys/linux/45-opencbm-xa1541.rules 45-opencbm-xa1541.rules
|
2022-04-05 10:52:08 +02:00
|
|
|
rm -rf "${D}"/var
|
2017-11-10 12:02:18 +01:00
|
|
|
linux-mod_src_install
|
2023-04-06 11:47:15 +02:00
|
|
|
# generate_modulesd
|
2017-11-10 12:02:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_postinst() {
|
2023-04-06 11:47:15 +02:00
|
|
|
udev_reload
|
2022-04-05 10:52:08 +02:00
|
|
|
linux-mod_pkg_postinst
|
|
|
|
"${EROOT}"/usr/lib/opencbm/install_plugin install xa1541
|
|
|
|
"${EROOT}"/usr/lib/opencbm/install_plugin install xu1541
|
|
|
|
"${EROOT}"/usr/lib/opencbm/install_plugin install xum1541
|
2017-11-10 12:02:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_prerm() {
|
2022-04-05 10:52:08 +02:00
|
|
|
"${EROOT}"/usr/lib/opencbm/install_plugin uninstall xa1541
|
|
|
|
"${EROOT}"/usr/lib/opencbm/install_plugin uninstall xu1541
|
|
|
|
"${EROOT}"/usr/lib/opencbm/install_plugin uninstall xum1541
|
2017-11-10 12:02:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_postrm() {
|
2022-04-05 10:52:08 +02:00
|
|
|
linux-mod_pkg_postrm
|
2023-04-06 11:47:15 +02:00
|
|
|
udev_reload
|
2017-11-10 12:02:18 +01:00
|
|
|
}
|