1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00
freebsd-ports/devel/bazel/Makefile
Piotr Kubaj 8abf3fd744 devel/bazel: fix build on powerpc*
bazel uses a bundled abseil. To build on powerpc*, abseil requires a trivial
patch.

In file included from external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:27:
/usr/include/sys/sysctl.h:1185:25: error: unknown type name 'u_int'
int     sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
                            ^
external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:91:10: error: unknown type name 'once_flag'
  static once_flag init_timebase_frequency_once;
         ^
external/com_google_absl/absl/base/internal/unscaledcycleclock.cc:93:18: error: no member named 'LowLevelCallOnce' in namespace 'absl::lts_2020_02_25::base_internal'
  base_internal::LowLevelCallOnce(&init_timebase_frequency_once, [&]() {
  ~~~~~~~~~~~~~~~^

PR:	259056
Approved by:	ehlig@linta.de (maintainer)
2021-10-12 18:37:02 +00:00

95 lines
3.2 KiB
Makefile

# Created by: Klaus Aehlig <aehlig@linta.de>
PORTNAME= bazel
DISTVERSION= 4.2.1
CATEGORIES= devel java
MASTER_SITES= https://storage.googleapis.com/bazel/${PORTVERSION}/rc${FINALRC}/
DISTNAME= bazel-${PORTVERSION}rc${FINALRC}-dist
MAINTAINER= aehlig@linta.de
COMMENT= Fast and correct build system
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN_aarch64= fails to build: java.lang.OutOfMemoryError: Java heap space
BROKEN_armv6= fails to package: cp: bazel: No such file or directory
BROKEN_armv7= fails to package: cp: bazel: No such file or directory
BROKEN_FreeBSD_12_powerpc64= fails to compile: Action failed to execute: java.io.IOException: Cannot run program /usr/bin/clang
BUILD_DEPENDS= bash:shells/bash \
zip:archivers/zip
USES= cpe python:3.3+ shebangfix zip:infozip
SHEBANG_REGEX= .*(sh|txt|_stub|stub_.*|bazel|get_workspace_status|protobuf_support|_so)
CPE_VENDOR= google
USE_JAVA= yes
JAVA_VERSION= 1.8
JAVA_VENDOR= openjdk
JAVA_BUILD= yes
JAVA_RUN= yes
CONFLICTS_INSTALL= bazel029
# The bazel binary is also a zip archive (extracted by the elf part), it must not be stripped
STRIP=
NO_WRKSUBDIR= YES
# In bazel, a release is always code-wise identical to the final release candidate.
# Hence we can also download that one and so have a simple way to also test earlier release
# candidates.
FINALRC= 2
.include <bsd.port.pre.mk>
.if ${ARCH} == "i386"
EXTRA_PATCHES+= ${FILESDIR}/extra-i386_tools_cpp_BUILD.static.bsd
.endif
pre-patch:
@${CP} ${FILESDIR}/extra-patch-absl_base_internal_unscaledcycleclock.cc \
${FILESDIR}/extra-patch-bazel_grpc__deps.bzl \
${WRKSRC}/third_party/grpc/
# Have the location of the system-wide rc file reside ${ETCDIR}.
# Also adapt the sample file to disable persistent java workers as they
# do not work reliably on FreeBSD.
post-patch:
@${REINPLACE_CMD} \
-e "s|/etc/bazel.bazelrc|${ETCDIR}/bazel.bazelrc|" \
${WRKSRC}/src/main/cpp/BUILD
@${ECHO_CMD} build --strategy=Javac=standalone >> ${WRKSRC}/scripts/packages/bazel.bazelrc
@${ECHO_CMD} build --host_javabase=@local_jdk//:jdk >> ${WRKSRC}/scripts/packages/bazel.bazelrc
@${ECHO_CMD} build --action_env=PATH=/bin:/usr/bin/:${LOCALBASE}/bin >> ${WRKSRC}/scripts/packages/bazel.bazelrc
@${REINPLACE_CMD} \
-e 's|^\(PYTHON_BIN=.*\)|if [ "%VERSION%" = "3" ] ; then PYTHON_BIN=${PYTHON_CMD}; else \1 ; fi|' \
${WRKSRC}/tools/python/pywrapper_template.txt
@${REINPLACE_CMD} \
-e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|' \
${WRKSRC}/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
do-build:
@${MKDIR} ${WRKDIR}/bazel_tmp
(if [ -z "$${SOURCE_DATE_EPOCH}" ] ; \
then SOURCE_DATE_EPOCH=`grep TIMESTAMP ${DISTINFO_FILE} \
| ${SED} -e 's/[^0-9]//g'`; \
fi ; \
cd ${WRKSRC} && \
${SETENV} BAZEL_SH=${LOCALBASE}/bin/bash \
TMPDIR=${WRKDIR}/bazel_tmp \
EMBED_LABEL='${PORTVERSION}' \
PATH=${LOCALBASE}/bin:$$PATH \
SOURCE_DATE_EPOCH=$${SOURCE_DATE_EPOCH} \
EXTRA_BAZEL_ARGS=--host_javabase=@local_jdk//:jdk \
${LOCALBASE}/bin/bash ./compile.sh)
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/output/bazel ${STAGEDIR}${PREFIX}/bin
@${MKDIR} ${STAGEDIR}${ETCDIR}
${INSTALL_DATA} ${WRKSRC}/scripts/packages/bazel.bazelrc ${STAGEDIR}${ETCDIR}/bazel.bazelrc.sample
.include <bsd.port.post.mk>