diff mbox series

[meta-oe] xdotool: fix do_install failure due to missing pc.sh

Message ID 20260723073622.1859407-1-yogesh.tyagi@intel.com
State New
Headers show
Series [meta-oe] xdotool: fix do_install failure due to missing pc.sh | expand

Commit Message

Tyagi, Yogesh July 23, 2026, 7:36 a.m. UTC
From: Yogesh Tyagi <yogesh.tyagi@intel.com>

The 4.20251130.1 upgrade switched SRC_URI from a git snapshot to the
GitHub release tarball. That tarball ships a prebuilt libxdo.pc but does
not include pc.sh, even though the Makefile still carries the rule:

    libxdo.pc: VERSION
    	sh pc.sh $(VERSION) $(INSTALLLIB) $(INSTALLINCLUDE) > libxdo.pc

do_install runs "make install", which pulls in the installpc target.
Because libxdo.pc depends on VERSION, whenever a fresh unpack leaves
VERSION with an mtime newer than or equal to libxdo.pc, make considers
the shipped libxdo.pc stale and re-runs pc.sh, failing with:

    sh: 0: cannot open pc.sh: No such file
    make: *** [Makefile:153: libxdo.pc] Error 2

The mtime ordering after unpack is not deterministic, so the failure is
intermittent and typically shows up after a re-fetch. On top of that,
the prebuilt libxdo.pc in the tarball hard-codes /usr/local paths, so
even when the race does not trigger, an incorrect .pc gets installed.

Ship the upstream pc.sh alongside the recipe and place it in ${S} so the
installpc rule regenerates libxdo.pc with the correct libdir/includedir
from EXTRA_OEMAKE. This fixes both the build failure and the wrong paths.

Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
---
 meta-oe/recipes-graphics/xdotool/xdotool/pc.sh  | 17 +++++++++++++++++
 .../xdotool/xdotool_4.20251130.1.bb             | 12 +++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-graphics/xdotool/xdotool/pc.sh
diff mbox series

Patch

diff --git a/meta-oe/recipes-graphics/xdotool/xdotool/pc.sh b/meta-oe/recipes-graphics/xdotool/xdotool/pc.sh
new file mode 100644
index 0000000000..da7c81d75d
--- /dev/null
+++ b/meta-oe/recipes-graphics/xdotool/xdotool/pc.sh
@@ -0,0 +1,17 @@ 
+#!/bin/sh
+
+VERSION=$1
+LIBDIR=$2
+INCLUDEDIR=$3
+
+cat <<ENDPC
+libdir=${LIBDIR}
+includedir=${INCLUDEDIR}
+
+Name: libxdo
+Description: fake keyboard/mouse input, window management, and more
+Version: ${VERSION}
+Requires: x11
+Libs: -L\${libdir} -lxdo
+Cflags: -I\${includedir}
+ENDPC
diff --git a/meta-oe/recipes-graphics/xdotool/xdotool_4.20251130.1.bb b/meta-oe/recipes-graphics/xdotool/xdotool_4.20251130.1.bb
index e2792ed0b0..a1a792f45d 100644
--- a/meta-oe/recipes-graphics/xdotool/xdotool_4.20251130.1.bb
+++ b/meta-oe/recipes-graphics/xdotool/xdotool_4.20251130.1.bb
@@ -9,7 +9,13 @@  inherit features_check pkgconfig perlnative
 # depends on virtual/libx11
 REQUIRED_DISTRO_FEATURES = "x11"
 
-SRC_URI = "https://github.com/jordansissel/${BPN}/releases/download/v${PV}/${BP}.tar.gz"
+# The release tarball ships a prebuilt (and wrongly pathed) libxdo.pc but omits
+# pc.sh, which the Makefile's installpc rule needs to (re)generate libxdo.pc.
+# Depending on the unpack mtime ordering of VERSION vs libxdo.pc, make tries to
+# rebuild libxdo.pc and fails with "sh: 0: cannot open pc.sh". Supply the
+# upstream pc.sh so regeneration works with the correct libdir/includedir.
+SRC_URI = "https://github.com/jordansissel/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
+           file://pc.sh"
 SRC_URI[sha256sum] = "eee789b00d6a13d47b31bbc139727e6408c21b5f6ba5e804fdf6ecfb8c781356"
 
 EXTRA_OEMAKE = "PREFIX=${prefix} INSTALLLIB=${libdir} INSTALLMAN=${mandir} WITHOUT_RPATH_FIX=1"
@@ -17,6 +23,10 @@  EXTRA_OEMAKE = "PREFIX=${prefix} INSTALLLIB=${libdir} INSTALLMAN=${mandir} WITHO
 UPSTREAM_CHECK_URI = "https://github.com/jordansissel/xdotool/tags"
 UPSTREAM_CHECK_REGEX = "v(?P<pver>\d+\.\d{8}\.\d+)"
 
+do_configure:append() {
+    install -m 0755 ${UNPACKDIR}/pc.sh ${S}/pc.sh
+}
+
 do_install() {
     oe_runmake install DESTDIR=${D} PREFIX=${prefix} LDCONFIG=true
 }