motif: fix and enable strictDeps, fix cross build

This commit is contained in:
FliegendeWurst 2025-01-19 12:21:41 +01:00 committed by Alyssa Ross
parent e6443544dc
commit f4a5540680

View file

@ -3,6 +3,7 @@
stdenv,
fetchurl,
fetchpatch,
buildPackages,
pkg-config,
libtool,
xbitmaps,
@ -32,6 +33,7 @@ stdenv.mkDerivation rec {
};
buildInputs = [
flex
libtool
xbitmaps
libXext
@ -55,9 +57,35 @@ stdenv.mkDerivation rec {
libXau
];
postPatch = lib.optionalString (!demoSupport) ''
sed 's/\<demos\>//' -i Makefile.{am,in}
'';
strictDeps = true;
postPatch =
''
# File existence fails when cross-compiling - useless for Nix anyhow
substituteInPlace ./configure --replace-fail \
'as_fn_error $? "cannot check for file existence' '#' \
--replace-fail 'pkg-config' '${stdenv.cc.targetPrefix}pkg-config'
''
+ lib.optionalString (!demoSupport) ''
sed 's/\<demos\>//' -i Makefile.{am,in}
''
# for cross builds, we must copy several build tools from a native build
# (and we must ensure they are not removed and recreated by make)
+ lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
cp "${buildPackages.motif}/lib/internals/makestrs" config/util/makestrs
substituteInPlace config/util/Makefile.in \
--replace-fail '@rm -f makestrs$(EXEEXT)' "" \
--replace-fail '$(AM_V_CCLD)$(LINK) $(makestrs_OBJECTS) $(makestrs_LDADD) $(LIBS)' ""
cp "${buildPackages.motif}"/lib/internals/{wml,wmluiltok,wmldbcreate} tools/wml/
substituteInPlace tools/wml/Makefile.in \
--replace-fail '@rm -f wmldbcreate$(EXEEXT)' "" \
--replace-fail '$(AM_V_CCLD)$(LINK) $(wmldbcreate_OBJECTS) $(wmldbcreate_LDADD) $(LIBS)' "" \
--replace-fail '@rm -f wmluiltok$(EXEEXT)' "" \
--replace-fail '$(AM_V_CCLD)$(LINK) $(wmluiltok_OBJECTS) $(wmluiltok_LDADD) $(LIBS)' "" \
--replace-fail '@rm -f wml$(EXEEXT)' "" \
--replace-fail '$(AM_V_CCLD)$(LINK) $(wml_OBJECTS) $(wml_LDADD) $(LIBS)' ""
'';
patches = [
./Remove-unsupported-weak-refs-on-darwin.patch
@ -104,6 +132,12 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# copy tools for cross builds
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
mkdir -p "$out/lib/internals"
cp config/util/makestrs tools/wml/{wml,wmluiltok,.libs/wmldbcreate} "$out/lib/internals"
'';
meta = with lib; {
homepage = "https://motif.ics.com";
description = "Unix standard widget-toolkit and window-manager";