From f8ce53931722fd49877c676614b470bd7b9354f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Fri, 2 Sep 2022 22:49:18 +0700 Subject: [PATCH 1/7] build-style/scons: use --install-sandbox for $DESTDIR See https://scons.org/doc/production/HTML/scons-user.html#b-Install Some projects uses --prefix=$DESTDIR/usr must be fixed. --- common/build-style/scons.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/build-style/scons.sh b/common/build-style/scons.sh index 17527d7ac652..f87c0dcc5304 100644 --- a/common/build-style/scons.sh +++ b/common/build-style/scons.sh @@ -9,18 +9,27 @@ do_build() { CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \ cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \ RANLIB="$RANLIB" ranlib="$RANLIB" \ - prefix=/usr destdir=${DESTDIR} DESTDIR=${DESTDIR} \ + prefix=/usr \ + ${scons_use_destdir:+DESTDIR="${DESTDIR}"} \ + ${scons_use_destdir:+destdir="${DESTDIR}"} \ ${make_build_args} ${make_build_target} } do_install() { : ${make_cmd:=scons} : ${make_install_target:=install} + local _sandbox= + + if [ -z "$scons_use_destdir" ]; then _sandbox=yes ; fi + ${make_cmd} ${makejobs} CC=$CC CXX=$CXX CCFLAGS="$CFLAGS" \ cc=$CC cxx=$CXX ccflags="$CFLAGS" \ CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \ cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \ RANLIB="$RANLIB" ranlib="$RANLIB" \ - prefix=/usr destdir=${DESTDIR} DESTDIR=${DESTDIR} \ + prefix=/usr \ + ${scons_use_destdir:+DESTDIR="${DESTDIR}"} \ + ${scons_use_destdir:+destdir="${DESTDIR}"} \ + ${_sandbox:+--install-sandbox="${DESTDIR}"} \ ${make_install_args} ${make_install_target} } From fdb556bdc85bd5dc27f3f00213dd13142d67b506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Fri, 2 Sep 2022 22:52:47 +0700 Subject: [PATCH 2/7] cbang: rebuild for correct prefix --- srcpkgs/cbang/template | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/srcpkgs/cbang/template b/srcpkgs/cbang/template index 63388b2aa828..9357bdc0d709 100644 --- a/srcpkgs/cbang/template +++ b/srcpkgs/cbang/template @@ -1,13 +1,14 @@ # Template file for 'cbang' pkgname=cbang version=1.6.0 -revision=3 +revision=4 build_style=scons make_build_args="sharedlib=1 staticlib=1" make_install_args="${make_build_args}" hostmakedepends="pkg-config" makedepends="boost-devel bzip2-devel expat-devel leveldb-devel libevent-devel openssl-devel libyaml-devel re2-devel snappy-devel sqlite-devel zlib-devel" +checkdepends="python" short_desc="C! (a.k.a. C-Bang) collection of C++ utility libraries" maintainer="Orphaned " license="LGPL-2.1-only" @@ -15,31 +16,24 @@ homepage="https://github.com/CauldronDevelopmentLLC/cbang" distfiles="https://github.com/CauldronDevelopmentLLC/cbang/archive/${version}.tar.gz>${pkgname}-${version}.tar.gz" checksum=8aa5efacf419b712b5bd0172c9d56301bdcbd477cb590ceec25c3595a192e9c0 -pre_build() { - make_build_args+=" prefix=$DESTDIR/usr" +post_extract() { + touch tests/iostreamTests/{C,Dec}ompressTest/disable } -do_check() { +post_build() { cd tests - touch iostreamTests/{C,Dec}ompressTest/disable - scons ${makejobs} CC=$CC CXX=$CXX CCFLAGS="$CFLAGS" \ - cc=$CC cxx=$CXX ccflags="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \ - cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \ - RANLIB="$RANLIB" ranlib="$RANLIB" \ - prefix=/usr destdir=${DESTDIR} DESTDIR=${DESTDIR} - ./testHarness + do_build } -pre_install() { - make_install_args+=" prefix=$DESTDIR/usr" +do_check() { + cd tests + ./testHarness } post_install() { # Create missing symbolic links for the shared library - ln -sf libcbang0.so.0.0.1 ${DESTDIR}/usr/lib/libcbang.so.0.0 - ln -sf libcbang0.so.0.0.1 ${DESTDIR}/usr/lib/libcbang.so.0 - ln -sf libcbang0.so.0.0.1 ${DESTDIR}/usr/lib/libcbang.so + ln -sf libcbang0.so.* ${DESTDIR}/usr/lib/libcbang0.so + ln -sf libcbang0.so.* ${DESTDIR}/usr/lib/libcbang.so } cbang-devel_package() { From 36a6f0da74589ae83911c284ad66d2f91286bb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 3 Sep 2022 11:05:01 +0700 Subject: [PATCH 3/7] endless-sky: work with --install-sandbox --- srcpkgs/endless-sky/patches/paths.patch | 70 +++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/srcpkgs/endless-sky/patches/paths.patch b/srcpkgs/endless-sky/patches/paths.patch index e80095b88eff..36029192f4b2 100644 --- a/srcpkgs/endless-sky/patches/paths.patch +++ b/srcpkgs/endless-sky/patches/paths.patch @@ -1,6 +1,8 @@ +We need to patch for PREFIX and s/games/bin anyway, +let's patch $DESTDIR, too --- a/SConstruct +++ b/SConstruct -@@ -41,7 +41,7 @@ +@@ -37,7 +37,7 @@ opts.AddVariables( PathVariable("BUILDDIR", "Directory to store compiled object files in", "build", PathVariable.PathIsDirCreate), PathVariable("BIN_DIR", "Directory to store binaries in", ".", PathVariable.PathIsDirCreate), PathVariable("DESTDIR", "Destination root directory, e.g. if building a package", "", PathVariable.PathAccept), @@ -9,12 +11,72 @@ ) opts.Update(env) Help(opts.GenerateHelpText(env)) -@@ -150,7 +150,7 @@ +@@ -157,22 +157,22 @@ env.AlwaysBuild("test") # Install the binary: -env.Install("$DESTDIR$PREFIX/games", sky) -+env.Install("$DESTDIR$PREFIX/bin", sky) ++install = env.Install("$PREFIX/bin", sky) # Install the desktop file: - env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop") +-env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop") ++install += env.Install("$PREFIX/share/applications", "endless-sky.desktop") + + # Install app center metadata: +-env.Install("$DESTDIR$PREFIX/share/appdata", "endless-sky.appdata.xml") ++install += env.Install("$PREFIX/share/appdata", "endless-sky.appdata.xml") + + # Install icons, keeping track of all the paths. + # Most Ubuntu apps supply 16, 22, 24, 32, 48, and 256, and sometimes others. + sizes = ["16x16", "22x22", "24x24", "32x32", "48x48", "128x128", "256x256", "512x512"] + icons = [] + for size in sizes: +- destination = "$DESTDIR$PREFIX/share/icons/hicolor/" + size + "/apps/endless-sky.png" ++ destination = "$PREFIX/share/icons/hicolor/" + size + "/apps/endless-sky.png" + icons.append(destination) +- env.InstallAs(destination, "icons/icon_" + size + ".png") ++ install += env.InstallAs(destination, "icons/icon_" + size + ".png") + + # If any of those icons changed, also update the cache. + # Do not update the cache if we're not installing into "usr". +@@ -181,28 +181,30 @@ if env.get("PREFIX").startswith("/usr/") + env.Command( + [], + icons, +- "gtk-update-icon-cache -t $DESTDIR$PREFIX/share/icons/hicolor/") ++ "gtk-update-icon-cache -t $PREFIX/share/icons/hicolor/") + + # Install the man page. + env.Command( +- "$DESTDIR$PREFIX/share/man/man6/endless-sky.6.gz", ++ "$PREFIX/share/man/man6/endless-sky.6.gz", + "endless-sky.6", + "gzip -c $SOURCE > $TARGET") + + # Install the data files. + def RecursiveInstall(env, target, source): + rootIndex = len(env.Dir(source).abspath) + 1 ++ install = [] + for node in env.Glob(pathjoin(source, '*')): + if node.isdir(): + name = node.abspath[rootIndex:] +- RecursiveInstall(env, pathjoin(target, name), node.abspath) ++ install += RecursiveInstall(env, pathjoin(target, name), node.abspath) + else: +- env.Install(target, node) +-RecursiveInstall(env, "$DESTDIR$PREFIX/share/games/endless-sky/data", "data") +-RecursiveInstall(env, "$DESTDIR$PREFIX/share/games/endless-sky/images", "images") +-RecursiveInstall(env, "$DESTDIR$PREFIX/share/games/endless-sky/sounds", "sounds") +-env.Install("$DESTDIR$PREFIX/share/games/endless-sky", "credits.txt") +-env.Install("$DESTDIR$PREFIX/share/games/endless-sky", "keys.txt") ++ install += env.Install(target, node) ++ return install ++install += RecursiveInstall(env, "$PREFIX/share/games/endless-sky/data", "data") ++install += RecursiveInstall(env, "$PREFIX/share/games/endless-sky/images", "images") ++install += RecursiveInstall(env, "$PREFIX/share/games/endless-sky/sounds", "sounds") ++install += env.Install("$PREFIX/share/games/endless-sky", "credits.txt") ++install += env.Install("$PREFIX/share/games/endless-sky", "keys.txt") + + # Make the word "install" in the command line do an installation. +-env.Alias("install", "$DESTDIR$PREFIX") ++env.Alias("install", install) From a66ba568b9ad6d321287e300c6321b58295cf7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 3 Sep 2022 11:11:38 +0700 Subject: [PATCH 4/7] endless-sky-gl21: merge data, use --install-sandbox --- srcpkgs/endless-sky-gl21-data | 1 - srcpkgs/endless-sky-gl21/patches/paths.patch | 72 ++++++++++++++++++-- srcpkgs/endless-sky-gl21/template | 13 +--- 3 files changed, 69 insertions(+), 17 deletions(-) delete mode 120000 srcpkgs/endless-sky-gl21-data diff --git a/srcpkgs/endless-sky-gl21-data b/srcpkgs/endless-sky-gl21-data deleted file mode 120000 index 698f56bdb723..000000000000 --- a/srcpkgs/endless-sky-gl21-data +++ /dev/null @@ -1 +0,0 @@ -endless-sky-gl21 \ No newline at end of file diff --git a/srcpkgs/endless-sky-gl21/patches/paths.patch b/srcpkgs/endless-sky-gl21/patches/paths.patch index c283ff8052a8..d8c919c97df9 100644 --- a/srcpkgs/endless-sky-gl21/patches/paths.patch +++ b/srcpkgs/endless-sky-gl21/patches/paths.patch @@ -1,6 +1,6 @@ ---- a/SConstruct.old 2017-12-06 12:54:20.524502000 -0800 -+++ b/SConstruct 2017-12-12 12:39:21.764384877 -0800 -@@ -18,7 +18,7 @@ +--- a/SConstruct ++++ b/SConstruct +@@ -18,7 +18,7 @@ if 'SCHROOT_CHROOT_NAME' in os.environ a env.Append(LINKFLAGS = ["-static-libstdc++"]) opts = Variables() @@ -9,12 +9,72 @@ opts.Add(PathVariable("DESTDIR", "Destination root directory", "", PathVariable.PathAccept)) opts.Add(EnumVariable("mode", "Compilation mode", "release", allowed_values=("release", "debug", "profile"))) opts.Update(env) -@@ -66,7 +66,7 @@ +@@ -66,22 +66,22 @@ sky = env.Program("endless-sky", Glob("b # Install the binary: -env.Install("$DESTDIR$PREFIX/games", sky) -+env.Install("$DESTDIR$PREFIX/bin", sky) ++install = env.Install("$PREFIX/bin", sky) # Install the desktop file: - env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop") +-env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop") ++install += env.Install("$PREFIX/share/applications", "endless-sky.desktop") + + # Install app center metadata: +-env.Install("$DESTDIR$PREFIX/share/appdata", "endless-sky.appdata.xml") ++install += env.Install("$PREFIX/share/appdata", "endless-sky.appdata.xml") + + # Install icons, keeping track of all the paths. + # Most Ubuntu apps supply 16, 22, 24, 32, 48, and 256, and sometimes others. + sizes = ["16x16", "22x22", "24x24", "32x32", "48x48", "256x256"] + icons = [] + for size in sizes: +- destination = "$DESTDIR$PREFIX/share/icons/hicolor/" + size + "/apps/endless-sky.png" ++ destination = "$PREFIX/share/icons/hicolor/" + size + "/apps/endless-sky.png" + icons.append(destination) +- env.InstallAs(destination, "icons/icon_" + size + ".png") ++ install += env.InstallAs(destination, "icons/icon_" + size + ".png") + + # If any of those icons changed, also update the cache. + # Do not update the cache if we're not installing into "usr". +@@ -90,28 +90,30 @@ if env.get("PREFIX").startswith("/usr/") + env.Command( + [], + icons, +- "gtk-update-icon-cache -t $DESTDIR$PREFIX/share/icons/hicolor/") ++ "gtk-update-icon-cache -t $PREFIX/share/icons/hicolor/") + + # Install the man page. + env.Command( +- "$DESTDIR$PREFIX/share/man/man6/endless-sky.6.gz", ++ "$PREFIX/share/man/man6/endless-sky.6.gz", + "endless-sky.6", + "gzip -c $SOURCE > $TARGET") + + # Install the data files. + def RecursiveInstall(env, target, source): + rootIndex = len(env.Dir(source).abspath) + 1 ++ inst = [] + for node in env.Glob(os.path.join(source, '*')): + if node.isdir(): + name = node.abspath[rootIndex:] +- RecursiveInstall(env, os.path.join(target, name), node.abspath) ++ inst += RecursiveInstall(env, os.path.join(target, name), node.abspath) + else: +- env.Install(target, node) +-RecursiveInstall(env, "$DESTDIR$PREFIX/share/games/endless-sky/data", "data") +-RecursiveInstall(env, "$DESTDIR$PREFIX/share/games/endless-sky/images", "images") +-RecursiveInstall(env, "$DESTDIR$PREFIX/share/games/endless-sky/sounds", "sounds") +-env.Install("$DESTDIR$PREFIX/share/games/endless-sky", "credits.txt") +-env.Install("$DESTDIR$PREFIX/share/games/endless-sky", "keys.txt") ++ inst += env.Install(target, node) ++ return inst ++install += RecursiveInstall(env, "$PREFIX/share/games/endless-sky/data", "data") ++install += RecursiveInstall(env, "$PREFIX/share/games/endless-sky/images", "images") ++install += RecursiveInstall(env, "$PREFIX/share/games/endless-sky/sounds", "sounds") ++install += env.Install("$PREFIX/share/games/endless-sky", "credits.txt") ++install += env.Install("$PREFIX/share/games/endless-sky", "keys.txt") + + # Make the word "install" in the command line do an installation. +-env.Alias("install", "$DESTDIR$PREFIX") ++env.Alias("install", install) diff --git a/srcpkgs/endless-sky-gl21/template b/srcpkgs/endless-sky-gl21/template index 5bb8355dc570..b4ee955c4689 100644 --- a/srcpkgs/endless-sky-gl21/template +++ b/srcpkgs/endless-sky-gl21/template @@ -1,24 +1,17 @@ # Template file for 'endless-sky-gl21' pkgname=endless-sky-gl21 version=0.9.2.20170822 -revision=2 +revision=3 _commit=fc707954b0eb61ff2bb6888c5712e6b55d1c2f91 wrksrc="endless-sky-${_commit}" build_style=scons hostmakedepends="scons" makedepends="SDL2-devel glew-devel libjpeg-turbo-devel libmad-devel libopenal-devel libpng-devel" -depends="${pkgname}-data" -conflicts="endless-sky endless-sky-data" short_desc="Space exploring, trading, and combat game. opengl21 version" maintainer="Benjamín Albiñana " license="GPL-3.0-or-later" homepage="https://github.com/SolraBizna/endless-sky" distfiles="https://github.com/SolraBizna/endless-sky/archive/${_commit}.tar.gz" checksum=46918d0cc35aaeb1219194099223e3338245aa04aa3f29fd76e3376bf5779376 - -endless-sky-gl21-data_package() { - short_desc+=" - data files" - pkg_install() { - vmove usr/share/games/endless-sky - } -} +replaces="endless-sky-gl21-data>=0" +conflicts="endless-sky>=0 endless-sky-data>=0" From 6698a8652882acb13cdcc6943e59143016e2b071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 3 Sep 2022 11:47:16 +0700 Subject: [PATCH 5/7] libffado: only work with DESTDIR --- srcpkgs/libffado/template | 1 + 1 file changed, 1 insertion(+) diff --git a/srcpkgs/libffado/template b/srcpkgs/libffado/template index 7978d6007f90..9523835ae179 100644 --- a/srcpkgs/libffado/template +++ b/srcpkgs/libffado/template @@ -3,6 +3,7 @@ pkgname=libffado version=2.4.6 revision=1 build_style=scons +scons_use_destdir=yes make_build_args="PREFIX=/usr MANDIR=/usr/share/man UDEVDIR=/usr/lib/udev/rules.d CUSTOM_ENV=1 BUILD_TESTS=0 ENABLE_OPTIMIZATIONS=0 DEBUG=0 PYTHON_INTERPRETER=/usr/bin/python3 From 8c220e5d37aa550d55f1f428ae06dfa999b61357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 3 Sep 2022 11:21:29 +0700 Subject: [PATCH 6/7] gpsd: not export DESTDIR on install scons will use --install-sandbox --- srcpkgs/gpsd/template | 1 - 1 file changed, 1 deletion(-) diff --git a/srcpkgs/gpsd/template b/srcpkgs/gpsd/template index c60f03ae5bd7..eaa83e4ac8c5 100644 --- a/srcpkgs/gpsd/template +++ b/srcpkgs/gpsd/template @@ -35,7 +35,6 @@ pre_build() { pre_install() { unset LD - export DESTDIR=${DESTDIR} makejobs="-j1" } From 6c6f17de95f5fcd56a653b19f991e7c95bbe062c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 3 Sep 2022 12:10:07 +0700 Subject: [PATCH 7/7] vdrift: doesn't work with --install-sandbox --- srcpkgs/vdrift/template | 1 + 1 file changed, 1 insertion(+) diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template index cc586376b4e6..3fbbce0da07b 100644 --- a/srcpkgs/vdrift/template +++ b/srcpkgs/vdrift/template @@ -4,6 +4,7 @@ version=2014.10.20 revision=11 wrksrc="$pkgname" build_style=scons +scons_use_destdir=yes make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}" make_install_args="$make_build_args" hostmakedepends="gettext pkg-config"