freebsd-ports/java/bootstrap-openjdk/Makefile.update
Tijl Coosemans 02f27a83b4 The output of tools like awk, date, sort, tr,... depends on the current
locale set by the user.  Add LANG=C and LC_ALL=C at the beginning of
bsd.port.mk and export them so all commands are executed with the C locale.
LC_ALL=C overrides all other LC_* variables.  LANG is used by setlocale(3)
as default value for LC_* variables, so normally it isn't used when LC_ALL
is set, but there's code out there that looks at LANG directly so it's safer
to set it as well.  The only commands not captured by this are !=
assignments before any inclusion of bsd.port.*mk.

Introduce USE_LOCALE=<locale> that adds LANG=<locale> and LC_ALL=<locale> to
CONFIGURE_ENV and MAKE_ENV so upstream build systems can be executed with a
different locale (e.g. USE_LOCALE=en_US.UTF-8).

PR:		215882
Exp-run by:	antoine
Approved by:	portmgr (antoine)
2017-01-18 13:20:31 +00:00

107 lines
3.3 KiB
Makefile

# $FreeBSD$
JDK_NAME?= openjdk
JDK_PORT?= openjdk6
JDK_ROOT?= bootstrap-${JDK_NAME}
TARGET_OS?= 8
.if !defined(PORTSDIR)
.if exists(${.CURDIR}/../${JDK_PORT}/Makefile)
PORTSDIR= ${.CURDIR}/../..
.else
PORTSDIR= /usr/ports
.endif
.endif
LOCALBASE?= /usr/local
.include "${PORTSDIR}/Mk/bsd.commands.mk"
FT2_PORTDIR!= ${REALPATH} ${PORTSDIR}/print/freetype2
FT2_IMAGEDIR?= ${FT2_PORTDIR}/work/stage/usr/local
JDK_PORTDIR!= ${REALPATH} ${PORTSDIR}/java/${JDK_PORT}
JDK_IMAGEDIR?= ${JDK_PORTDIR}/work/stage/usr/local/${JDK_PORT}
GET_REVISION= ${LOCALBASE}/bin/svnversion ${JDK_PORTDIR}
TAR?= /usr/bin/tar
.if !defined(ARCH)
ARCH!= ${UNAME} -p
.endif
BUILD_OS!= ${UNAME} -r | ${SED} -e 's/\..*//'
PORTREVISION!= ${GET_REVISION} 2>/dev/null || ${TRUE}
DISTDIR?= ${.CURDIR}
DISTFILE= ${JDK_PORT}-${ARCH}-r${PORTREVISION}.tar.xz
DISTINFO_FILE= ${.CURDIR}/distinfo.${ARCH}
MAKEFILE= ${.CURDIR}/Makefile
PLIST?= ${.CURDIR}/pkg-plist
PLIST_SUB= ARCH="${ARCH}" JDK_ROOT="."
BUILD_ARGS= BATCH=yes PORT_DBDIR=/var/empty
BUILD_ENV= __MAKE_CONF=/dev/null PATH="${PATH}"
FT2_BUILD_ARGS= ${BUILD_ARGS}
FT2_BUILD_ARGS+=CONFIGURE_ARGS="--without-bzip2 --without-png --without-zlib"
JDK_BUILD_ARGS= ${BUILD_ARGS}
JDK_BUILD_ARGS+=java_openjdk6_UNSET=ICEDTEA
JDK_BUILD_ARGS+=ALT_FREETYPE_HEADERS_PATH="${FT2_IMAGEDIR}/include"
JDK_BUILD_ARGS+=ALT_FREETYPE_LIB_PATH="${FT2_IMAGEDIR}/lib"
JDK_BUILD_ARGS+=SYSTEM_ZLIB=false ZLIB_LDFLAGS=""
.if ${ARCH} == "i386"
PLIST_SUB+= CLIENTVM=""
.else
PLIST_SUB+= CLIENTVM="@comment "
.endif
PLIST_SUB+= LIBSTDCXX=""
all:
@${ECHO} ""
@${ECHO} "=============================================================="
@${ECHO} ""
.if ${BUILD_OS} > ${TARGET_OS}
@${ECHO} "We need FreeBSD ${TARGET_OS} but you seem to have ${BUILD_OS}."
@${ECHO} ""
@${ECHO} "=============================================================="
@${ECHO} ""
@${FALSE}
.endif
@${ECHO} "Building ${DISTFILE}...."
@${ECHO} ""
@${ECHO} "Started at "`date -u`"."
@${ECHO} ""
@${ECHO} "=============================================================="
@${ECHO} ""
.if !defined(NO_BUILD)
@${SETENV} -i ${BUILD_ENV} \
${MAKE} -C "${FT2_PORTDIR}" ${FT2_BUILD_ARGS} stage
@${SETENV} -i ${BUILD_ENV} \
${MAKE} -C "${JDK_PORTDIR}" ${JDK_BUILD_ARGS} stage
@${CP} -p /usr/lib/libstdc++.so.6 "${JDK_IMAGEDIR}/jre/lib/${ARCH}"
@${CP} -p "${FT2_IMAGEDIR}/lib/libfreetype.so.6" \
"${JDK_IMAGEDIR}/jre/lib/${ARCH}"
@${FIND} "${JDK_IMAGEDIR}" -type f \
-exec ${STRIP_CMD} -s {} \; 2> /dev/null
.endif
@cd "${JDK_IMAGEDIR}" && \
${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${PLIST} | \
${GREP} -v ^@ | ${TAR} -c -f - -T - -s '|^\./|${JDK_ROOT}/|' | \
${XZ_CMD} -9 -c > "${DISTDIR}/${DISTFILE}"
@${SED} -i.bak \
's/^DISTVERSION_${ARCH}=.*/DISTVERSION_${ARCH}= r${PORTREVISION}/' \
"${MAKEFILE}"
@${MAKE} -f "${MAKEFILE}" makesum DISTDIR="${DISTDIR}" \
DISTINFO_FILE="${DISTINFO_FILE}"
@${ECHO} ""
@${ECHO} "=============================================================="
@${ECHO} ""
@${ECHO} "${DISTFILE} was built successfully!"
@${ECHO} ""
@${ECHO} "Finished at "`date -u`"."
@${ECHO} ""
@${ECHO} "You may clean up the build directory if everything looks okay,"
@${ECHO} "e.g., 'rm -fr ${FT2_PORTDIR}/work ${JDK_PORTDIR}/work'."
@${ECHO} ""
@${ECHO} "=============================================================="
@${ECHO} ""