commit a17c88f25e293df1d19530dfea59bad3223df77e
parent 67c0fffcc44395f0292901856460c2ca23e33a90
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 16 Sep 2026 09:35:40 +0200
htrdr: refactor the NetCDF patch
Change the name of the files to follow the convention used by the other
build scripts.
Define which patch to apply regarding the NetCDF version directly in the
netcdf-patch build script so that the caller does not have to choose the
patch itself.
Restrict the dependency to the NetCDF patch to the build of
htrdr-atmosphere.
Diffstat:
5 files changed, 48 insertions(+), 44 deletions(-)
diff --git a/src/rad-apps/htrdr_0.12.sh b/src/rad-apps/htrdr_0.12.sh
@@ -25,6 +25,7 @@ set -e
. "rad-libs/mrumtl_0.2.sh"
. "rad-libs/star-sf_0.10.sh"
. "sci-apps/htpp_0.5.sh"
+. "sci-libs/netcdf-patch.sh"
. "sci-libs/star-3d_0.10.1.sh"
. "sci-libs/star-camera_0.2.sh"
. "sci-libs/star-sp_0.15.sh"
@@ -39,12 +40,6 @@ if [ "${ATMOSPHERE}" = "ENABLE" ]; then
. "rad-libs/htsky_0.3.1-r1.sh"
fi
-netcdf_version="$(pkg-config --modversion netcdf)"
-
-if [ "${netcdf_version}" = "4.9.3" ]; then
- . "sci-libs/netcdf_4.9.3_patch.sh"
-fi
-
if [ "${COMBUSTION}" = "ENABLE" ]; then
. "rad-libs/atrstm_0.1.1.sh"
fi
@@ -63,10 +58,9 @@ if [ -n "${HTRDR_SH}" ]; then
else
export HTRDR_SH="${tag}"
- [ "${ATMOSPHERE}" = "ENABLE" ] && dep="${dep} htsky"
+ [ "${ATMOSPHERE}" = "ENABLE" ] && dep="${dep} htsky netcdf-patch"
[ "${COMBUSTION}" = "ENABLE" ] && dep="${dep} atrstm"
[ "${PLANETS}" = "ENABLE" ] && dep="${dep} rnatm rngrd star-buffer"
- [ -n "${NETCDF_PATCH_SH}" ] && dep="${dep} netcdf"
url="$\(REPO\)/htrdr.git"
dep="${dep} aw mrumtl rsys star-3d star-camera star-sf star-sp star-vx"
diff --git a/src/sci-libs/netcdf-patch.sh b/src/sci-libs/netcdf-patch.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Copyright (C) 2023-2026 |Méso|Star> (contact@meso-star.com)
+#
+# This file is part of Star-Build.
+#
+# Star-Build is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Star-Build is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Star-Build. If not, see <http://www.gnu.org/licenses/>.
+
+name="netcdf"
+version="$(pkg-config --modversion netcdf)"
+
+if [ -n "${NETCDF_PATCH_SH}" ]; then
+ check_conflict "${name}" "${version}" "${NETCDF_PATCH_SH}"
+else
+ export NETCDF_PATCH_SH="${version}"
+ case "${version}" in
+ "4.9.3") cat sci-libs/netcdf-patch_4.9.3.mk ;;
+ *) echo "netcdf-patch:" ;; # Dummy target
+ esac
+fi
diff --git a/src/sci-libs/netcdf-patch_4.9.3.mk b/src/sci-libs/netcdf-patch_4.9.3.mk
@@ -0,0 +1,15 @@
+netcdf-patch:
+ prefix=$$(cat .prefix) &&\
+ pc="$$(pkg-config --path netcdf)" &&\
+ path="$${prefix}/lib/pkgconfig" &&\
+ mkdir -p "$${path}" &&\
+ sed -e 's/HDF5::HDF5/hdf5/' \
+ -e 's/hdf5::hdf5_hl/hdf5_hl/' \
+ -e 's/CURL::libcurl/curl/' "$${pc}" > "$${path}/netcdf.pc"
+
+uninstall_netcdf-patch:
+ prefix=$$(cat .prefix) &&\
+ rm -f "$${prefix}/lib/pkgconfig/netcdf.pc"
+
+install_all: netcdf-patch
+uninstall_all: uninstall_netcdf-patch
diff --git a/src/sci-libs/netcdf_4.9.3_patch.mk b/src/sci-libs/netcdf_4.9.3_patch.mk
@@ -1,8 +0,0 @@
-netcdf:
- @prefix=$$(cat .prefix) &&\
- pc="$$(pkg-config --path netcdf)" &&\
- path="$${prefix}/lib/pkgconfig" &&\
- mkdir -p "$${path}" &&\
- sed -e 's/HDF5::HDF5/hdf5/' \
- -e 's/hdf5::hdf5_hl/hdf5_hl/' \
- -e 's/CURL::libcurl/curl/' "$${pc}" > "$${path}/netcdf.pc"
diff --git a/src/sci-libs/netcdf_4.9.3_patch.sh b/src/sci-libs/netcdf_4.9.3_patch.sh
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2023-2026 |Méso|Star> (contact@meso-star.com)
-#
-# This file is part of Star-Build.
-#
-# Star-Build is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Star-Build is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Star-Build. If not, see <http://www.gnu.org/licenses/>.
-
-name="netcdf"
-version="4.9.3"
-
-if [ -n "${NETCDF_PATCH_SH}" ]; then
- check_conflict "${name}" "${version}" "${NETCDF_PATCH_SH}"
-else
- export NETCDF_PATCH_SH="${version}"
- cat sci-libs/netcdf_4.9.3_patch.mk
-fi