Initial import of ninja, a simple build system with a focus on speed.

ok dcoppa, sthen
This commit is contained in:
matthew 2013-05-02 19:09:18 +00:00
parent 21cb354a14
commit c54c7d5276
5 changed files with 112 additions and 0 deletions

37
devel/ninja/Makefile Normal file
View File

@ -0,0 +1,37 @@
# $OpenBSD: Makefile,v 1.1.1.1 2013/05/02 19:09:18 matthew Exp $
COMMENT = a small build system with a focus on speed
V = 1.2.0
DISTNAME = ninja-${V}
CATEGORIES = devel
HOMEPAGE = http://martine.github.io/ninja/
MAINTAINER = Matthew Dempsky <matthew@dempsky.org>
# Apache License v2.0
PERMIT_PACKAGE_CDROM = Yes
# c>=68.1 needed for ppoll
WANTLIB = c>=68.1 m stdc++
MASTER_SITES = https://github.com/martine/ninja/archive/v${V}.tar.gz?bleh=/
MODULES = lang/python
MODPY_ADJ_FILES = bootstrap.py \
configure.py \
src/browse.py
# Not strictly required, but will be used if available. Included as a build
# dependency to ensure consistent builds.
BUILD_DEPENDS = devel/re2c
MAKE_ENV = CXX="${CXX}"
do-build:
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
${MODPY_BIN} ./bootstrap.py --verbose
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/ninja ${PREFIX}/bin
.include <bsd.port.mk>

2
devel/ninja/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (ninja-1.2.0.tar.gz) = gToeZQ9Q7W6X01O7zjMTSNOet/2tT7pT5Kmb59qTnnI=
SIZE (ninja-1.2.0.tar.gz) = 136233

View File

@ -0,0 +1,70 @@
$OpenBSD: patch-src_subprocess-posix_cc,v 1.1.1.1 2013/05/02 19:09:18 matthew Exp $
--- src/subprocess-posix.cc.orig Fri Apr 5 09:36:12 2013
+++ src/subprocess-posix.cc Thu May 2 12:01:23 2013
@@ -25,13 +25,6 @@
#include <string.h>
#include <sys/wait.h>
-// Older versions of glibc (like 2.4) won't find this in <poll.h>. glibc
-// 2.4 keeps it in <asm-generic/poll.h>, though attempting to include that
-// will redefine the pollfd structure.
-#ifndef POLLRDHUP
-#define POLLRDHUP 0x2000
-#endif
-
#include "util.h"
Subprocess::Subprocess() : fd_(-1), pid_(-1) {
@@ -49,12 +42,12 @@ bool Subprocess::Start(SubprocessSet* set, const strin
if (pipe(output_pipe) < 0)
Fatal("pipe: %s", strerror(errno));
fd_ = output_pipe[0];
-#if !defined(linux)
- // On linux we use ppoll in DoWork(); elsewhere we use pselect and so must
- // avoid overly-large FDs.
+#if !defined(linux) && !defined(__OpenBSD__)
+ // On Linux and OpenBSD, we use ppoll in DoWork(); elsewhere we use pselect
+ // and so must avoid overly-large FDs.
if (fd_ >= static_cast<int>(FD_SETSIZE))
Fatal("pipe: %s", strerror(EMFILE));
-#endif // !linux
+#endif // !linux && !__OpenBSD__
SetCloseOnExec(fd_);
pid_ = fork();
@@ -189,7 +182,7 @@ Subprocess *SubprocessSet::Add(const string& command)
return subprocess;
}
-#ifdef linux
+#if defined(linux) || defined(__OpenBSD__)
bool SubprocessSet::DoWork() {
vector<pollfd> fds;
nfds_t nfds = 0;
@@ -199,7 +192,7 @@ bool SubprocessSet::DoWork() {
int fd = (*i)->fd_;
if (fd < 0)
continue;
- pollfd pfd = { fd, POLLIN | POLLPRI | POLLRDHUP, 0 };
+ pollfd pfd = { fd, POLLIN | POLLPRI, 0 };
fds.push_back(pfd);
++nfds;
}
@@ -236,7 +229,7 @@ bool SubprocessSet::DoWork() {
return false;
}
-#else // linux
+#else // linux || __OpenBSD__
bool SubprocessSet::DoWork() {
fd_set set;
int nfds = 0;
@@ -279,7 +272,7 @@ bool SubprocessSet::DoWork() {
return false;
}
-#endif // linux
+#endif // linux || __OpenBSD__
Subprocess* SubprocessSet::NextFinished() {
if (finished_.empty())

1
devel/ninja/pkg/DESCR Normal file
View File

@ -0,0 +1 @@
Ninja is a small build system with a focus on speed.

2
devel/ninja/pkg/PLIST Normal file
View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2013/05/02 19:09:18 matthew Exp $
@bin bin/ninja