# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # bazel_clang38 # bazel_clang38/pkg-descr # bazel_clang38/pkg-plist # bazel_clang38/Makefile # bazel_clang38/distinfo # bazel_clang38/files # bazel_clang38/files/patch-src_main_cpp_blaze__util__freebsd.cc # echo c - bazel_clang38 mkdir -p bazel_clang38 > /dev/null 2>&1 echo x - bazel_clang38/pkg-descr sed 's/^X//' >bazel_clang38/pkg-descr << '4ea835ab71afc38b213e83af999cd907' XBazel is Google's own build tool, now publicly available in Beta. XBazel has built-in support for building both client and server Xsoftware, including client applications for both Android and iOS Xplatforms. It also provides an extensible framework that you can Xuse to develop your own build rules.This port is a modified Xversion of devel/bazel with clang38 in ports as default c/c++ Xcompiler, now it is mainly used to build science/tensorflow. X XWWW: https://bazel.build/ 4ea835ab71afc38b213e83af999cd907 echo x - bazel_clang38/pkg-plist sed 's/^X//' >bazel_clang38/pkg-plist << 'ecca005bbbf864bba66298b104b950e6' Xbin/bazel X@sample %%ETCDIR%%/bazel.bazelrc.sample ecca005bbbf864bba66298b104b950e6 echo x - bazel_clang38/Makefile sed 's/^X//' >bazel_clang38/Makefile << '2ebc7a3c89b7b468e488c65d96f314ab' X# Created by: Jov X# $FreeBSD$ X XPORTNAME= bazel_clang38 XPORTVERSION= 0.5.0 XCATEGORIES= devel java XMASTER_SITES= https://storage.googleapis.com/bazel/${PORTVERSION}/rc${FINALRC}/ XDISTNAME= bazel-${PORTVERSION}rc${FINALRC}-dist X XMAINTAINER= amutu@amutu.com XCOMMENT= Fast and correct build system X XLICENSE= APACHE20 XLICENSE_FILE= ${WRKSRC}/LICENSE X XBUILD_DEPENDS= bash:shells/bash \ X zip:archivers/zip \ X clang38:devel/llvm38 XRUN_DEPENDS= clang38:devel/llvm38 X XBROKEN_armv6= fails to package: cp: bazel: No such file or directory X X# In bazel, a release is always code-wise identical to the final release candidate. X# Hence we can also download that one and so have a simple way to also test earlier release X# candidates. XFINALRC= 9 X XNO_WRKSUBDIR= YES XUSES= shebangfix zip XSHEBANG_REGEX= .*(sh|txt|_stub|stub_.*|bazel|get_workspace_status|protobuf_support|_so) XUSE_JAVA= yes XJAVA_VENDOR= openjdk XJAVA_VERSION= 1.8 XJAVA_BUILD= yes XJAVA_RUN= yes X X# Have the location of the system-wide rc file reside ${ETCDIR}. X# Also adapt the sample file to disable persistent java workers as they X# do not work reliably on FreeBSD. Xpost-patch: X @${REINPLACE_CMD} \ X -e "s|\"/etc/bazel.bazelrc\"|\"${ETCDIR}/bazel.bazelrc\"|" \ X ${WRKSRC}/src/main/cpp/blaze_util_posix.cc X @${ECHO_CMD} build --strategy=Javac=standalone >> ${WRKSRC}/scripts/packages/debian/bazel.bazelrc X Xdo-build: X @${MKDIR} ${WRKDIR}/bazel_tmp X (if [ -z "$${SOURCE_DATE_EPOCH}" ] ; \ X then SOURCE_DATE_EPOCH=`grep TIMESTAMP ${DISTINFO_FILE} \ X | ${SED} -e 's/[^0-9]//g'`; \ X fi ; \ X cd ${WRKSRC} && \ X ${SETENV} BAZEL_SH=${LOCALBASE}/bin/bash \ X TMPDIR=${WRKDIR}/bazel_tmp \ X EMBED_LABEL='${PORTVERSION}' \ X SOURCE_DATE_EPOCH=$${SOURCE_DATE_EPOCH} \ X ${LOCALBASE}/bin/bash ./compile.sh) X Xdo-install: X # The bazel binary is also a zip archive (extracted by the elf part), hence cannot be stripped X ${CP} ${WRKSRC}/output/bazel ${STAGEDIR}${PREFIX}/bin X @${MKDIR} ${STAGEDIR}${ETCDIR} X ${INSTALL_DATA} ${WRKSRC}/scripts/packages/debian/bazel.bazelrc ${STAGEDIR}${ETCDIR}/bazel.bazelrc.sample X X.include 2ebc7a3c89b7b468e488c65d96f314ab echo x - bazel_clang38/distinfo sed 's/^X//' >bazel_clang38/distinfo << 'e27e89a36f0d2b1ae339c63ef1e8578b' XTIMESTAMP = 1498373966 XSHA256 (bazel-0.5.0rc9-dist.zip) = b2b2f2e399cd341d91d27f3df0f9862ef0c4c51cc256fd2bda6ca93c0f00e27f XSIZE (bazel-0.5.0rc9-dist.zip) = 98166774 e27e89a36f0d2b1ae339c63ef1e8578b echo c - bazel_clang38/files mkdir -p bazel_clang38/files > /dev/null 2>&1 echo x - bazel_clang38/files/patch-src_main_cpp_blaze__util__freebsd.cc sed 's/^X//' >bazel_clang38/files/patch-src_main_cpp_blaze__util__freebsd.cc << '740a9550eb387c4e38356979d09dad84' X--- src/main/cpp/blaze_util_freebsd.cc.orig 2017-06-25 06:51:02 UTC X+++ src/main/cpp/blaze_util_freebsd.cc X@@ -73,16 +73,23 @@ void WarnFilesystemType(const string &ou X X string GetSelfPath() { X char buffer[PATH_MAX] = {}; X- ssize_t bytes = readlink("/proc/curproc/file", buffer, sizeof(buffer)); X- if (bytes == sizeof(buffer)) { X- // symlink contents truncated X- bytes = -1; X- errno = ENAMETOOLONG; X- } X- if (bytes == -1) { X- pdie(blaze_exit_code::INTERNAL_ERROR, "error reading /proc/curproc/file"); X+ auto pid = getpid(); X+ if (kill(pid, 0) < 0) return ""; X+ auto procstat = procstat_open_sysctl(); X+ unsigned int n; X+ auto p = procstat_getprocs(procstat, KERN_PROC_PID, pid, &n); X+ if (p) { X+ if (n != 1) { X+ pdie(blaze_exit_code::INTERNAL_ERROR, X+ "expected exactly one process from procstat_getprocs, got %d", n); X+ } X+ auto r = procstat_getpathname(procstat, p, buffer,PATH_MAX); X+ if (r != 0) { X+ pdie(blaze_exit_code::INTERNAL_ERROR, "error procstat_getpathname"); X+ } X+ procstat_freeprocs(procstat, p); X } X- buffer[bytes] = '\0'; // readlink does not NUL-terminate X+ procstat_close(procstat); X return string(buffer); X } X 740a9550eb387c4e38356979d09dad84 exit