mcde recipe: the path replacements touch text only, once

pre-configure ran sed over every file under WRKSRC holding /usr/dt or
/etc/dt.  From an extracted archive that is text; in a built tree,
configured again by ext-resync/fork_reconfigure, it garbled 35 objects and
libraries (ld: 'file format not recognized', userland-2026-11-17g.log:33,
h.log:148), and since ${PKG_SYSCONFDIR}/dt holds /etc/dt again, the second
pass wrote /usr/pkg/usr/pkg/etc/dt into 276 files of the work directory.
Now grep -I (text only), the package's path set aside before the
replacement (idempotent), and a file the replacement does not change is not
rewritten (no new time stamp, nothing recompiled).  Tested in a scratch
tree: two passes, a binary with /etc/dt untouched, the time stamp kept.
This commit is contained in:
lotherk committed 2026-11-17 17:05:27 +00:00
1 parent 8169c04b38
commit 6b69dc7f1e
1 file changed
+22 -13
+22 -13
View File
@@ -18,7 +18,7 @@ CONFLICTS+= cde-[0-9]*
USE_LANGUAGES= c c++
USE_LIBTOOL= yes
USE_TOOLS+= aclocal autoconf automake autoreconf
USE_TOOLS+= awk bdftopcf gettext gmake gzip ksh
USE_TOOLS+= awk bdftopcf cmp gettext gmake gzip ksh
USE_TOOLS+= lex mkfontdir patch perl pkg-config yacc
MAKE_JOBS_SAFE= no
@@ -188,20 +188,29 @@ post-extract:
${RUN}${CP} ${FILESDIR}/${f} ${WRKSRC}/pkgsrc
.endfor
# The paths of CDE become the package's. pre-configure runs again whenever
# tools/userland.sh or tools/ext-resync.sh configure an already built tree, so
# each replacement is
# - for text only (grep -I): sed over the objects of a built tree garbled 35
# .o, .a and .so files ("file not recognized", build/logs/
# userland-2026-11-17g.log:33-51 and h.log:148);
# - idempotent: ${PKG_SYSCONFDIR}/dt is /usr/pkg/etc/dt and holds /etc/dt
# again, so a second pass wrote /usr/pkg/usr/pkg/etc/dt into 276 files.
# What is already the package's path is set aside first;
# - silent for a file it does not change: no new time stamp, nothing
# recompiled for it.
MCDE_PATHFIX= for f in `${FIND} ${WRKSRC} -type f | ${XARGS} ${GREP} -lI "$$from"`; do \
${SED} -e "s:$$to:@MCDE_PATHFIX@:g" -e "s:$$from:$$to:g" \
-e "s:@MCDE_PATHFIX@:$$to:g" $$f > $$f.pdone; \
if cmp -s $$f $$f.pdone; then ${RM} -f $$f.pdone; \
else ${ECHO} "Replacing $$from in $$f"; ${MV} $$f.pdone $$f; fi; \
done
pre-configure:
${RUN}${CHMOD} u+w ${WRKDIR}/*
${RUN}for f in `${FIND} ${WRKSRC} -type f | ${XARGS} ${GREP} -l '/usr/bin/X11'`; do \
${ECHO} Replacing X11 binary path in $$f ; \
${SED} -e 's:/usr/bin/X11:${X11BASE}/bin:g' $$f > $$f.pdone && ${MV} $$f.pdone $$f; \
done
${RUN}for f in `${FIND} ${WRKSRC} -type f | ${XARGS} ${GREP} -l '/usr/dt'`; do \
${ECHO} Replacing CDE prefix in $$f ; \
${SED} -e 's:/usr/dt:${PREFIX}/dt:g' $$f > $$f.pdone && ${MV} $$f.pdone $$f; \
done
${RUN}for f in `${FIND} ${WRKSRC} -type f | ${XARGS} ${GREP} -l '/etc/dt'`; do \
${ECHO} Replacing CDE syscondir in $$f ; \
${SED} -e 's:/etc/dt:${PKG_SYSCONFDIR}/dt:g' $$f > $$f.pdone && ${MV} $$f.pdone $$f; \
done
${RUN}from=/usr/bin/X11 to=${X11BASE}/bin; ${MCDE_PATHFIX}
${RUN}from=/usr/dt to=${PREFIX}/dt; ${MCDE_PATHFIX}
${RUN}from=/etc/dt to=${PKG_SYSCONFDIR}/dt; ${MCDE_PATHFIX}
${RUN}set -e; cd ${WRKSRC} && autoreconf -fiv
# libtool wrote '=<workdir>/.buildlink/lib/libpng16.la' into dependency_libs of