Files
gentoo-zh/media-gfx/opencadstudio-bin/opencadstudio-bin-2026.48.ebuild
T
Yongxiang Liang a350baa64d media-gfx/opencadstudio-bin: new package, add 2026.48
Extract the upstream AppImage with unsquashfs to avoid executing its architecture-
specific runtime.

Both AppImages use Zstandard, so require squashfs-tools[zstd] for unpacking.

Remove the unused AppDir-relative RUNPATH so the installed executable can use
Gentoo's system libraries.

Install the upstream desktop entry, icon, and AppStream metadata to retain the
desktop ID and DWG/DXF associations.

Restrict mirroring and binary redistribution pending review of the embedded LFF
fonts.

Assisted-by: Codex:GPT-6
Signed-off-by: Yongxiang Liang <tanekliang@gmail.com>
2026-12-03 20:47:52 +11:00

88 lines
2.5 KiB
Bash

# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit xdg
MY_PN="OpenCADStudio"
UPSTREAM="https://github.com/HakanSeven12/${MY_PN}"
TAG="v${PV}"
NOTICE_BASE="https://raw.githubusercontent.com/HakanSeven12/${MY_PN}/${TAG}"
DESCRIPTION="2D drafting and 3D CAD editor with native DWG and DXF support"
HOMEPAGE="https://www.opencadstudio.com/"
SRC_URI="
amd64? ( ${UPSTREAM}/releases/download/${TAG}/${MY_PN}-${TAG}-linux-x86_64.AppImage )
arm64? ( ${UPSTREAM}/releases/download/${TAG}/${MY_PN}-${TAG}-linux-aarch64.AppImage )
${NOTICE_BASE}/LICENSE -> ${P}-LICENSE
${NOTICE_BASE}/THIRD_PARTY.md -> ${P}-THIRD_PARTY.md
${NOTICE_BASE}/crates/step-export/NOTICE -> ${P}-solidcore-NOTICE
${NOTICE_BASE}/assets/icons/ui/LICENSE-phosphor.txt -> ${P}-LICENSE-phosphor.txt
"
S="${WORKDIR}/squashfs-root"
LICENSE="Apache-2.0 BSD BSD-2 CC0-1.0 GPL-2+ GPL-3 GPL-3+ ISC MIT MPL-2.0
Unicode-3.0 ZLIB public-domain"
SLOT="0"
KEYWORDS="-* ~amd64 ~arm64"
# The embedded LFF fonts include files with unresolved redistribution terms.
RESTRICT="bindist mirror strip"
RDEPEND="
dev-libs/wayland
media-libs/libglvnd
media-libs/vulkan-loader
sys-apps/dbus
sys-apps/xdg-desktop-portal
sys-devel/gcc
>=sys-libs/glibc-2.35
x11-libs/libX11
x11-libs/libXcursor
x11-libs/libXi
x11-libs/libxcb
x11-libs/libxkbcommon[X]
x11-misc/xdg-utils
"
BDEPEND="
dev-util/patchelf
sys-fs/squashfs-tools[zstd]
"
QA_PREBUILT="usr/bin/${MY_PN}"
src_unpack() {
local arch=x86_64
use arm64 && arch=aarch64
local appimage="${DISTDIR}/${MY_PN}-${TAG}-linux-${arch}.AppImage"
# The squashfs follows the ELF section table. This works without executing the AppImage.
local header offset
header=$(LC_ALL=C readelf -h "${appimage}") || die
offset=$(awk '
/Start of section headers/ { start = $5 }
/Size of section headers/ { size = $5 }
/Number of section headers/ { count = $5 }
END { print start + size * count }
' <<< "${header}") || die
[[ ${offset} -gt 0 ]] || die "Invalid AppImage squashfs offset"
unsquashfs -no-progress -o "${offset}" -d "${S}" "${appimage}" || die
}
src_prepare() {
default
# The upstream AppDir-relative RUNPATH is unused after unpacking.
patchelf --remove-rpath "usr/bin/${MY_PN}" || die
}
src_install() {
dobin "usr/bin/${MY_PN}"
insinto /usr
doins -r usr/share
newdoc "${DISTDIR}/${P}-LICENSE" LICENSE
newdoc "${DISTDIR}/${P}-THIRD_PARTY.md" THIRD_PARTY.md
newdoc "${DISTDIR}/${P}-solidcore-NOTICE" solidcore-NOTICE
newdoc "${DISTDIR}/${P}-LICENSE-phosphor.txt" LICENSE-phosphor.txt
}