Files
linamh/dev-lang/openwatcom-v2-bin/openwatcom-v2-bin-9999.ebuild
Mario Fetka cda2f05279 Redigest
2026-06-22 20:02:52 +02:00

122 lines
2.9 KiB
Bash

# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
MY_PN="open-watcom-v2"
REPO="open-watcom/open-watcom-v2"
GH_TAG="Last-CI-build"
ASSET="ow-snapshot.tar.xz"
DESCRIPTION="Open Watcom compiler binary snapshot"
HOMEPAGE="https://github.com/open-watcom/open-watcom-v2"
LICENSE="OWPL-1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="strip network-sandbox mirror"
DEPEND=""
BDEPEND="
net-misc/curl
app-misc/jq
app-arch/xz-utils
sys-apps/coreutils
|| ( games-emulation/dosbox games-emulation/dosbox-x )
"
RDEPEND="
|| ( games-emulation/dosbox games-emulation/dosbox-x )
"
S="${WORKDIR}/watcom"
src_unpack() {
local api_url
local asset_url
local digest
api_url="https://api.github.com/repos/${REPO}/releases/tags/${GH_TAG}"
einfo "Fetching release metadata from ${api_url}"
mkdir -p "${WORKDIR}/download" || die
mkdir -p "${S}" || die
curl -L --fail --silent --show-error \
"${api_url}" \
-o "${WORKDIR}/release.json" \
|| die "Could not fetch GitHub release metadata"
asset_url="$(
jq -r '.assets[] | select(.name=="'"${ASSET}"'") | .browser_download_url' \
"${WORKDIR}/release.json"
)" || die "Could not parse asset download URL"
digest="$(
jq -r '.assets[] | select(.name=="'"${ASSET}"'") | .digest // empty' \
"${WORKDIR}/release.json" \
| sed 's/^sha256://'
)" || die "Could not parse asset digest"
[[ -n "${asset_url}" && "${asset_url}" != "null" ]] \
|| die "No download URL found for ${ASSET}"
[[ -n "${digest}" && "${digest}" != "null" ]] \
|| die "No SHA256 digest found for ${ASSET}"
einfo "Downloading ${ASSET}"
curl -L --fail --silent --show-error \
"${asset_url}" \
-o "${WORKDIR}/download/${ASSET}" \
|| die "Could not download ${ASSET}"
einfo "Verifying SHA256: ${digest}"
echo "${digest} ${WORKDIR}/download/${ASSET}" | sha256sum -c - \
|| die "SHA256 verification failed for ${ASSET}"
tar -xJf "${WORKDIR}/download/${ASSET}" -C "${S}" \
|| die "Could not unpack ${ASSET}"
}
src_install() {
local OWROOT="${S}"
# Some snapshots may unpack into a nested watcom/ directory.
if [[ -d "${S}/watcom" ]]; then
OWROOT="${S}/watcom"
fi
dodoc \
"${OWROOT}/areadme.txt" \
"${OWROOT}/freadme.txt" \
"${OWROOT}/readme.txt" \
"${OWROOT}/ide.doc"
chmod -R a+rX "${OWROOT}"/{h,lh} || die
dodir /opt/watcom
cp -a "${OWROOT}/." "${ED}/opt/watcom/" || die
if [[ -d "${ED}/opt/watcom/binl" ]]; then
dosym /bin/true /opt/watcom/binl/ranlib
dosym /opt/watcom/binl/wlib /opt/watcom/binl/ar
fi
if [[ -d "${ED}/opt/watcom/binl64" ]]; then
dosym /bin/true /opt/watcom/binl64/ranlib
dosym /opt/watcom/binl64/wlib /opt/watcom/binl64/ar
fi
exeinto /opt/bin
doexe "${FILESDIR}/owsetenv.sh"
dodir /etc/env.d
cat > "${ED}/etc/env.d/99openwatcom" <<EOF || die
WATCOM=/opt/watcom
EDPATH=/opt/watcom/eddat
WIPFC=/opt/watcom/wipfc
EOF
}