Package: pmake Version: 1.111-2 Severity: important Tags: patch Hi!
The pmake system makefiles hardcode several standard library paths, which will make other programs break due to those being located in a different place on multiarch. I'm attaching a patch which should ideally fix this, although please take into account I've only build tested it as I don't have a multiarch setup around. thanks, guillem
diff --git a/debian/patches/140_multiarch.diff b/debian/patches/140_multiarch.diff new file mode 100644 index 0000000..adb7530 --- /dev/null +++ b/debian/patches/140_multiarch.diff @@ -0,0 +1,349 @@ +--- + Makefile.boot | 5 +- + arch.c | 9 --- + main.c | 31 ++++++++++++ + make.1 | 1 + mk/bsd.lib.mk | 8 +++ + mk/bsd.own.mk | 2 + mk/bsd.prog.mk | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 7 files changed, 179 insertions(+), 13 deletions(-) + +--- a/arch.c ++++ b/arch.c +@@ -146,15 +146,6 @@ __RCSID("$NetBSD: arch.c,v 1.44 2005/02/ + #include "dir.h" + #include "config.h" + +-#ifdef TARGET_MACHINE +-#undef MAKE_MACHINE +-#define MAKE_MACHINE TARGET_MACHINE +-#endif +-#ifdef TARGET_MACHINE_ARCH +-#undef MAKE_MACHINE_ARCH +-#define MAKE_MACHINE_ARCH TARGET_MACHINE_ARCH +-#endif +- + static Lst archives; /* Lst of archives we've already examined */ + + typedef struct Arch { +--- a/main.c ++++ b/main.c +@@ -146,6 +146,19 @@ __RCSID("$NetBSD: main.c,v 1.111 2005/06 + #define DEFMAXLOCAL DEFMAXJOBS + #endif /* DEFMAXLOCAL */ + ++#ifdef TARGET_MACHINE ++#undef MAKE_MACHINE ++#define MAKE_MACHINE TARGET_MACHINE ++#endif ++#ifdef TARGET_MACHINE_ARCH ++#undef MAKE_MACHINE_ARCH ++#define MAKE_MACHINE_ARCH TARGET_MACHINE_ARCH ++#endif ++#ifdef TARGET_MACHINE_MULTIARCH ++#undef MAKE_MACHINE_MULTIARCH ++#define MAKE_MACHINE_MULTIARCH TARGET_MACHINE_MULTIARCH ++#endif ++ + Lst create; /* Targets to be made */ + time_t now; /* Time at start of make */ + GNode *DEFAULT; /* .DEFAULT node */ +@@ -628,6 +641,7 @@ main(int argc, char **argv) + char mdpath[MAXPATHLEN]; + char *machine = getenv("MACHINE"); + const char *machine_arch = getenv("MACHINE_ARCH"); ++ const char *machine_multiarch = getenv("MACHINE_MULTIARCH"); + char *syspath = getenv("MAKESYSPATH"); + Lst sysMkPath; /* Path of sys.mk */ + char *cp = NULL, *start; +@@ -711,8 +725,8 @@ main(int argc, char **argv) + * so we can share an executable for similar machines. + * (i.e. m68k: amiga hp300, mac68k, sun3, ...) + * +- * Note that both MACHINE and MACHINE_ARCH are decided at +- * run-time. ++ * Note that all of MACHINE, MACHINE_ARCH and MACHINE_MULTIARCH ++ * are decided at run-time. + */ + if (!machine) { + #ifdef MAKE_NATIVE +@@ -745,6 +759,18 @@ main(int argc, char **argv) + #endif + } + ++ if (!machine_multiarch) { ++#ifndef MACHINE_MULTIARCH ++#ifdef MAKE_MACHINE_MULTIARCH ++ machine_multiarch = MAKE_MACHINE_MULTIARCH; ++#else ++ machine_multiarch = "unknown-unknown-unknown"; ++#endif ++#else ++ machine_multiarch = MACHINE_MULTIARCH; ++#endif ++ } ++ + /* + * Just in case MAKEOBJDIR wants us to do something tricky. + */ +@@ -753,6 +779,7 @@ main(int argc, char **argv) + Var_Set(".CURDIR", curdir, VAR_GLOBAL, 0); + Var_Set("MACHINE", machine, VAR_GLOBAL, 0); + Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL, 0); ++ Var_Set("MACHINE_MULTIARCH", machine_multiarch, VAR_GLOBAL, 0); + #ifdef MAKE_VERSION + Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL, 0); + #endif +--- a/make.1 ++++ b/make.1 +@@ -1569,6 +1569,7 @@ If no sources are specified, any previou + uses the following environment variables, if they exist: + .Ev MACHINE , + .Ev MACHINE_ARCH , ++.Ev MACHINE_MULTIARCH , + .Ev MAKE , + .Ev MAKEFLAGS , + .Ev MAKEOBJDIR , +--- a/Makefile.boot ++++ b/Makefile.boot +@@ -4,7 +4,8 @@ + # + # You only want to use this if you aren't running NetBSD. + # +-# modify MACHINE and MACHINE_ARCH as appropriate for your target architecture ++# modify MACHINE, MACHINE_ARCH and MACHINE_MULTIARCH as appropriate for ++# your target architecture + # + CC=gcc -O -g + +@@ -13,11 +14,13 @@ CC=gcc -O -g + + MACHINE=i386 + MACHINE_ARCH=i386 ++MACHINE_MULTIARCH=i386-linux-gnu + # tested on HP-UX 10.20 + #MAKE_MACHINE=hp700 + #MAKE_MACHINE_ARCH=hppa + CFLAGS= -DTARGET_MACHINE=\"${MACHINE}\" \ + -DTARGET_MACHINE_ARCH=\"${MACHINE_ARCH}\" \ ++ -DTARGET_MACHINE_MULTIARCH=\"${MACHINE_MULTIARCH}\" \ + -DMAKE_MACHINE=\"${MACHINE}\" + LIBS= + +--- a/mk/bsd.prog.mk ++++ b/mk/bsd.prog.mk +@@ -19,8 +19,16 @@ CFLAGS+= ${COPTS} + + # ELF platforms depend on crtbegin.o and crtend.o + .if ${OBJECT_FMT} == "ELF" ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtbegin.o) ++LIBCRTBEGIN?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtbegin.o ++.else + LIBCRTBEGIN?= ${DESTDIR}/usr/lib/crtbegin.o ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtend.o) ++LIBCRTEND?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtend.o ++.else + LIBCRTEND?= ${DESTDIR}/usr/lib/crtend.o ++.endif + .else + LIBCRTBEGIN?= + LIBCRTEND?= +@@ -28,38 +36,166 @@ LIBCRTEND?= + + LIBCRT0?= + ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libbz2.a) ++LIBBZ2?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libbz2.a ++.else + LIBBZ2?= ${DESTDIR}/usr/lib/libbz2.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libc.a) ++LIBC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libc.a ++.else + LIBC?= ${DESTDIR}/usr/lib/libc.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libc_pic.a) ++LIBC_PIC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libc_pic.a ++.else + LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libcompat.a) ++LIBCOMPAT?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libcompat.a ++.else + LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libcrypt.a) ++LIBCRYPT?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libcrypt.a ++.else + LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libcurses.a) ++LIBCURSES?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libcurses.a ++.else + LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libdbm.a) ++LIBDBM?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libdbm.a ++.else + LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libdes.a) ++LIBDES?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libdes.a ++.else + LIBDES?= ${DESTDIR}/usr/lib/libdes.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libedit.a) ++LIBEDIT?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libedit.a ++.else + LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libgcc.a) ++LIBGCC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libgcc.a ++.else + LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libgnumalloc.a) ++LIBGNUMALLOC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libgnumalloc.a ++.else + LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libkdb.a) ++LIBKDB?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libkdb.a ++.else + LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libkrb.a) ++LIBKRB?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libkrb.a ++.else + LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libkvm.a) ++LIBKVM?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libkvm.a ++.else + LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libl.a) ++LIBL?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libl.a ++.else + LIBL?= ${DESTDIR}/usr/lib/libl.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libm.a) ++LIBM?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libm.a ++.else + LIBM?= ${DESTDIR}/usr/lib/libm.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libmp.a) ++LIBMP?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libmp.a ++.else + LIBMP?= ${DESTDIR}/usr/lib/libmp.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libntp.a) ++LIBNTP?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libntp.a ++.else + LIBNTP?= ${DESTDIR}/usr/lib/libntp.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libobjc.a) ++LIBOBJC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libobjc.a ++.else + LIBOBJC?= ${DESTDIR}/usr/lib/libobjc.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libpc.a) ++LIBPC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libpc.a ++.else + LIBPC?= ${DESTDIR}/usr/lib/libpc.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libpcap.a) ++LIBPCAP?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libpcap.a ++.else + LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libplot.a) ++LIBPLOT?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libplot.a ++.else + LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libposix.a) ++LIBPOSIX?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libposix.a ++.else + LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libresolv.a) ++LIBRESOLV?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libresolv.a ++.else + LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/librpcsvc.a) ++LIBRPCSVC?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/librpcsvc.a ++.else + LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libskey.a) ++LIBSKEY?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libskey.a ++.else + LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libtermcap.a) ++LIBTERMCAP?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libtermcap.a ++.else + LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libtelnet.a) ++LIBTELNET?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libtelnet.a ++.else + LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libutil.a) ++LIBUTIL?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libutil.a ++.else + LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libwrap.a) ++LIBWRAP?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libwrap.a ++.else + LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/liby.a) ++LIBY?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/liby.a ++.else + LIBY?= ${DESTDIR}/usr/lib/liby.a ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libz.a) ++LIBZ?= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/libz.a ++.else + LIBZ?= ${DESTDIR}/usr/lib/libz.a ++.endif + + .if defined(SHAREDSTRINGS) + CLEANFILES+=strings +--- a/mk/bsd.lib.mk ++++ b/mk/bsd.lib.mk +@@ -115,9 +115,17 @@ APICFLAGS?= -k + .if ${OBJECT_FMT} == "ELF" + SHLIB_SOVERSION=${SHLIB_MAJOR} + SHLIB_SHFLAGS=-soname lib${LIB}.so.${SHLIB_SOVERSION} ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtbeginS.o) ++SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtbeginS.o ++.else + SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o ++.endif ++.if exists(${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtendS.o) ++SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/${MACHINE_MULTIARCH}/crtendS.o ++.else + SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o + .endif ++.endif + + CFLAGS+= ${COPTS} + +--- a/mk/bsd.own.mk ++++ b/mk/bsd.own.mk +@@ -42,7 +42,7 @@ INFOGRP?= root + INFOOWN?= root + INFOMODE?= ${NONBINMODE} + +-LIBDIR?= /usr/lib ++LIBDIR?= /usr/lib/${MACHINE_MULTIARCH} + LINTLIBDIR?= /usr/libdata/lint + LIBGRP?= ${BINGRP} + LIBOWN?= ${BINOWN} diff --git a/debian/patches/series b/debian/patches/series index 6b5bf49..a172015 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ 110_mkdep.diff 120_fixes.diff 130_maxpathlen.diff +140_multiarch.diff diff --git a/debian/rules b/debian/rules index 45c6a6e..1829be3 100755 --- a/debian/rules +++ b/debian/rules @@ -2,9 +2,11 @@ #export DH_VERBOSE=1 -ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH) +ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH) +MULTIARCH=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH) CFLAGS="-O2 -g -Wall -D__COPYRIGHT\(x\)= -D__RCSID\(x\)= \ -I. -DMACHINE=\\\"debian\\\" -DMACHINE_ARCH=\\\"${ARCH}\\\" \ + -DMACHINE_MULTIARCH=\\\"${MULTIARCH}\\\" \ -DHAVE_SETENV -DHAVE_STRERROR -DHAVE_STRDUP -DHAVE_STRFTIME \ -DHAVE_VSNPRINTF \ -D_GNU_SOURCE -Wno-unused"