Skip to content

Commit

Permalink
Implement multi-architecture support.
Browse files Browse the repository at this point in the history
This commit adds a number of new features to pkgsrc to enable
multi-architecture packages:

  - pkgtools/abiexec is a new package which integrates the isaexec
    wrapper from Solaris.  Multi-architecture binaries are hardlinks
    to this file, which then determines the architecture-dependent
    binary to run, with 32-bit being the default.

  - pkg_install grows "@link" support to allow abiexec hardlinks to
    be created at pkg_add time.

  - mk grows a MULTIARCH variable, set by --multiarch in bootstrap,
    which determines whether or not to build multiarch packages.

  - Each phase target will run twice (once for each architecture)
    when MULTIARCH is enabled, and the final package will combine the
    output of each build.

As for package support:

  - Packages opt-in to multi-architecture support by setting
    USE_MULTIARCH=yes, but this is only activated based on MULTIARCH.

  - BINARCHSUFFIX and LIBARCHSUFFIX will expand to directory suffixes
    for the current ABI, and will normally be used where there are
    hardcoded 'bin' or 'lib' paths.

  - When MULTIARCH is enabled, pkgsrc will build each package twice
    (once for each architecture), and then combine the two into a
    single package.

This is currently only supported on SunOS, but it is generic enough
that support can easily be added for other platforms.
  • Loading branch information
Jonathan Perkin committed Jan 2, 2019
1 parent d52a914 commit 247561d
Show file tree
Hide file tree
Showing 40 changed files with 697 additions and 46 deletions.
5 changes: 5 additions & 0 deletions bootstrap/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ usage="Usage: $0 "'
[ --help ]
[ --make-jobs <num> ]
[ --mk-fragment <mk.conf> ]
[ --multiarch ]
[ --pkgdbdir <pkgdbdir> ]
[ --pkginfodir <pkginfodir> ]
[ --pkgmandir <pkgmandir> ]
Expand Down Expand Up @@ -435,6 +436,7 @@ while [ $# -gt 0 ]; do
--abi) abi="$2"; shift ;;
--cwrappers=*) cwrappers=`get_optarg "$1"` ;;
--cwrappers) cwrappers="$2"; shift ;;
--multiarch) multiarch=yes ;;
--unprivileged | --ignore-user-check) unprivileged=yes ;;
--prefer-pkgsrc=*)
prefer_pkgsrc=`get_optarg "$1"` ;;
Expand Down Expand Up @@ -1064,6 +1066,9 @@ fi
if [ -n "$abi" ]; then
echo "ABI= $abi" >> ${TARGET_MKCONF}
fi
if [ -n "$multiarch" ]; then
echo "MULTIARCH= $multiarch" >> ${TARGET_MKCONF}
fi
if [ "$compiler" != "" ]; then
echo "PKGSRC_COMPILER= $compiler" >> ${TARGET_MKCONF}
fi
Expand Down
4 changes: 4 additions & 0 deletions mk/bsd.makevars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ _REV_ALL_PHASES= package stage-install build configure wrapper \
# file.
#
.for _phase_ in ${_REV_ALL_PHASES}
. if !empty(MULTIARCH:M[Yy][Ee][Ss])
_MAKEVARS_MK.${_phase_}= ${WRKDIR}/.${_phase_}_makevars-${ABI}.mk
. else
_MAKEVARS_MK.${_phase_}= ${WRKDIR}/.${_phase_}_makevars.mk
. endif
. if !target(${_phase_}-vars)
${_phase_}-vars: ${_MAKEVARS_MK.${_phase_}}
. endif
Expand Down
24 changes: 22 additions & 2 deletions mk/bsd.pkg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ WRKSRC?= ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//}
WRKSRC?= ${WRKDIR}/${DISTNAME:U${PKGNAME_NOREV}}
.endif

# Multi-architecture support
.if !empty(MULTIARCH:M[Yy][Ee][Ss]) && defined(USE_MULTIARCH)
_MULTIARCH= YES
BINARCHSUFFIX= ${BINARCHSUFFIX.${ABI}}
INCARCHSUFFIX= ${INCARCHSUFFIX.${ABI}}
LIBARCHSUFFIX= ${LIBARCHSUFFIX.${ABI}}
. if ${OPSYS} == "SunOS" && !empty(USE_MULTIARCH:Mbin)
DEPENDS+= abiexec-[0-9]*:../../pkgtools/abiexec
. endif
MULTIARCH_DIRS.bin?= bin sbin
MULTIARCH_DIRS.lib?= lib
.endif

# Override for SU_CMD user check
_IS_ROOT_CMD?= ${TEST} `${ID} -u` = `${ID} -u ${_SU_ROOT_USER}`
_SU_ROOT_USER?= ${ROOT_USER}
Expand Down Expand Up @@ -160,6 +173,7 @@ CPPFLAGS+= ${CPP_PRECOMP_FLAGS}
# to dependence builds.
PKGSRC_SETENV?= ${SETENV}

ALL_ENV+= BINARCHSUFFIX=${BINARCHSUFFIX:Q}
ALL_ENV+= CC=${CC:Q}
ALL_ENV+= CFLAGS=${CFLAGS:M*:Q}
ALL_ENV+= CPPFLAGS=${CPPFLAGS:M*:Q}
Expand All @@ -178,6 +192,7 @@ ALL_ENV+= LC_MONETARY=C
ALL_ENV+= LC_NUMERIC=C
ALL_ENV+= LC_TIME=C
ALL_ENV+= LDFLAGS=${LDFLAGS:M*:Q}
ALL_ENV+= LIBARCHSUFFIX=${LIBARCHSUFFIX:Q}
ALL_ENV+= LINKER_RPATH_FLAG=${LINKER_RPATH_FLAG:Q}
ALL_ENV+= PATH=${PATH:Q}:${LOCALBASE}/bin:${X11BASE}/bin
ALL_ENV+= PREFIX=${PREFIX}
Expand All @@ -192,9 +207,9 @@ BSD_MAKE_ENV+= MANOWN=${MANOWN} MANGRP=${MANGRP}
BSD_MAKE_ENV+= SHAREOWN=${SHAREOWN} SHAREGRP=${SHAREGRP}
BSD_MAKE_ENV+= DOCOWN=${DOCOWN} DOCGRP=${DOCGRP}
BSD_MAKE_ENV+= BINMODE=${BINMODE} NONBINMODE=${NONBINMODE}
BSD_MAKE_ENV+= BINDIR=${PREFIX}/bin
BSD_MAKE_ENV+= BINDIR=${PREFIX}/bin${BINARCHSUFFIX}
BSD_MAKE_ENV+= INCSDIR=${PREFIX}/include
BSD_MAKE_ENV+= LIBDIR=${PREFIX}/lib
BSD_MAKE_ENV+= LIBDIR=${PREFIX}/lib${LIBARCHSUFFIX}
BSD_MAKE_ENV+= MANDIR=${PREFIX}/${PKGMANDIR}
BSD_MAKE_ENV+= STRIPFLAG=${_STRIPFLAG_INSTALL:Q}
BSD_MAKE_ENV+= MANINSTALL=${MANINSTALL:Q}
Expand Down Expand Up @@ -240,6 +255,11 @@ SHCOMMENT?= ${ECHO_MSG} >/dev/null '***'

LIBABISUFFIX?=

# Multi-architecture builds
BINARCHSUFFIX?=
INCARCHSUFFIX?=
LIBARCHSUFFIX?=

TOUCH_FLAGS?= -f

# A few aliases for *-install targets
Expand Down
4 changes: 2 additions & 2 deletions mk/bsd.pkg.use.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ BUILD_DEFS+= KERBEROS
PKG_FAIL_REASON+= "Cross-compiling Fortran with libtool NYI."
. endif

PKG_LIBTOOL?= ${LOCALBASE}/bin/libtool-fortran
PKG_LIBTOOL?= ${LOCALBASE}/bin${BINARCHSUFFIX}/libtool-fortran
PKG_SHLIBTOOL?= ${LOCALBASE}/bin/shlibtool-fortran

. if defined(USE_LIBTOOL)
Expand All @@ -89,7 +89,7 @@ BUILD_DEPENDS+= libtool-fortran>=${_OPSYS_LIBTOOL_REQD:U${LIBTOOL_REQD}}:../../
PKG_LIBTOOL?= ${CROSSBASE}/bin/libtool
PKG_SHLIBTOOL?= ${CROSSBASE}/bin/shlibtool
. else
PKG_LIBTOOL?= ${LOCALBASE}/bin/libtool
PKG_LIBTOOL?= ${LOCALBASE}/bin${BINARCHSUFFIX}/libtool
PKG_SHLIBTOOL?= ${LOCALBASE}/bin/shlibtool
. endif
.endif
Expand Down
5 changes: 5 additions & 0 deletions mk/bsd.prefs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ LOWER_VENDOR?= hp
LOWER_VENDOR?= sun
LOWER_OPSYS?= solaris
LOWER_OPSYS_VERSUFFIX= 2.${OS_VERSION:C/5.//}
# XXX: Required for multiarch, there's no good workaround. Building bmake as
# multiarch causes circular dependencies due to abiexec.
MACHINE_ARCH.32= i386
MACHINE_ARCH.64= x86_64
MACHINE_ARCH= ${MACHINE_ARCH.${ABI}}
_UNAME_V!= ${UNAME} -v
. if !empty(_UNAME_V:Mjoyent_*)
OS_VARIANT= SmartOS
Expand Down
20 changes: 20 additions & 0 deletions mk/build/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,21 @@ build-clean: install-clean _package-clean
###
_REAL_BUILD_TARGETS+= build-check-interactive
_REAL_BUILD_TARGETS+= build-message
.if defined(_MULTIARCH)
_REAL_BUILD_TARGETS+= build-vars-multi
.else
_REAL_BUILD_TARGETS+= build-vars
.endif
_REAL_BUILD_TARGETS+= pre-build-checks-hook
.if defined(_MULTIARCH)
_REAL_BUILD_TARGETS+= pre-build-multi
_REAL_BUILD_TARGETS+= do-build-multi
_REAL_BUILD_TARGETS+= post-build-multi
.else
_REAL_BUILD_TARGETS+= pre-build
_REAL_BUILD_TARGETS+= do-build
_REAL_BUILD_TARGETS+= post-build
.endif
_REAL_BUILD_TARGETS+= build-cookie
_REAL_BUILD_TARGETS+= error-check

Expand Down Expand Up @@ -182,6 +192,16 @@ post-build:
@${DO_NADA}
.endif

.if defined(_MULTIARCH)
. for _tgt_ in build-vars pre-build do-build post-build
.PHONY: ${_tgt_}-multi
${_tgt_}-multi:
. for _abi_ in ${MULTIARCH_ABIS}
@${MAKE} ${MAKE_FLAGS} ABI=${_abi_} WRKSRC=${WRKSRC}-${_abi_} ${_tgt_}
. endfor
. endfor
.endif

# build-env:
# Starts an interactive shell in WRKSRC.
#
Expand Down
10 changes: 5 additions & 5 deletions mk/buildlink3/bsd.buildlink3.mk
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ BUILDLINK_LDFLAGS.${_pkg_}?= # empty
BUILDLINK_LIBS.${_pkg_}?= # empty
BUILDLINK_AUTO_DIRS.${_pkg_}?= yes
BUILDLINK_INCDIRS.${_pkg_}?= include
BUILDLINK_LIBDIRS.${_pkg_}?= lib
BUILDLINK_LIBDIRS.${_pkg_}?= lib${LIBARCHSUFFIX}
. if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
BUILDLINK_RPATHDIRS.${_pkg_}?= ${BUILDLINK_LIBDIRS.${_pkg_}}
. else
Expand Down Expand Up @@ -502,8 +502,8 @@ BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${_dir_}
#
# Ensure that ${LOCALBASE}/lib is in the runtime library search path.
#
.if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${LOCALBASE}/lib)
BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${LOCALBASE}/lib
.if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${LOCALBASE}/lib${LIBARCHSUFFIX})
BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${LOCALBASE}/lib${LIBARCHSUFFIX}
.endif
#
# Add the X11 library directory to the library search paths if the package
Expand Down Expand Up @@ -842,7 +842,7 @@ _BLNK_PASSTHRU_RPATHDIRS+= ${BUILDLINK_PREFIX.${_pkg_}}/${_dir_}
# that wildcard dependencies work correctly when installing from binary
# packages.
#
_BLNK_PASSTHRU_RPATHDIRS+= ${LOCALBASE}/lib
_BLNK_PASSTHRU_RPATHDIRS+= ${LOCALBASE}/lib${LIBARCHSUFFIX}
#
# Allow ${X11BASE}/lib in the runtime library search path for USE_X11
# packages so that X11 libraries can be found.
Expand Down Expand Up @@ -1115,7 +1115,7 @@ _WRAP_TRANSFORM.SHLIBTOOL= ${_WRAP_TRANSFORM.LIBTOOL}
# before the system headers and libraries.
#
_BLNK_CPPFLAGS= -I${BUILDLINK_DIR}/include
_BLNK_LDFLAGS= -L${BUILDLINK_DIR}/lib
_BLNK_LDFLAGS= -L${BUILDLINK_DIR}/lib${LIBARCHSUFFIX}
_WRAP_EXTRA_ARGS.CC+= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
_WRAP_EXTRA_ARGS.CXX+= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
_WRAP_EXTRA_ARGS.CPP+= ${_BLNK_CPPFLAGS}
Expand Down
9 changes: 8 additions & 1 deletion mk/check/check-files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ CHECK_FILES_SKIP+= ${PREFIX}/.*/dir
# Perl's perllocal.pod index that is regenerated when a local module
# is added.
#
CHECK_FILES_SKIP+= ${PERL5_INSTALLARCHLIB}/perllocal.pod
# XXX: multiarch
CHECK_FILES_SKIP+= ${PREFIX}/.*/perllocal.pod

# R's index files that are regenerated when a local module
# is added.
Expand Down Expand Up @@ -103,7 +104,13 @@ CHECK_FILES_SKIP+= ${PREFIX}/share/icons/.*/icon-theme.cache
.endif

# Mutable charset.alias file
.if defined(_MULTIARCH)
. for _abi_ in ${MULTIARCH_ABIS}
CHECK_FILES_SKIP+= ${PREFIX}/lib${LIBARCHSUFFIX.${_abi_}}/charset.alias
. endfor
.else
CHECK_FILES_SKIP+= ${PREFIX}/lib/charset.alias
.endif

# Mutable locale.alias file
CHECK_FILES_SKIP+= ${PREFIX}/share/locale/locale.alias
Expand Down
5 changes: 5 additions & 0 deletions mk/check/check-interpreter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ _check-interpreter: error-check .PHONY
fi; \
continue;; \
esac; \
case "$$interp" in \
*${PREFIX}/*bin${BINARCHSUFFIX}/*) isainterp="$$interp" ;; \
*) isainterp=`${ECHO} "$$interp" | ${SED} -e "s;${PREFIX}/\(s*\)bin/;${PREFIX}/\1bin${BINARCHSUFFIX}/;"` ;; \
esac; \
if { [ ! -f ${DESTDIR:Q}"$$interp" ] && \
[ ! -f ${DESTDIR:Q}"$$isainterp" ] && \
[ ! -f "$$interp" ]; }; then \
${DELAYED_ERROR_MSG} "[check-interpreter.mk] The interpreter \"$$interp\" of \"${DESTDIR}${PREFIX}/$$file\" does not exist."; \
fi; \
Expand Down
6 changes: 6 additions & 0 deletions mk/compiler/gcc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,12 @@ _USE_GCC_SHLIB?= yes
_USE_GCC_SHLIB= yes
.endif

# When using multiarch we cannot rely on MACHINE_GNU_PLATFORM as it differs
# # between ABIs, so provide a common directory for the runtime libraries.
.if !empty(MULTIARCH:M[Yy][Ee][Ss])
GCC_TARGET_MACHINE= runtime
.endif

.if !empty(USE_NATIVE_GCC:M[yY][eE][sS]) && !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
_USE_PKGSRC_GCC= no
.elif !empty(USE_PKGSRC_GCC:M[yY][eE][sS])
Expand Down
9 changes: 9 additions & 0 deletions mk/configure/cmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ CMAKE_ARGS+= -DCMAKE_SKIP_RPATH:BOOL=FALSE
CMAKE_ARGS+= -DCMAKE_INSTALL_NAME_DIR:PATH=${PREFIX}/lib
.endif
.if defined(CMAKE_USE_GNU_INSTALL_DIRS) && empty(CMAKE_USE_GNU_INSTALL_DIRS:M[nN][oO])
. if defined(_MULTIARCH) && !empty(USE_MULTIARCH:Mbin)
CMAKE_ARGS+= -DCMAKE_INSTALL_BINDIR:PATH=bin${BINARCHSUFFIX}
CMAKE_ARGS+= -DCMAKE_INSTALL_SBINDIR:PATH=sbin${BINARCHSUFFIX}
. endif
. if defined(_MULTIARCH) && !empty(USE_MULTIARCH:Mlib) && !defined(NO_MULTIARCH_LIBDIR)
CMAKE_ARGS+= -DLIB_SUFFIX=${LIBARCHSUFFIX}
CMAKE_ARGS+= -DCMAKE_INSTALL_LIBDIR:PATH=lib${LIBARCHSUFFIX}
. else
CMAKE_ARGS+= -DCMAKE_INSTALL_LIBDIR:PATH=lib
. endif
CMAKE_ARGS+= -DCMAKE_INSTALL_MANDIR:PATH=${PKGMANDIR}
. if defined(INFO_FILES)
CMAKE_ARGS+= -DCMAKE_INSTALL_INFODIR:PATH=${PKGINFODIR}
Expand Down
27 changes: 27 additions & 0 deletions mk/configure/configure.mk
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,23 @@ ${_COOKIE.configure}: real-configure
#
_REAL_CONFIGURE_TARGETS+= configure-check-interactive
_REAL_CONFIGURE_TARGETS+= configure-message
.if defined(_MULTIARCH)
_REAL_CONFIGURE_TARGETS+= configure-vars-multi
_REAL_CONFIGURE_TARGETS+= pre-configure-multi
_REAL_CONFIGURE_TARGETS+= do-configure-pre-hook-multi
_REAL_CONFIGURE_TARGETS+= pre-configure-checks-hook-multi
_REAL_CONFIGURE_TARGETS+= do-configure-multi
_REAL_CONFIGURE_TARGETS+= do-configure-post-hook-multi
_REAL_CONFIGURE_TARGETS+= post-configure-multi
.else
_REAL_CONFIGURE_TARGETS+= configure-vars
_REAL_CONFIGURE_TARGETS+= pre-configure
_REAL_CONFIGURE_TARGETS+= do-configure-pre-hook
_REAL_CONFIGURE_TARGETS+= pre-configure-checks-hook
_REAL_CONFIGURE_TARGETS+= do-configure
_REAL_CONFIGURE_TARGETS+= do-configure-post-hook
_REAL_CONFIGURE_TARGETS+= post-configure
.endif
_REAL_CONFIGURE_TARGETS+= _configure-cookie
_REAL_CONFIGURE_TARGETS+= error-check

Expand Down Expand Up @@ -275,6 +285,23 @@ post-configure:
@${DO_NADA}
.endif

.if defined(_MULTIARCH)
_MULTIARCH_TARGETS+= configure-vars
_MULTIARCH_TARGETS+= pre-configure
_MULTIARCH_TARGETS+= do-configure-pre-hook
_MULTIARCH_TARGETS+= pre-configure-checks-hook
_MULTIARCH_TARGETS+= do-configure
_MULTIARCH_TARGETS+= do-configure-post-hook
_MULTIARCH_TARGETS+= post-configure
. for tgt in ${_MULTIARCH_TARGETS}
.PHONY: ${tgt}-multi
${tgt}-multi:
. for _abi_ in ${MULTIARCH_ABIS}
@${MAKE} ${MAKE_FLAGS} ABI=${_abi_} WRKSRC=${WRKSRC}-${_abi_} ${tgt}
. endfor
. endfor
.endif

# configure-help:
# Runs ${CONFIGURE_SCRIPT} --help. It is mainly intended for
# package developers so they can quickly see the options of the
Expand Down
16 changes: 15 additions & 1 deletion mk/configure/gnu-configure.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,34 @@ CONFIGURE_ARGS+= --prefix=${GNU_CONFIGURE_PREFIX:Q}

.if (defined(SET_LIBDIR) && !empty(SET_LIBDIR)) || \
(defined(GNU_CONFIGURE_LIBDIR) && !empty(GNU_CONFIGURE_LIBDIR)) || \
(defined(GNU_CONFIGURE_LIBSUBDIR) && !empty(GNU_CONFIGURE_LIBSUBDIR))
(defined(GNU_CONFIGURE_LIBSUBDIR) && !empty(GNU_CONFIGURE_LIBSUBDIR)) || \
(defined(_MULTIARCH) && !empty(USE_MULTIARCH:Mlib) && !defined(NO_MULTIARCH_LIBDIR))
CONFIGURE_HAS_LIBDIR= yes
.else
CONFIGURE_HAS_LIBDIR?= no
.endif
.if defined(GNU_CONFIGURE_LIBSUBDIR) && !empty(GNU_CONFIGURE_LIBSUBDIR)
. if defined(_MULTIARCH) && !empty(USE_MULTIARCH:Mlib) && !defined(NO_MULTIARCH_LIBDIR)
GNU_CONFIGURE_LIBDIR?= ${GNU_CONFIGURE_PREFIX}/lib${LIBARCHSUFFIX}/${GNU_CONFIGURE_LIBSUBDIR}
. else
GNU_CONFIGURE_LIBDIR?= ${GNU_CONFIGURE_PREFIX}/lib/${GNU_CONFIGURE_LIBSUBDIR}
. endif
.else
. if defined(_MULTIARCH) && !empty(USE_MULTIARCH:Mlib) && !defined(NO_MULTIARCH_LIBDIR)
GNU_CONFIGURE_LIBDIR?= ${GNU_CONFIGURE_PREFIX}/lib${LIBARCHSUFFIX}
. else
GNU_CONFIGURE_LIBDIR?= ${GNU_CONFIGURE_PREFIX}/lib
. endif
.endif
.if !empty(CONFIGURE_HAS_LIBDIR:M[Yy][Ee][Ss])
CONFIGURE_ARGS+= --libdir=${GNU_CONFIGURE_LIBDIR}
.endif

.if defined(_MULTIARCH) && !empty(USE_MULTIARCH:Mbin)
CONFIGURE_ARGS+= --bindir=${GNU_CONFIGURE_PREFIX}/bin${BINARCHSUFFIX}
CONFIGURE_ARGS+= --sbindir=${GNU_CONFIGURE_PREFIX}/sbin${BINARCHSUFFIX}
.endif

USE_GNU_CONFIGURE_HOST?= yes
.if !empty(USE_GNU_CONFIGURE_HOST:M[yY][eE][sS])
. if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
Expand Down
16 changes: 15 additions & 1 deletion mk/cwrappers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BUILD_DEPENDS+= cwrappers>=20150314:../../pkgtools/cwrappers

# XXX This should be PREFIX, but USE_CROSSBASE overrides it.
CWRAPPERS_SRC_DIR= ${LOCALBASE}/libexec/cwrappers
CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config
CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config${LIBARCHSUFFIX}
CONFIGURE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
MAKE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
ALL_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
Expand Down Expand Up @@ -123,7 +123,11 @@ ${_COOKIE.wrapper}: real-wrapper
.endif

.PHONY: real-wrapper
.if defined(_MULTIARCH)
real-wrapper: wrapper-message wrapper-dirs-multi wrapper-vars-multi pre-wrapper do-wrapper-multi post-wrapper wrapper-cookie error-check
.else
real-wrapper: wrapper-message wrapper-dirs wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check
.endif

.PHONY: wrapper-message
wrapper-message:
Expand All @@ -142,6 +146,16 @@ do-wrapper:
@${DO_NADA}
.endif

.if defined(_MULTIARCH)
. for _tgt_ in wrapper-dirs wrapper-vars do-wrapper
.PHONY: ${_tgt_}-multi
${_tgt_}-multi:
. for _abi_ in ${MULTIARCH_ABIS}
@${MAKE} ${MAKE_FLAGS} ABI=${_abi_} WRKSRC=${WRKSRC}-${_abi_} ${_tgt_}
. endfor
. endfor
.endif

.if !target(pre-wrapper)
pre-wrapper:
@${DO_NADA}
Expand Down

0 comments on commit 247561d

Please sign in to comment.