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