From eae9ab10b7102343ab8dd752ff93f159303556a8 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Mon, 8 Jul 2019 17:54:17 +0000 Subject: [PATCH] Make motif cross-compilable again. --- x11/motif/Makefile | 26 ++++- x11/motif/distinfo | 2 + .../patches/patch-config_util_Makefile.in | 42 ++++++++ x11/motif/patches/patch-tools_wml_Makefile.in | 99 +++++++++++++++++++ 4 files changed, 167 insertions(+), 2 deletions(-) create mode 100644 x11/motif/patches/patch-config_util_Makefile.in create mode 100644 x11/motif/patches/patch-tools_wml_Makefile.in diff --git a/x11/motif/Makefile b/x11/motif/Makefile index 8e777c6c9d4..4c531e4328c 100644 --- a/x11/motif/Makefile +++ b/x11/motif/Makefile @@ -47,8 +47,30 @@ CONFIGURE_ARGS+= --enable-xft CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) -MAKE_FLAGS+= CROSS_COMPILING=yes CC_FOR_BUILD=${NATIVE_CC:Q} \ - CPPFLAGS_FOR_BUILD=-I${PREFIX}/include +TOOL_DEPENDS= ${PKGNAME}:../../${PKGPATH} + +MAKE_FLAGS+= CC_FOR_BUILD=${NATIVE_CC:Q} +MAKE_FLAGS+= CPPFLAGS_FOR_BUILD=-I${PREFIX}/include +MAKE_FLAGS+= LDFLAGS_FOR_BUILD=-L${PREFIX}/lib\ -Wl,-R${PREFIX}/lib + +# Motif's configure checks for /usr/X/include/X11/X.h and +# /usr/X11R6/include/X11/X.h to decide whether the default prefix +# should be /usr/X, /usr/X11R6, or /usr. But we set the prefix anyway, +# so this is moot. +CONFIGURE_ARGS+= ac_cv_file__usr_X_include_X11_X_h=false +CONFIGURE_ARGS+= ac_cv_file__usr_X11R6_include_X11_X_h=false +.endif + +SUBST_CLASSES+= cross +SUBST_STAGE.cross= pre-configure +SUBST_MESSAGE.cross= Choosing between cross-compilation or not. +SUBST_FILES.cross+= tools/wml/Makefile.in +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +SUBST_SED.cross+= -e 's,@IF_NATIVE@,\#,g' +SUBST_SED.cross+= -e 's,@IF_CROSS@,,g' +.else +SUBST_SED.cross+= -e 's,@IF_NATIVE@,,g' +SUBST_SED.cross+= -e 's,@IF_CROSS@,\#,g' .endif # 1) Fix the man pages to refer to the correct sections. diff --git a/x11/motif/distinfo b/x11/motif/distinfo index d44791d0b09..aede7ff184b 100644 --- a/x11/motif/distinfo +++ b/x11/motif/distinfo @@ -8,6 +8,7 @@ SHA1 (patch-Makefile.in) = 9f4573cd47989a821ea616df53da924766fe3d39 SHA1 (patch-clients_uil_UilDB.c) = 781b52e915e667eeb02359a51cfeefdb9556c4dd SHA1 (patch-clients_uil_UilDefI.h) = 6447a306809e65b4993d79e14a989a01aed2e0bc SHA1 (patch-clients_uil_UilDiags.c) = 39ac8307219b435baf3d1bf829809fcb6536b1a9 +SHA1 (patch-config_util_Makefile.in) = f02af49e80a7df5db0bf51fff8c87bea81e1502b SHA1 (patch-doc_man_man3_Makefile.am) = b396f5e1235834f507a415c62b0efaa939943f1d SHA1 (patch-doc_man_man4_Makefile.am) = 154071494cf54a65e2e266861c81771a14156cae SHA1 (patch-doc_man_man5_Makefile.am) = 2f6e0cc239faf53e3391aef9da3def934023928e @@ -17,3 +18,4 @@ SHA1 (patch-lib_Xm_Xmfuncs.h) = fef6a642988a8024da0bff00cdc40dc485695e2b SHA1 (patch-lib_Xm_Xmos.c) = 88af3627fad7c9ec40db0e8aca47e9617fe8c53b SHA1 (patch-lib_Xm_XpmI.h) = b27e0156bc2dd990a4d9642186b1638276054314 SHA1 (patch-tools_wml_wmluiltok.l) = 1e79df5605ad8b25a55fbb617a707d27d27e3f2a +SHA1 (patch-tools_wml_Makefile.in) = fd4d6385714e275337e9549e75c3fd23ffeb494d diff --git a/x11/motif/patches/patch-config_util_Makefile.in b/x11/motif/patches/patch-config_util_Makefile.in new file mode 100644 index 00000000000..24b358e91c3 --- /dev/null +++ b/x11/motif/patches/patch-config_util_Makefile.in @@ -0,0 +1,42 @@ +$NetBSD$ + +--- config/util/Makefile.in.orig 2017-12-05 12:49:57.000000000 +0000 ++++ config/util/Makefile.in +@@ -89,7 +89,7 @@ POST_UNINSTALL = : + build_triplet = @build@ + host_triplet = @host@ + target_triplet = @target@ +-noinst_PROGRAMS = makestrs$(EXEEXT) ++noinst_PROGRAMS = makestrs + subdir = config/util + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/ac_find_xft.m4 \ +@@ -186,6 +186,7 @@ AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ ++CC_FOR_BUILD = $(CC) + CCDEPMODE = @CCDEPMODE@ + CDE_CONFIGURATION_TOP = @CDE_CONFIGURATION_TOP@ + CDE_INSTALLATION_TOP = @CDE_INSTALLATION_TOP@ +@@ -193,6 +194,7 @@ CFLAGS = @CFLAGS@ + CONFDIR = @CONFDIR@ + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ ++CPPFLAGS_FOR_BUILD = $(CPPFLAGS) + CURRENT = @CURRENT@ + CYGPATH_W = @CYGPATH_W@ + DEFS = @DEFS@ +@@ -383,9 +385,9 @@ clean-noinstPROGRAMS: + echo " rm -f" $$list; \ + rm -f $$list + +-makestrs$(EXEEXT): $(makestrs_OBJECTS) $(makestrs_DEPENDENCIES) $(EXTRA_makestrs_DEPENDENCIES) +- @rm -f makestrs$(EXEEXT) +- $(AM_V_CCLD)$(LINK) $(makestrs_OBJECTS) $(makestrs_LDADD) $(LIBS) ++makestrs: $(makestrs_DEPENDENCIES) $(EXTRA_makestrs_DEPENDENCIES) ++ @rm -f makestrs ++ $(AM_V_CCLD)$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -o $@ makestrs.c + + mostlyclean-compile: + -rm -f *.$(OBJEXT) diff --git a/x11/motif/patches/patch-tools_wml_Makefile.in b/x11/motif/patches/patch-tools_wml_Makefile.in new file mode 100644 index 00000000000..b3eb63b890f --- /dev/null +++ b/x11/motif/patches/patch-tools_wml_Makefile.in @@ -0,0 +1,99 @@ +$NetBSD$ + +Conditionalize the build of the wml tools when cross-compiling: + +- If we're compiling natively, link against the newly built libXm.la. + +- If we're cross-compiling, use the natively installed -lXm + +--- tools/wml/Makefile.in.orig 2017-12-05 12:49:59.000000000 +0000 ++++ tools/wml/Makefile.in +@@ -130,7 +130,7 @@ am__v_lt_0 = --silent + am__v_lt_1 = + wmldbcreate_SOURCES = $(srcdir)/wmldbcreate.c + wmldbcreate_OBJECTS = wmldbcreate.$(OBJEXT) +-wmldbcreate_DEPENDENCIES = ../../lib/Xm/libXm.la ++@IF_NATIVE@wmldbcreate_DEPENDENCIES = ../../lib/Xm/libXm.la + am_wmluiltok_OBJECTS = wmluiltok.$(OBJEXT) + wmluiltok_OBJECTS = $(am_wmluiltok_OBJECTS) + wmluiltok_DEPENDENCIES = +@@ -150,8 +150,8 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles + am__mv = mv -f +-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++COMPILE = $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ ++ $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS) + LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +@@ -161,9 +161,10 @@ am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) + am__v_CC_0 = @echo " CC " $@; + am__v_CC_1 = + CCLD = $(CC) +-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +- $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++@IF_CROSS@LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ ++@IF_NATIVE@LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ ++@IF_NATIVE@ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ ++@IF_NATIVE@ $(AM_LDFLAGS) $(LDFLAGS) -o $@ + AM_V_CCLD = $(am__v_CCLD_@AM_V@) + am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) + am__v_CCLD_0 = @echo " CCLD " $@; +@@ -256,6 +257,7 @@ AUTOHEADER = @AUTOHEADER@ + AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ ++CC_FOR_BUILD = $(CC) + CCDEPMODE = @CCDEPMODE@ + CDE_CONFIGURATION_TOP = @CDE_CONFIGURATION_TOP@ + CDE_INSTALLATION_TOP = @CDE_INSTALLATION_TOP@ +@@ -263,6 +265,7 @@ CFLAGS = @CFLAGS@ + CONFDIR = @CONFDIR@ + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ ++CPPFLAGS_FOR_BUILD = $(CPPFLAGS) + CURRENT = @CURRENT@ + CYGPATH_W = @CYGPATH_W@ + DEFS = @DEFS@ +@@ -289,12 +292,13 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LD = @LD@ + LDFLAGS = @LDFLAGS@ ++LDFLAGS_FOR_BUILD = $(LDFLAGS) + LEX = @LEX@ + LEXLIB = @LEXLIB@ + LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ + LIBDIR = @LIBDIR@ + LIBOBJS = @LIBOBJS@ +-LIBS = @LIBS@ ++#LIBS = @LIBS@ + LIBTOOL = @LIBTOOL@ + LIB_XP = @LIB_XP@ + LIPO = @LIPO@ +@@ -424,7 +428,8 @@ wmluiltok_LDADD = @LEXLIB@ + wml_SOURCES = wml.c + wml_LDADD = -L. -lwml + wml_DEPENDENCIES = libwml.a +-wmldbcreate_LDADD = ../../lib/Xm/libXm.la ++@IF_CROSS@wmldbcreate_LDADD = -lXm ++@IF_NATIVE@wmldbcreate_LDADD = ../../lib/Xm/libXm.la + INCLUDES = -I../../lib -I$(srcdir)/../../lib -I$(srcdir)/../../include ${X_CFLAGS} + noinst_LIBRARIES = libwml.a + libwml_a_SOURCES = wmlparse.y wml.c wmloutkey.c wmlouth.c wmloutmm.c wmloutp1.c wmlresolve.c wmlsynbld.c wmlutils.c +@@ -534,11 +539,11 @@ distclean-compile: + @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + + wmldbcreate.o: $(srcdir)/wmldbcreate.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wmldbcreate.o -MD -MP -MF $(DEPDIR)/wmldbcreate.Tpo -c -o wmldbcreate.o `test -f '$(srcdir)/wmldbcreate.c' || echo '$(srcdir)/'`$(srcdir)/wmldbcreate.c ++@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS) -MT wmldbcreate.o -MD -MP -MF $(DEPDIR)/wmldbcreate.Tpo -c -o wmldbcreate.o `test -f '$(srcdir)/wmldbcreate.c' || echo '$(srcdir)/'`$(srcdir)/wmldbcreate.c + @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/wmldbcreate.Tpo $(DEPDIR)/wmldbcreate.Po + @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/wmldbcreate.c' object='wmldbcreate.o' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wmldbcreate.o `test -f '$(srcdir)/wmldbcreate.c' || echo '$(srcdir)/'`$(srcdir)/wmldbcreate.c ++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS) -c -o wmldbcreate.o `test -f '$(srcdir)/wmldbcreate.c' || echo '$(srcdir)/'`$(srcdir)/wmldbcreate.c + + wmldbcreate.obj: $(srcdir)/wmldbcreate.c + @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wmldbcreate.obj -MD -MP -MF $(DEPDIR)/wmldbcreate.Tpo -c -o wmldbcreate.obj `if test -f '$(srcdir)/wmldbcreate.c'; then $(CYGPATH_W) '$(srcdir)/wmldbcreate.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/wmldbcreate.c'; fi`