aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorodniceanu Andrei <a.horodniceanu@proton.me>2024-02-20 20:41:47 +0200
committerHorodniceanu Andrei <a.horodniceanu@proton.me>2024-02-20 20:42:18 +0200
commit51b60bbc3e404fad03b2fa9d111f986d9fdd5ae3 (patch)
treece834fda854922d4f64e40f38e50c9b415cd7431
parentdmd.eclass: Fix overwriting instead of appending to array. (diff)
downloaddlang-51b60bbc3e404fad03b2fa9d111f986d9fdd5ae3.tar.gz
dlang-51b60bbc3e404fad03b2fa9d111f986d9fdd5ae3.tar.bz2
dlang-51b60bbc3e404fad03b2fa9d111f986d9fdd5ae3.zip
dev-util/dub: add 1.36.0
Additional changes: - install bash/zsh/fish completions - generate man pages with USE=doc Signed-off-by: Horodniceanu Andrei <a.horodniceanu@proton.me>
-rw-r--r--dev-util/dub/Manifest1
-rw-r--r--dev-util/dub/dub-1.36.0.ebuild174
-rw-r--r--dev-util/dub/files/dub-1.36.0-fix-wno-error-not-applying.patch110
-rw-r--r--dev-util/dub/metadata.xml6
4 files changed, 290 insertions, 1 deletions
diff --git a/dev-util/dub/Manifest b/dev-util/dub/Manifest
index ce30927..2bf5f79 100644
--- a/dev-util/dub/Manifest
+++ b/dev-util/dub/Manifest
@@ -1,4 +1,5 @@
DIST dub-1.35.1.tar.gz 1494965 BLAKE2B 400e210584660f7ac67732006ca6d88156adbbf2bf221aa244e317bf7c2772a6a01d9e141252fbf0cfde4c07302ee533593f3a2f418f9e120edc7359a83180cf SHA512 a371a7ec7003a4a4fb642a3567fce0685c99f4940a02de94d026bdc6fe4e84512b16e4bb57673da4d3b8e25177cc3df329da41862086cecc7b98aec1ebf9e4e7
+DIST dub-1.36.0.tar.gz 1502081 BLAKE2B 2ae9503d5c8725de801d65a06fab07e9e3b8fbb007159b1e90fda18d2ca1f0361b055cf2de4e4290828a7fb401168b15c1a85eca872a58d7ce0d5eb5f979ff4e SHA512 7a0e5c5432bbe6d67be8f98e8bc7ef0350e9eb358b13f795b9c18ef9a781dc3092074d88b7a846cf69e1ba648641c6acd8b766ec4bf119ce9b380d886f87b4c3
DIST gitcompatibledubpackage-1.0.1.zip 1354 BLAKE2B 60c3ff78c9cc0ca16f36bfdb4d91f6ec7e8d1bc7fb2fae9488e3f24b33fc3b578157f3c2fd9f892743b1fba7ec473267d9027febd3c27ac2af52733e146c341d SHA512 0adb8a97cce0aaac1dbaea978aacf801071457c06413e618b0feb1adaf4169c7a1acbfac2d9c192fada4f2f8bd44e1ea3b9fce8c7cb3fb8bf364eba75f559122
DIST gitcompatibledubpackage-1.0.4.zip 2041 BLAKE2B 595080956881fd86753b17cdbb12108ab03161806ca51c748017f29251dd47a95a0aebde4442db1783602cfa67a9593014ebb6ca591dcfec2b08eef3d737e2cc SHA512 12057117be99bb4d2351af74cfd36c050734383bfc44b185cf5f9737d982e9fd6840f6968a3246b625d4ec90e9d30f5e394f8fa1febb85464429d771bc8062d0
DIST urld-2.1.1.zip 15062 BLAKE2B fe123fbef20167e07c81d0f7700a59c48dca28311329f9717283f3e7c88cc2430a1ffc26632c8c1512145b9d6fa6e432cee1677e99be3bd555247f02f7f42b67 SHA512 c4c8d349a8bbac9f234166ed9452ab221f8928e822c6ab95716b05948dbb21ae4309face4158909559698f23aa750c9faef5b2294feef7e601ccbc9a41c3b6bb
diff --git a/dev-util/dub/dub-1.36.0.ebuild b/dev-util/dub/dub-1.36.0.ebuild
new file mode 100644
index 0000000..7bae587
--- /dev/null
+++ b/dev-util/dub/dub-1.36.0.ebuild
@@ -0,0 +1,174 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Package and build management system for D"
+HOMEPAGE="https://code.dlang.org/"
+LICENSE="MIT"
+
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="debug doc test"
+RESTRICT="!test? ( test )"
+
+DUB_TEST_DEPS=(
+ gitcompatibledubpackage@1.0.1
+ gitcompatibledubpackage@1.0.4
+ urld@2.1.1
+)
+generate_dub_dependencies() {
+ local dep
+ for dep in "${DUB_TEST_DEPS[@]}"; do
+ local depName depVersion
+ depName="${dep%@*}"
+ depVersion="${dep#*@}"
+ echo "https://code.dlang.org/packages/${depName}/${depVersion}.zip -> ${depName}-${depVersion}.zip"
+ done
+}
+
+GITHUB_URI="https://codeload.github.com/dlang"
+SRC_URI="
+${GITHUB_URI}/${PN}/tar.gz/v${PV} -> ${PN}-${PV}.tar.gz
+test? (
+ $(generate_dub_dependencies)
+)
+"
+
+PATCHES=(
+ "${FILESDIR}/${PF}-fix-wno-error-not-applying.patch"
+)
+
+# Upstream recommends the latest version available
+DLANG_VERSION_RANGE="2.100-2.107"
+DLANG_PACKAGE_TYPE="single"
+
+inherit dlang shell-completion
+
+src_unpack() {
+ unpack "${P}.tar.gz"
+
+ if use test; then
+ # Copy the archives locally. Some tests do need to perform an
+ # actual fetch operation so make all of them available as
+ # archives and let dub figure out the rest.
+ local store="${T}/dub-test-deps"
+ mkdir -p "${store}" || die
+
+ local dep
+ for dep in "${DUB_TEST_DEPS[@]}"; do
+ local depName depVersion
+ depName="${dep%@*}"
+ depVersion="${dep#*@}"
+
+ cp "${DISTDIR}/${depName}-${depVersion}.zip" "${store}" || die
+ done
+
+ # Generate a settings.json file that points to the directory with all the deps.
+ cat <<EOF > "${T}/settings.json"
+{
+ "registryUrls": [
+ "file://${store}"
+ ],
+ "skipRegistry": "all"
+}
+EOF
+ fi
+}
+
+d_src_compile() {
+ local imports=source versions="DubApplication DubUseCurl"
+ dlang_compile_bin bin/dub $(<build-files.txt)
+
+ # Generate man pages. Rebuids dub so put it behind a USE flag.
+ if use doc; then
+ einfo "Generating man pages"
+ # You're supposed to be able to do ./bin/dub scrips/man/gen_man.d
+ # but it gives linking errors with gdc.
+
+ # $imports is set up above.
+ versions=DubUseCurl
+ dlang_compile_bin scripts/man/gen_man{,.d} \
+ $(sed '/^source\/app.d$/d' build-files.txt)
+ ./scripts/man/gen_man || die "Could not generate man pages"
+ fi
+}
+
+d_src_test() {
+ # Setup the environment for the tests.
+ local -x DUB="${S}/bin/dub"
+ local -x DUB_HOME="${T}/dub-home" # where to put artifacts
+
+ # Note, disabling tests is possible yet very hard. You have to
+ # create a bash variable containing a regex (to be used in =~) that
+ # matches all the tests that you want *to* run. It's probably easier
+ # to delete the subdirectory under ${S}/test.
+
+ # Tries to connect to github.com and fails due to the network sandbox
+ rm -rf "${S}/test/git-dependency" || die
+ # Doesn't work on non amd64/x86
+ if [[ ${ARCH} == arm64 ]]; then
+ rm -rf test/issue1447-build-settings-vars || die
+ fi
+
+ if [[ ${DLANG_VENDOR} == GNU ]]; then
+ # Should be skipped on dmd and gdc but $DC being in the form
+ # ${CHOST}-gdc makes the unittest script not skip it.
+ rm -rf test/depen-build-settings || die
+ fi
+
+ local dropImportCTest
+ # We have an importC test and not all compilers pass it properly.
+ # gdc doesn't support #include's in its importC implementation yet.
+ # Only check == 13 since 12 is skipped by the script.
+ [[ ${DLANG_VENDOR} == GNU ]] && [[ ${DC_VERSION} == 13 ]] && dropImportCTest=1
+ # Nor does <=ldc2-1.32.
+ [[ ${DLANG_VENDOR} == LDC ]] && $(ver_test ${DC_VERSION} -le 1.32) && dropImportCTest=1
+ # dmd can do #include's but there are some other errors about
+ # __float128 in <=dmd-2.102 on x86.
+ [[ ${DLANG_VENDOR} == DigitalMars ]] && $(ver_test ${DC_VERSION} -le 2.102) \
+ && [[ ${ARCH} == x86 ]] && dropImportCTest=1
+ if [[ ${dropImportCTest} ]]; then
+ rm -rf "${S}/test/use-c-sources" || die
+ fi
+
+ # Put the configuration file relative to the dub binary:
+ # <dub-bin-dir>/../etc/dub/settings.json as per
+ # https://dub.pm/dub-reference/settings so that it's picked up
+ # automatically.
+ mkdir -p "${S}/bin/../etc/dub" || die
+ cp "${T}/settings.json" "${S}/bin/../etc/dub/" \
+ || die "Could not copy dub configuration file"
+
+ # See https://bugs.gentoo.org/921581 we have to remove -op (preserve
+ # source path for output files) from the flags lest the sandbox
+ # trips us up.
+ local newDflags="${DCFLAGS//--op/}"
+ newDflags="${newDflags//-op/}"
+
+ # Append -Wno-error or equivalent
+ newDflags+=" $(get_wno_error_flag)"
+
+ DFLAGS="${newDflags}" FRONTEND="${DLANG_VERSION}" test/run-unittest.sh \
+ || die "Tests failed"
+}
+
+d_src_install() {
+ dobin bin/dub
+ dodoc README.md
+
+ # Make sure there are no man files in any other section.
+ use doc && doman scripts/man/*.1
+
+ newbashcomp scripts/bash-completion/${PN}.bash ${PN}
+ dozshcomp scripts/zsh-completion/_${PN}
+ dofishcomp scripts/fish-completion/${PN}.fish
+}
+
+get_wno_error_flag() {
+ case "${DLANG_VENDOR}" in
+ DigitalMars) echo "-wi" ;;
+ GNU) echo "-Wno-error" ;;
+ LDC) echo "--wi" ;;
+ esac
+}
diff --git a/dev-util/dub/files/dub-1.36.0-fix-wno-error-not-applying.patch b/dev-util/dub/files/dub-1.36.0-fix-wno-error-not-applying.patch
new file mode 100644
index 0000000..835414e
--- /dev/null
+++ b/dev-util/dub/files/dub-1.36.0-fix-wno-error-not-applying.patch
@@ -0,0 +1,110 @@
+commit 2ace85947547a5d97ecf740ec4e3e36903b5ad1a
+Author: Andrei Horodniceanu <a.horodniceanu@proton.me>
+Date: Sat Jan 13 11:42:16 2024 +0200
+
+ Let uesr $DFLAGS override build settings as much as possible
+
+ Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
+
+diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d
+index 78fd9d4b..5b59d2b9 100644
+--- a/source/dub/compilers/dmd.d
++++ b/source/dub/compilers/dmd.d
+@@ -230,6 +230,11 @@ config /etc/dmd.conf
+ {
+ enforceBuildRequirements(settings);
+
++ // Keep the current dflags at the end of the array so that they will overwrite other flags.
++ // This allows user $DFLAGS to modify flags added by us.
++ const dflagsTail = settings.dflags;
++ settings.dflags = [];
++
+ if (!(fields & BuildSetting.options)) {
+ foreach (t; s_options)
+ if (settings.options & t[0])
+@@ -282,6 +287,8 @@ config /etc/dmd.conf
+ if (platform.platform.canFind("posix") && (settings.options & BuildOption.pic))
+ settings.addDFlags("-fPIC");
+
++ settings.addDFlags(dflagsTail);
++
+ assert(fields & BuildSetting.dflags);
+ assert(fields & BuildSetting.copyFiles);
+ }
+diff --git a/source/dub/compilers/gdc.d b/source/dub/compilers/gdc.d
+index 0d34446e..3df8eda6 100644
+--- a/source/dub/compilers/gdc.d
++++ b/source/dub/compilers/gdc.d
+@@ -89,6 +89,11 @@ class GDCCompiler : Compiler {
+ {
+ enforceBuildRequirements(settings);
+
++ // Keep the current dflags at the end of the array so that they will overwrite other flags.
++ // This allows user $DFLAGS to modify flags added by us.
++ const dflagsTail = settings.dflags;
++ settings.dflags = [];
++
+ if (!(fields & BuildSetting.options)) {
+ foreach (t; s_options)
+ if (settings.options & t[0])
+@@ -138,6 +143,8 @@ class GDCCompiler : Compiler {
+ if (settings.options & BuildOption.pic)
+ settings.addDFlags("-fPIC");
+
++ settings.addDFlags(dflagsTail);
++
+ assert(fields & BuildSetting.dflags);
+ assert(fields & BuildSetting.copyFiles);
+ }
+diff --git a/source/dub/compilers/ldc.d b/source/dub/compilers/ldc.d
+index 3cb90e5b..3959df61 100644
+--- a/source/dub/compilers/ldc.d
++++ b/source/dub/compilers/ldc.d
+@@ -107,6 +107,11 @@ config /etc/ldc2.conf (x86_64-pc-linux-gnu)
+ import std.format : format;
+ enforceBuildRequirements(settings);
+
++ // Keep the current dflags at the end of the array so that they will overwrite other flags.
++ // This allows user $DFLAGS to modify flags added by us.
++ const dflagsTail = settings.dflags;
++ settings.dflags = [];
++
+ if (!(fields & BuildSetting.options)) {
+ foreach (t; s_options)
+ if (settings.options & t[0])
+@@ -170,6 +175,8 @@ config /etc/ldc2.conf (x86_64-pc-linux-gnu)
+ }
+ }
+
++ settings.addDFlags(dflagsTail);
++
+ assert(fields & BuildSetting.dflags);
+ assert(fields & BuildSetting.copyFiles);
+ }
+diff --git a/source/dub/package_.d b/source/dub/package_.d
+index 307ad78d..79be1ed2 100644
+--- a/source/dub/package_.d
++++ b/source/dub/package_.d
+@@ -422,10 +422,6 @@ class Package {
+ */
+ void addBuildTypeSettings(ref BuildSettings settings, in BuildPlatform platform, string build_type)
+ const {
+- import std.process : environment;
+- string dflags = environment.get("DFLAGS", "");
+- settings.addDFlags(dflags.split());
+-
+ if (auto pbt = build_type in m_info.buildTypes) {
+ logDiagnostic("Using custom build type '%s'.", build_type);
+ pbt.getPlatformSettings(settings, platform, this.path);
+@@ -450,6 +446,11 @@ class Package {
+ case "syntax": settings.addOptions(syntaxOnly); break;
+ }
+ }
++
++ // Add environment DFLAGS last so that user specified values are not overriden by us.
++ import std.process : environment;
++ string dflags = environment.get("DFLAGS", "");
++ settings.addDFlags(dflags.split());
+ }
+
+ /** Returns the selected configuration for a certain dependency.
diff --git a/dev-util/dub/metadata.xml b/dev-util/dub/metadata.xml
index 920817d..6f5df05 100644
--- a/dev-util/dub/metadata.xml
+++ b/dev-util/dub/metadata.xml
@@ -1,3 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata/> \ No newline at end of file
+<pkgmetadata>
+ <use>
+ <flag name="doc">Generate and install man pages. Requires building dub twice.</flag>
+ </use>
+</pkgmetadata>