diff --git a/pkgs/c/compat.glfw.lua b/pkgs/c/compat.glfw.lua index 85f234f2..2b4a8362 100644 --- a/pkgs/c/compat.glfw.lua +++ b/pkgs/c/compat.glfw.lua @@ -168,10 +168,35 @@ package = { import("xim.libxpkg.pkginfo") +-- THE SOURCE TREE IS NAMED BY UPSTREAM'S TAG, NOT BY THIS PACKAGE'S VERSION. +-- +-- They were the same string for as long as this package had one version, and +-- the fallback below spelled the directory as `"glfw-" .. pkginfo.version()`. +-- The day the package took an ecosystem segment -- 3.4.0.1, for a pin that +-- moved while upstream did not release -- that expression asked for +-- `glfw-3.4.0.1/`, which no tarball contains. install() then moved nothing and +-- the failure appeared two layers away, as `GLFW/glfw3.h: file not found` in a +-- consumer's test. +-- +-- A path derived from a version is a path that breaks the first time the +-- version means something the upstream tag does not. +local UPSTREAM_TAG = "3.4" + +import("xim.libxpkg.log") + function install() local srcdir = pkginfo.install_file():replace(".tar.gz", "") if not os.isdir(srcdir) then - srcdir = "glfw-" .. pkginfo.version() + srcdir = "glfw-" .. UPSTREAM_TAG + end + if not os.isdir(srcdir) then + -- Loud, because the alternative is an install that "succeeds" and + -- leaves an install_dir with no headers in it. + log.error("compat.glfw: no source tree at %s; the tarball's top-level " + .. "directory is named by upstream's tag (%s), and neither " + .. "that nor the downloaded name matched", + srcdir, UPSTREAM_TAG) + return false end os.tryrm(pkginfo.install_dir()) diff --git a/tests/examples/gui-stack/mcpp.toml b/tests/examples/gui-stack/mcpp.toml index fb4aba12..69ef8b98 100644 --- a/tests/examples/gui-stack/mcpp.toml +++ b/tests/examples/gui-stack/mcpp.toml @@ -7,7 +7,7 @@ name = "gui-stack-tests" version = "0.1.0" [target.'cfg(linux)'.dependencies.compat] -glfw = "3.4" +glfw = "3.4.0.1" x11 = "1.8.13" xcb = "1.17.0" xext = "1.3.7" diff --git a/tests/examples/imgui-window/mcpp.toml b/tests/examples/imgui-window/mcpp.toml index 6878de3a..0a804ce9 100644 --- a/tests/examples/imgui-window/mcpp.toml +++ b/tests/examples/imgui-window/mcpp.toml @@ -7,6 +7,6 @@ version = "0.1.0" [target.'cfg(linux)'.dependencies.compat] imgui = "1.92.8" -glfw = "3.4" +glfw = "3.4.0.1" [target.'cfg(linux)'.build] ldflags = ["-ldl"]