xref: /freebsd/release/scripts/make-pkg-package.sh (revision d4033e6d37747f5213bb245c8e605406703a8766)
1#!/bin/sh
2
3# Simulate the build environment.  Note that we need to unset some variables
4# which are set in the src tree since they have different (unwanted) effects
5# in the ports tree.
6SRC_PKG_VERSION=${PKG_VERSION}
7PKG_ABI=$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)
8unset PKG_VERSION
9unset MAKEFLAGS
10unset PKGBASE
11# Ports interprets CROSS_TOOLCHAIN differently from src, and having this set
12# breaks the package-pkg build.  For now, forcibly unset this and hope ports
13# can find a working compiler.
14if [ -n "$CROSS_TOOLCHAIN" ]; then
15	printf >&2 '%s: WARNING: CROSS_TOOLCHAIN will be ignored for the pkg build.\n' "$0"
16	unset CROSS_TOOLCHAIN
17fi
18export WRKDIRPREFIX=/tmp/ports.${TARGET}
19export DISTDIR=/tmp/distfiles
20export WRKDIR=$(make -C ${PORTSDIR}/ports-mgmt/pkg I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=YES -V WRKDIR)
21
22make -C ${PORTSDIR}/ports-mgmt/pkg TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
23	CONFIGURE_ARGS="--host=$(uname -m)-portbld-freebsd${REVISION} --prefix=${LOCALBASE}" \
24	I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=YES \
25	BATCH=YES stage create-manifest
26
27${PKG_CMD} -o ABI=${PKG_ABI} \
28	create -v -m ${WRKDIR}/.metadir.pkg/ \
29	-r ${WRKDIR}/stage \
30	-p ${WRKDIR}/.PLIST.mktmp \
31	-o ${REPODIR}/${PKG_ABI}/${SRC_PKG_VERSION}
32