Support for building on OpenBSD.
Change-Id: I89022b5008ba00bd5457c5625f0a87e8393c3d23
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/4160
Reviewed-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Petr Hosek <phosek@google.com>
Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/build/build_openbsd.ninja.template b/build/build_openbsd.ninja.template
new file mode 100644
index 0000000..f22ccb3
--- /dev/null
+++ b/build/build_openbsd.ninja.template
@@ -0,0 +1,19 @@
+rule cc
+ command = $cc -MMD -MF $out.d $defines $includes $cflags $cflags_c -c $in -o $out
+ description = CC $out
+ depfile = $out.d
+ deps = gcc
+
+rule cxx
+ command = $cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc -c $in -o $out
+ description = CXX $out
+ depfile = $out.d
+ deps = gcc
+
+rule alink_thin
+ command = rm -f $out && $ar rcs $out $in
+ description = AR $out
+
+rule link
+ command = $ld $ldflags -o $out -Wl,--start-group $in $libs -Wl,--end-group $solibs
+ description = LINK $out
diff --git a/build/gen.py b/build/gen.py
index 3edefa7..d547a8f 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -41,10 +41,12 @@
self._platform = 'fuchsia'
elif self._platform.startswith('freebsd'):
self._platform = 'freebsd'
+ elif self._platform.startswith('openbsd'):
+ self._platform = 'openbsd'
@staticmethod
def known_platforms():
- return ['linux', 'darwin', 'msvc', 'aix', 'fuchsia']
+ return ['linux', 'darwin', 'msvc', 'aix', 'fuchsia', 'openbsd']
def platform(self):
return self._platform
@@ -68,7 +70,7 @@
return self._platform == 'aix'
def is_posix(self):
- return self._platform in ['linux', 'freebsd', 'darwin', 'aix']
+ return self._platform in ['linux', 'freebsd', 'darwin', 'aix', 'openbsd']
def main(argv):
@@ -173,6 +175,7 @@
'linux': 'build_linux.ninja.template',
'freebsd': 'build_linux.ninja.template',
'aix': 'build_aix.ninja.template',
+ 'openbsd': 'build_openbsd.ninja.template',
}[platform.platform()])
with open(template_filename) as f: