From 78ac6aee6dff1b608bc312fe7ada442ba83710e8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 18 Jun 2020 14:51:38 +0200 Subject: Complete NetBSD compatibility --- libbuild2/bin/guess.cxx | 5 +++++ libbuild2/bin/init.cxx | 2 +- libbuild2/cc/guess.cxx | 5 ++++- libbuild2/cc/guess.hxx | 1 + libbuild2/cc/pkgconfig.cxx | 3 ++- libbuild2/scheduler.cxx | 4 ++-- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libbuild2/bin/guess.cxx b/libbuild2/bin/guess.cxx index e103c43..21936d9 100644 --- a/libbuild2/bin/guess.cxx +++ b/libbuild2/bin/guess.cxx @@ -123,6 +123,11 @@ namespace build2 // version (maybe we could run llvm-ar instead -- it seems to be always // around). // + // On NetBSD we get: + // + // GNU ar (NetBSD Binutils nb1) 2.31.1 + // GNU ranlib (NetBSD Binutils nb1) 2.31.1 + // { auto f = [&ar] (string& l, bool) -> guess_result { diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx index de8b12a..0d2d9b5 100644 --- a/libbuild2/bin/init.cxx +++ b/libbuild2/bin/init.cxx @@ -327,7 +327,7 @@ namespace build2 target_triplet t (s); l5 ([&]{trace << "canonical target: '" << t.string () << "'; " - << "class: " << t.class_ << " source: " << s;}); + << "class: " << t.class_;}); assert (!hint || s == t.string ()); diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index 109dfa3..a2a6397 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -261,6 +261,8 @@ namespace build2 " stdlib:=\"glibc\" /* pretend to be it. */ \n" "# elif defined(__FreeBSD__) \n" " stdlib:=\"freebsd\" \n" +"# elif defined(__NetBSD__) \n" +" stdlib:=\"netbsd\" \n" "# elif defined(__APPLE__) \n" " stdlib:=\"apple\" \n" "# else \n" @@ -2429,7 +2431,8 @@ namespace build2 } else if (tt.system == "win32-msvc") rt = "msvc"; else if (tt.system == "linux-gnu" || - tt.system == "freebsd") rt = "libgcc"; + tt.system == "freebsd" || + tt.system == "netbsd") rt = "libgcc"; else /* Mac OS, etc. */ rt = "compiler-rt"; } diff --git a/libbuild2/cc/guess.hxx b/libbuild2/cc/guess.hxx index b9c1386..3c58bec 100644 --- a/libbuild2/cc/guess.hxx +++ b/libbuild2/cc/guess.hxx @@ -203,6 +203,7 @@ namespace build2 // glibc // msvc (msvcrt.lib/msvcrNNN.dll) // freebsd + // netbsd // apple // newlib (also used by Cygwin) // klibc diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx index bcab64e..7fd07dc 100644 --- a/libbuild2/cc/pkgconfig.cxx +++ b/libbuild2/cc/pkgconfig.cxx @@ -531,7 +531,8 @@ namespace build2 } else if (tsys == "freebsd") { - // On FreeBSD .pc files go to libdata/pkgconfig/, not lib/pkgconfig/. + // On FreeBSD (but not NetBSD) .pc files go to libdata/pkgconfig/, not + // lib/pkgconfig/. // (((pd = d) /= "..") /= "libdata") /= "pkgconfig"; diff --git a/libbuild2/scheduler.cxx b/libbuild2/scheduler.cxx index bf2fde8..82bc4cc 100644 --- a/libbuild2/scheduler.cxx +++ b/libbuild2/scheduler.cxx @@ -6,7 +6,7 @@ #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) # include # ifdef __FreeBSD__ -# include // pthread_attr_get_np() +# include // pthread_attr_get_np() (in on NetBSD) # endif #endif @@ -605,7 +605,7 @@ namespace build2 // at the linking stage (see build2/buildfile). Thus neither *_STACK_SIZE // nor --max-stack have any effect here. // - // On Linux, FreeBSD and MacOS there is no way to change it once and for + // On Linux, *BSD and MacOS there is no way to change it once and for // all newly created threads. Thus we will use pthreads, creating threads // with the stack size of the current thread. This way all threads will // inherit the main thread's stack size (since the first helper is always -- cgit v1.1