View | Details | Raw Unified | Return to bug 219838 | Differences between
and this patch

Collapse All | Expand All

(-)b/Makefile (-1 / +12 lines)
Lines 7-13 CATEGORIES= devel java Link Here
7
MASTER_SITES=		https://storage.googleapis.com/bazel/${PORTVERSION}/rc${FINALRC}/
7
MASTER_SITES=		https://storage.googleapis.com/bazel/${PORTVERSION}/rc${FINALRC}/
8
DISTNAME=		bazel-${PORTVERSION}rc${FINALRC}-dist
8
DISTNAME=		bazel-${PORTVERSION}rc${FINALRC}-dist
9
9
10
MAINTAINER=		aehlig@linta.de
10
MAINTAINER?=		aehlig@linta.de
11
COMMENT=		Fast and correct build system
11
COMMENT=		Fast and correct build system
12
12
13
LICENSE=		APACHE20
13
LICENSE=		APACHE20
Lines 32-37 JAVA_VERSION= 1.8 Link Here
32
JAVA_BUILD=		yes
32
JAVA_BUILD=		yes
33
JAVA_RUN=		yes
33
JAVA_RUN=		yes
34
34
35
CONFLICTS_INSTALL?=	bazel-clang38
36
37
OPTIONS_DEFINE=	CLANG38
38
CLANG38_DESC=	Use clang38 as default crosstool
39
CLANG38_BUILD_DEPENDS=	clang38:devel/llvm38
40
CLANG38_RUN_DEPENDS=	clang38:devel/llvm38
41
35
# Have the location of the system-wide rc file reside ${ETCDIR}.
42
# Have the location of the system-wide rc file reside ${ETCDIR}.
36
# Also adapt the sample file to disable persistent java workers as they
43
# Also adapt the sample file to disable persistent java workers as they
37
# do not work reliably on FreeBSD.
44
# do not work reliably on FreeBSD.
Lines 41-46 post-patch: Link Here
41
	${WRKSRC}/src/main/cpp/blaze_util_posix.cc
48
	${WRKSRC}/src/main/cpp/blaze_util_posix.cc
42
	@${ECHO_CMD} build --strategy=Javac=standalone >> ${WRKSRC}/scripts/packages/debian/bazel.bazelrc
49
	@${ECHO_CMD} build --strategy=Javac=standalone >> ${WRKSRC}/scripts/packages/debian/bazel.bazelrc
43
50
51
post-patch-CLANG38-on:
52
	@${REINPLACE_CMD} -e 's=/usr/lib/clang=${LOCALBASE}/llvm38/lib/clang=' \
53
	-e 's=/usr/bin/clang=${LOCALBASE}/bin/clang38=' ${WRKSRC}/tools/cpp/CROSSTOOL
54
44
do-build:
55
do-build:
45
	@${MKDIR} ${WRKDIR}/bazel_tmp
56
	@${MKDIR} ${WRKDIR}/bazel_tmp
46
	(if [ -z "$${SOURCE_DATE_EPOCH}" ] ; \
57
	(if [ -z "$${SOURCE_DATE_EPOCH}" ] ; \
(-)b/files/patch-src_main_cpp_blaze__util__freebsd.cc (+35 lines)
Added Link Here
1
--- src/main/cpp/blaze_util_freebsd.cc.orig	2017-06-25 06:51:02 UTC
2
+++ src/main/cpp/blaze_util_freebsd.cc
3
@@ -73,16 +73,23 @@ void WarnFilesystemType(const string &ou
4
 
5
 string GetSelfPath() {
6
   char buffer[PATH_MAX] = {};
7
-  ssize_t bytes = readlink("/proc/curproc/file", buffer, sizeof(buffer));
8
-  if (bytes == sizeof(buffer)) {
9
-    // symlink contents truncated
10
-    bytes = -1;
11
-    errno = ENAMETOOLONG;
12
-  }
13
-  if (bytes == -1) {
14
-    pdie(blaze_exit_code::INTERNAL_ERROR, "error reading /proc/curproc/file");
15
+  auto pid = getpid();
16
+  if (kill(pid, 0) < 0) return "";
17
+  auto procstat = procstat_open_sysctl();
18
+  unsigned int n;
19
+  auto p = procstat_getprocs(procstat, KERN_PROC_PID, pid, &n);
20
+  if (p) {
21
+    if (n != 1) {
22
+      pdie(blaze_exit_code::INTERNAL_ERROR,
23
+           "expected exactly one process from procstat_getprocs, got %d", n);
24
+    }
25
+    auto r = procstat_getpathname(procstat, p, buffer,PATH_MAX);
26
+    if (r != 0) {
27
+      pdie(blaze_exit_code::INTERNAL_ERROR, "error procstat_getpathname");
28
+    }
29
+    procstat_freeprocs(procstat, p);
30
   }
31
-  buffer[bytes] = '\0';  // readlink does not NUL-terminate
32
+  procstat_close(procstat);
33
   return string(buffer);
34
 }
35
 

Return to bug 219838