forked from flathub/org.freedesktop.Platform.GL.nvidia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows us to stop depending on the ancient 1.6 i386 SDK to package the i386 driver. With these changes, the i386 driver is now packaged on a x86_64 host. Unfortunately, we now also have to include zlib and liblzma, because the 24.08 SDK doesn't include static libraries (.a files) for them, and that will likely increase the overall build time.
- Loading branch information
Showing
4 changed files
with
109 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,79 @@ | ||
#!/usr/bin/env bash | ||
|
||
# shellcheck disable=SC1091 | ||
source ./versions.sh | ||
|
||
ARCH=$1 | ||
REPO=$2 | ||
EXPORT_ARGS=$3 | ||
FB_ARGS=$4 | ||
SUBJECT=${5:-"org.freedesktop.Platform.GL.nvidia `git rev-parse HEAD`"} | ||
SUBJECT=$5 | ||
|
||
set -e | ||
set -x | ||
|
||
EXT_PREFIX='org.freedesktop.Platform.GL.nvidia' | ||
SDK_BRANCH=1.4 | ||
SDK_RUNTIME_VERSION=1.6 | ||
SDK_RUNTIME_VERSION=24.08 | ||
|
||
for VER in $DRIVER_VERSIONS; do | ||
F="data/nvidia-$VER-$ARCH.data" | ||
if [ ! -f $F ]; then | ||
echo WARNING, no data file for $VER $ARCH | ||
continue | ||
if test "${ARCH}" = 'x86_64'; then | ||
# If we're building the x86_64 driver, we also build the i386 driver. | ||
# Note: The i386 driver has to be built first, otherwise the x86_64 ostree repo gets overwritten by it. | ||
TARGET_ARCHES="i386 x86_64" | ||
else | ||
TARGET_ARCHES=${ARCH} | ||
fi | ||
|
||
for TARGET_ARCH in ${TARGET_ARCHES}; do | ||
DATA_FILE="data/nvidia-${VER}-${TARGET_ARCH}.data" | ||
if [ ! -f "${DATA_FILE}" ]; then | ||
echo "WARNING: No data file for ${VER} ${TARGET_ARCH}" | ||
continue | ||
fi | ||
NVIDIA_VERSION=$(echo $VER | sed "s/\./-/;s/\./-/") | ||
EXTRA_DATA=$(cat $F) | ||
NVIDIA_URL=$(cat $F | sed "s/:[^:]*:[^:]*:[^:]*://") | ||
rm -f org.freedesktop.Platform.GL.nvidia-$NVIDIA_VERSION.json | ||
sed -e "s/@@SDK_BRANCH@@/${SDK_BRANCH}/g" \ | ||
-e "s/@@SDK_RUNTIME_VERSION@@/${SDK_RUNTIME_VERSION}/g" \ | ||
-e "s/@@NVIDIA_VERSION@@/${NVIDIA_VERSION}/g" \ | ||
-e "s=@@EXTRA_DATA@@=${EXTRA_DATA}=g" \ | ||
-e "s=@@NVIDIA_URL@@=${NVIDIA_URL}=g" \ | ||
-e "s=@@ARCH@@=${ARCH}=g" \ | ||
org.freedesktop.Platform.GL.nvidia.json.in > org.freedesktop.Platform.GL.nvidia-$NVIDIA_VERSION.json | ||
|
||
flatpak-builder -v --force-clean --ccache --sandbox --delete-build-dirs \ | ||
--arch=${ARCH} --repo=${REPO} \ | ||
--subject="${SUBJECT}" \ | ||
${FB_ARGS} ${EXPORT_ARGS} builddir org.freedesktop.Platform.GL.nvidia-$NVIDIA_VERSION.json | ||
echo "Packaging ${TARGET_ARCH} NVIDIA driver version ${VER} on ${ARCH} host..." | ||
|
||
NVIDIA_VERSION=$(echo "${VER}" | tr '.' '-') | ||
EXTRA_DATA=$(cat "${DATA_FILE}") | ||
NVIDIA_SHA256=$(awk -F ':' '{print $2}' <<<"${EXTRA_DATA}") | ||
NVIDIA_URL=$(awk -F '::' '{print $2}' <<<"${EXTRA_DATA}") | ||
|
||
if test -z "${SUBJECT}"; then | ||
SUBJECT="${VER}" | ||
if test -d '.git'; then | ||
SUBJECT="${SUBJECT} ($(git rev-parse --short HEAD))" | ||
fi | ||
fi | ||
|
||
if test "${ARCH}" = "i386" ; then \ | ||
flatpak build-commit-from ${EXPORT_ARGS} --src-ref=runtime/org.freedesktop.Platform.GL.nvidia-${NVIDIA_VERSION}/${ARCH}/${SDK_BRANCH} ${REPO} runtime/org.freedesktop.Platform.GL32.nvidia-${NVIDIA_VERSION}/x86_64/${SDK_BRANCH} ; | ||
if test "${TARGET_ARCH}" = 'i386'; then | ||
ARCH='x86_64' | ||
else | ||
ARCH=${TARGET_ARCH} | ||
fi | ||
|
||
rm org.freedesktop.Platform.GL.nvidia-$NVIDIA_VERSION.json | ||
sed -e "s/@@SDK_BRANCH@@/${SDK_BRANCH}/g" \ | ||
-e "s/@@SDK_RUNTIME_VERSION@@/${SDK_RUNTIME_VERSION}/g" \ | ||
-e "s/@@ARCH@@/${ARCH}/g" \ | ||
-e "s/@@NVIDIA_VERSION@@/${NVIDIA_VERSION}/g" \ | ||
-e "s=@@EXTRA_DATA@@=${EXTRA_DATA}=g" \ | ||
-e "s=@@NVIDIA_URL@@=${NVIDIA_URL}=g" \ | ||
-e "s/@@NVIDIA_ARCH@@/${TARGET_ARCH}/g" \ | ||
-e "s/@@NVIDIA_SHA256@@/${NVIDIA_SHA256}/g" \ | ||
"${EXT_PREFIX}.json.in" >"${EXT_PREFIX}-${NVIDIA_VERSION}.json" | ||
|
||
flatpak-builder -v --force-clean --ccache --sandbox --delete-build-dirs \ | ||
--arch="${ARCH}" \ | ||
--repo="${REPO}" \ | ||
--subject="${SUBJECT}" \ | ||
${FB_ARGS} ${EXPORT_ARGS} builddir "${EXT_PREFIX}-${NVIDIA_VERSION}.json" | ||
|
||
if test "${TARGET_ARCH}" = 'i386'; then | ||
flatpak build-commit-from ${EXPORT_ARGS} \ | ||
--src-ref="runtime/${EXT_PREFIX}-${NVIDIA_VERSION}/${ARCH}/${SDK_BRANCH}" \ | ||
"${REPO}" \ | ||
"runtime/org.freedesktop.Platform.GL32.nvidia-${NVIDIA_VERSION}/${ARCH}/${SDK_BRANCH}" | ||
fi | ||
rm "${EXT_PREFIX}-${NVIDIA_VERSION}.json" | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"skip-appstream-check": true, | ||
"only-arches": ["x86_64","i386","aarch64"], | ||
"only-arches": ["x86_64", "aarch64"], | ||
"publish-delay-hours": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters