portapack-mayhem: add release, make sdcard-files optional

This commit is contained in:
Rick Farina (Zero_Chaos) 2020-08-20 17:15:14 -04:00
parent 49acf0c625
commit 305c5f50ce
No known key found for this signature in database
GPG key ID: A29433C0AA431DDC
3 changed files with 125 additions and 10 deletions

View file

@ -0,0 +1,2 @@
DIST mayhem_v1.2_COPY_TO_SDCARD.7z 405890725 BLAKE2B e01fec0d2d5fb6e1df72a60a298f4f3f778b41acfb4e35f4e6f2e989450981b0c9c13032a52989eb1d501aae3ace10fd768cf99dda5af5831c9d211ca51b8194 SHA512 804b58781921ead6dbf4f35f8cab155ab59440f61117d355996b349b178a56503f17b1f3fea9451785e1e77fc84395c51832c744f3b0269a30e581588c72a2db
DIST mayhem_v1.2_FIRMWARE.7z 3718779 BLAKE2B 163d6bd18cec47e68f29c3483146024520846835c02cfb7f27a0ecff99f94ea3fe04b09c3b6ddc0b292c1b3e6c8145ada742ee27827574f368881cdc025381e9 SHA512 89bbdaa75b6547274d3e1868d97039e98cf0800848ce481b29952ef97fdc470cf82d5c6b7151b71d5a180c9b90638378a1559f3ca5477b23390fa4526897dede

View file

@ -0,0 +1,78 @@
# Copyright 1999-2020 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="Custom firmware for the HackRF SDR + PortaPack H1 addon"
HOMEPAGE="https://github.com/eried/portapack-mayhem"
LICENSE="GPL-2"
SLOT="0"
IUSE="sdcard-files"
if [ "${PV}" == "9999" ]; then
inherit cmake git-r3
EGIT_REPO_URI="https://github.com/eried/portapack-mayhem.git"
EGIT_BRANCH="next"
else
KEYWORDS="~amd64 ~arm ~x86"
SRC_URI="https://github.com/eried/portapack-mayhem/releases/download/${PV}/mayhem_v${PV}_FIRMWARE.7z
sdcard-files? ( https://github.com/eried/portapack-mayhem/releases/download/${PV}/mayhem_v${PV}_COPY_TO_SDCARD.7z )"
fi
DEPEND="sys-devel/gcc-arm-none-eabi"
PDEPEND=">=net-wireless/hackrf-tools-2015.07.2-r1
>=app-mobilephone/dfu-util-0.7"
src_unpack() {
if [ "${PV}" = 9999 ]; then
git-r3_src_unpack
else
#upstream tarballs unpack into currect directory
mkdir ${P}
pushd ${P}
unpack mayhem_v${PV}_FIRMWARE.7z
if use sdcard-files; then
mkdir sdcard
pushd sdcard
unpack mayhem_v${PV}_COPY_TO_SDCARD.7z
fi
fi
}
src_configure() {
if [ "${PV}" = "9999" ]; then
strip-flags
filter-flags "-march=*" "-mtune=*"
cmake_src_configure
else
true
fi
}
src_compile() {
if [ "${PV}" = "9999" ]; then
V=1 cmake_src_compile
else
true
fi
}
src_install() {
insinto /usr/share/${PN}
if [ "${PV}" = "9999" ]; then
newins "${BUILD_DIR}/firmware/portapack-h1_h2-mayhem.bin" "portapack-h1_h2-mayhem-${PV}.bin"
else
newins "${S}/portapack-h1_h2-mayhem.bin" "portapack-h1_h2-mayhem-${PV}.bin"
fi
use sdcard-files && doins -r "${S}"/sdcard
dodir /usr/share/hackrf
ln -s ../${PN}/portapack-h1_h2-mayhem-${PV}.bin "${ED}/usr/share/hackrf/portapack-h1_h2-mayhem.bin" || die
}
pkg_postint() {
if ! use sdcard-files; then
ewarn "sdcard-files use flag is not enabled but these files are *required* for operation"
ewarn "it is a good idea to copy these files on the sdcard on your portapack from time to time"
fi
}

View file

@ -3,41 +3,76 @@
EAPI=7
inherit cmake
DESCRIPTION="Custom firmware for the HackRF SDR + PortaPack H1 addon"
HOMEPAGE="https://github.com/eried/portapack-mayhem"
LICENSE="GPL-2"
SLOT="0"
IUSE=""
IUSE="sdcard-files"
if [ "${PV}" == "9999" ]; then
inherit git-r3
inherit cmake git-r3
EGIT_REPO_URI="https://github.com/eried/portapack-mayhem.git"
EGIT_BRANCH="next"
else
KEYWORDS="~amd64 ~arm ~x86"
SRC_URI="https://github.com/eried/portapack-mayhem/releases/download/${PV}/mayhem_v${PV}_FIRMWARE.7z
sdcard-files? ( https://github.com/eried/portapack-mayhem/releases/download/${PV}/mayhem_v${PV}_COPY_TO_SDCARD.7z )"
fi
DEPEND="sys-devel/gcc-arm-none-eabi"
PDEPEND=">=net-wireless/hackrf-tools-2015.07.2-r1
>=app-mobilephone/dfu-util-0.7"
src_unpack() {
if [ "${PV}" = 9999 ]; then
git-r3_src_unpack
else
#upstream tarballs unpack into currect directory
mkdir ${P}
pushd ${P}
unpack mayhem_v${PV}_FIRMWARE.7z
if use sdcard-files; then
mkdir sdcard
pushd sdcard
unpack mayhem_v${PV}_COPY_TO_SDCARD.7z
fi
fi
}
src_configure() {
strip-flags
filter-flags "-march=*" "-mtune=*"
cmake_src_configure
if [ "${PV}" = "9999" ]; then
strip-flags
filter-flags "-march=*" "-mtune=*"
cmake_src_configure
else
true
fi
}
src_compile() {
V=1 cmake_src_compile
if [ "${PV}" = "9999" ]; then
V=1 cmake_src_compile
else
true
fi
}
src_install() {
insinto /usr/share/${PN}
doins -r "${S}"/sdcard
newins ${BUILD_DIR}/firmware/portapack-h1_h2-mayhem.bin portapack-h1_h2-mayhem-${PV}.bin
if [ "${PV}" = "9999" ]; then
newins "${BUILD_DIR}/firmware/portapack-h1_h2-mayhem.bin" "portapack-h1_h2-mayhem-${PV}.bin"
else
newins "${S}/portapack-h1_h2-mayhem.bin" "portapack-h1_h2-mayhem-${PV}.bin"
fi
use sdcard-files && doins -r "${S}"/sdcard
dodir /usr/share/hackrf
ln -s ../${PN}/portapack-h1_h2-mayhem-${PV}.bin "${ED}/usr/share/hackrf/portapack-h1_h2-mayhem.bin" || die
}
pkg_postint() {
if ! use sdcard-files; then
ewarn "sdcard-files use flag is not enabled but these files are *required* for operation"
ewarn "it is a good idea to copy these files on the sdcard on your portapack from time to time"
fi
}