aboutsummaryrefslogtreecommitdiffstats
path: root/java/bootstrap-openjdk8/Makefile.update
blob: 096b1f87c5b6c69d0acad48e156e1011199eb6a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# $FreeBSD$

JDK_ARCH?=  ${ARCH:C/armv.*/arm/}
JDK_PORT?=  openjdk8
JDK_ROOT?=  bootstrap-${JDK_PORT}

.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"

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}-${JDK_ARCH}-r${PORTREVISION}.tar.xz
DISTINFO_FILE=  ${.CURDIR}/distinfo.${JDK_ARCH}
MAKEFILE=   ${.CURDIR}/Makefile
PLIST?=     ${.CURDIR}/pkg-plist
PLIST_SUB=  JDK_ARCH="${JDK_ARCH}" JDK_ROOT="."

BUILD_ARGS= BATCH=yes PORT_DBDIR=/var/empty
BUILD_ENV=  __MAKE_CONF=/dev/null PATH="${PATH}"
BUILD_ENV+= java_openjdk8_UNSET="ALSA X11"
JDK_BUILD_ARGS= ${BUILD_ARGS}

.if !defined(TARGET_OS)
.if ${ARCH} == aarch64 || ${ARCH:Marmv*}
TARGET_OS=  11
.else
TARGET_OS=  10
.endif
.endif

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 "${JDK_PORTDIR}" ${JDK_BUILD_ARGS} stage
    @${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_${JDK_ARCH}=.*/DISTVERSION_${JDK_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 ${JDK_PORTDIR}/work'."
    @${ECHO} ""
    @${ECHO} "=============================================================="
    @${ECHO} ""