linamh/sci-electronics/saleae-logic-bin/saleae-logic-bin-2.4.13.ebuild
2023-12-25 10:28:25 +01:00

100 lines
3.0 KiB
Bash

# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MULTILIB_COMPAT=( abi_x86_64 )
inherit appimage chromium-2 desktop pax-utils multilib-build xdg udev
DESCRIPTION="Debug hardware like the pros."
HOMEPAGE="https://www.saleae.com/"
SRC_URI="
amd64? ( https://downloads.saleae.com/logic2/Logic-${PV}-linux-x64.AppImage )
"
LICENSE="Salea-EULA"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
RESTRICT="bindist mirror splitdebug strip"
RDEPEND="
app-accessibility/at-spi2-atk[${MULTILIB_USEDEP}]
app-accessibility/at-spi2-core[${MULTILIB_USEDEP}]
dev-libs/atk[${MULTILIB_USEDEP}]
dev-libs/expat[${MULTILIB_USEDEP}]
dev-libs/glib[${MULTILIB_USEDEP}]
dev-libs/nspr[${MULTILIB_USEDEP}]
dev-libs/nss[${MULTILIB_USEDEP}]
x11-libs/cairo[${MULTILIB_USEDEP}]
x11-libs/gdk-pixbuf[${MULTILIB_USEDEP}]
x11-libs/pango[${MULTILIB_USEDEP}]
net-print/cups[${MULTILIB_USEDEP}]
|| ( sys-devel/base-gcc[cxx] sys-devel/gcc[cxx] )
sys-apps/dbus[${MULTILIB_USEDEP}]
x11-libs/gtk+[${MULTILIB_USEDEP}]
x11-libs/libX11[${MULTILIB_USEDEP}]
x11-libs/libXcomposite[${MULTILIB_USEDEP}]
x11-libs/libXcursor[${MULTILIB_USEDEP}]
x11-libs/libXdamage[${MULTILIB_USEDEP}]
x11-libs/libXext[${MULTILIB_USEDEP}]
x11-libs/libXfixes[${MULTILIB_USEDEP}]
x11-libs/libXi[${MULTILIB_USEDEP}]
x11-libs/libXrandr[${MULTILIB_USEDEP}]
x11-libs/libXrender[${MULTILIB_USEDEP}]
x11-libs/libXtst[${MULTILIB_USEDEP}]
media-libs/alsa-lib[${MULTILIB_USEDEP}]
sys-libs/glibc[${MULTILIB_USEDEP}]
x11-libs/libXScrnSaver[${MULTILIB_USEDEP}]
x11-libs/libxcb[${MULTILIB_USEDEP}]
"
S="${WORKDIR}"
QA_PREBUILT="opt/Saleae/${PN}/Logic opt/Saleae/${PN}/libffmpeg.so opt/Saleae/${PN}/libnode.so"
MY_PN=Logic
pkg_setup() {
chromium_suid_sandbox_check_kernel_config
}
src_prepare() {
sed -i "/^Exec=/cExec=${MY_PN}" "${P}/Logic.desktop" \
|| die "Failed to patch desktop file"
sed -i "/^X-AppImage/d" "${P}/Logic.desktop" \
|| die "Failed to patch desktop file"
sed -i "s/^X-AppImage-Version=/Version=/" "${P}/Logic.desktop" \
|| die "Failed to patch desktop file"
default_src_prepare
}
src_install() {
dodir /opt/Saleae
mv ${P}/usr "${ED}"
mv "${P}" "${ED}/opt/Saleae/${MY_PN}"
mkdir -p "${ED}/usr/share/applications"
mv "${ED}/opt/Saleae/Logic/Logic.desktop" "${ED}/usr/share/applications/${MY_PN}.desktop"
rm "${ED}/opt/Saleae/${MY_PN}/Logic.png"
rm "${ED}/opt/Saleae/${MY_PN}/.DirIcon"
rm "${ED}/opt/Saleae/${MY_PN}/AppRun"
rm "${ED}/opt/Saleae/${MY_PN}/version"
rm -rf "${ED}/usr/lib/"
dodir /etc/udev/rules.d
install -Dm644 "${ED}/opt/Saleae/${MY_PN}/resources/linux-x64/99-SaleaeLogic.rules" "${ED}/etc/udev/rules.d/99-SaleaeLogic.rules"
# Fix permissions (example: 700->755, 640->644)
find "${ED}/opt/Saleae/${MY_PN}" -perm "/111" -exec chmod 755 \{\} \;
find "${ED}/opt/Saleae/${MY_PN}" ! -perm "/111" -exec chmod 644 \{\} \;
chmod 4755 "${ED}/opt/Saleae/${MY_PN}/chrome-sandbox"
mkdir -p "${ED}/usr/bin/"
ln -s "/opt/Saleae/${MY_PN}/Logic" "${ED}/usr/bin/${MY_PN}"
udev_reload
}