Ninja is yet another build system. It takes as input the interdependencies

of files (typically source code and output executables) and orchestrates
building them, quickly.

Ninja joins a sea of other build systems. Its distinguishing goal is to be
fast. It is born from my work on the Chromium browser project, which has
over 30,000 source files and whose other build systems (including one built
from custom non-recursive Makefiles) can take ten seconds to start building
after changing one file. Ninja is under a second.

WWW: https://github.com/martine/ninja

PR:		ports/154603
Submitted by:	Grzegorz Blach <magik at roorback.net>
This commit is contained in:
Martin Wilke 2011-02-13 11:10:59 +00:00
parent f3581f6772
commit a9f2381d2a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=269057
6 changed files with 100 additions and 0 deletions

View file

@ -1052,6 +1052,7 @@
SUBDIR += newt
SUBDIR += ngpt
SUBDIR += nini
SUBDIR += ninja
SUBDIR += noweb
SUBDIR += nspr
SUBDIR += oaf

42
devel/ninja/Makefile Normal file
View file

@ -0,0 +1,42 @@
# New ports collection makefile for: ninja
# Date created: 08 February 2011
# Whom: Grzegorz Blach <magik@roorback.net>
#
# $FreeBSD$
#
PORTNAME= ninja
PORTVERSION= 20110208
CATEGORIES= devel
MASTER_SITES= http://files.roorback.net/src/
MAINTAINER= magik@roorback.net
COMMENT= Ninja is a small build system closest in spirit to Make
LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo
LICENSE= ASL
CONFLICTS= irc/ninja-[0-9]*
PLIST_FILES= bin/ninja
PORTDOCS= COPYING HACKING README manual.asciidoc todo
post-patch:
@${REINPLACE_CMD} \
-e 's|/bin/bash|/bin/sh|' \
-e 's|conf_cflags = -O2|conf_cflags = ${CXXFLAGS} -I${LOCALBASE}/include|' \
-e 's|conf_ldflags = -s|conf_ldflags = -s -L${LOCALBASE}/lib -lexecinfo|' \
-e 's|g++|g++ -I${LOCALBASE}/include -L${LOCALBASE}/lib -lexecinfo|' \
${WRKSRC}/bootstrap.sh
do-build:
@(cd ${WRKSRC}; ./bootstrap.sh)
do-install:
@${INSTALL} -m 755 ${WRKSRC}/ninja ${PREFIX}/bin
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
@(cd ${WRKSRC}; ${INSTALL} -m 644 ${PORTDOCS} ${DOCSDIR})
.endif
.include <bsd.port.mk>

2
devel/ninja/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (ninja-20110208.tar.gz) = 0b4ce3a9b9755479b7e34e7da6a7dfbf6e49df0a38e0553bda1e2565cbba8b99
SIZE (ninja-20110208.tar.gz) = 46644

View file

@ -0,0 +1,11 @@
--- build.ninja.orig 2011-02-10 19:29:29.000000000 +0100
+++ build.ninja 2011-02-10 19:29:33.000000000 +0100
@@ -24,7 +24,7 @@
description = CC $out
rule ar
- command = ar crsT $out $in
+ command = ar crs $out $in
description = AR $out
rule link

View file

@ -0,0 +1,33 @@
--- src/ninja.orig 2011-02-10 17:21:11.000000000 +0200
+++ src/ninja.cc 2011-02-10 17:21:43.000000000 +0200
@@ -20,6 +20,9 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#endif
#include <sys/types.h>
#include "build.h"
@@ -64,6 +67,7 @@ void usage(const BuildConfig& config) {
int GuessParallelism() {
int processors = 0;
+#if defined(linux)
const char kProcessorPrefix[] = "processor\t";
char buf[16 << 10];
FILE* f = fopen("/proc/cpuinfo", "r");
@@ -74,6 +78,12 @@ int GuessParallelism() {
++processors;
}
fclose(f);
+#elif defined(__APPLE__) || defined(__FreeBSD__)
+ size_t procSize = sizeof(processors);
+ int name[] = {CTL_HW, HW_NCPU};
+ if (sysctl(name, sizeof(name) / sizeof(int), &processors, &procSize, NULL, 0))
+ return 2;
+#endif
switch (processors) {
case 0:

11
devel/ninja/pkg-descr Normal file
View file

@ -0,0 +1,11 @@
Ninja is yet another build system. It takes as input the interdependencies
of files (typically source code and output executables) and orchestrates
building them, quickly.
Ninja joins a sea of other build systems. Its distinguishing goal is to be
fast. It is born from my work on the Chromium browser project, which has
over 30,000 source files and whose other build systems (including one built
from custom non-recursive Makefiles) can take ten seconds to start building
after changing one file. Ninja is under a second.
WWW: https://github.com/martine/ninja