Merge pull request #627 from dankm/freebsd

FreeBSD build support
This commit is contained in:
Alexey Neyman 2017-03-07 08:50:43 -08:00 committed by GitHub
commit ea7f559ef4
23 changed files with 50 additions and 225 deletions

View File

@ -81,6 +81,7 @@ export LIBS := @LIBS@
export INTL_LIBS := @INTL_LIBS@
export curses_hdr := @ac_ct_curses_hdr@
export gettext := @gettext@
export CPU_COUNT := @CPU_COUNT@
# config options to push down to kconfig
KCONFIG:= @kconfig_options@
@ -192,6 +193,7 @@ define sed_it
-e 's,@@CT_awk@@,$(awk),g;' \
-e 's,@@CT_wget@@,$(wget),g;' \
-e 's,@@CT_curl@@,$(curl),g;' \
-e 's,@@CT_cpucount@@,$(CPU_COUNT),g;' \
$< >$@
endef

View File

@ -248,6 +248,15 @@ ACX_SET_KCONFIG_OPTION([stat_flavor_BSD])
test "$acx_cv_stat_flavor" = "GNU" && stat_flavor_GNU=y
ACX_SET_KCONFIG_OPTION([stat_flavor_GNU])
#Find out how to count CPUs
AC_CACHE_CHECK([whether to use getconf or sysctl to count CPUs],
[acx_cv_cpu_count],
[getconf _NPROCESSORS_ONLN >/dev/null 2>&1 && \
acx_cv_cpu_count="getconf _NPROCESSORS_ONLN"
sysctl -n hw.ncpu >/dev/null 2>&1 && \
acx_cv_cpu_count="sysctl -n hw.ncpu"])
AC_SUBST(CPU_COUNT, "$acx_cv_cpu_count")
#--------------------------------------------------------------------
# Still boring, but remember the path, now...
#--------------------------------------------------------------------

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -1,13 +0,0 @@
--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
+++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
@@ -51,6 +51,10 @@
#include "rpc_scan.h"
#include "proto.h"
+#if defined(__CYGWIN__)
+#define stat64 stat
+#endif
+
#include "../version.h"
#define PACKAGE _libc_intl_domainname

View File

@ -88,7 +88,10 @@ do_gmp_backend() {
extra_config+=("--enable-mpbsd")
fi
# FIXME: GMP's configure script doesn't respect the host parameter
# when not cross-compiling, ie when build == host.
CT_DoExecLog CFG \
CC="${host}-gcc" \
CFLAGS="${cflags} -fexceptions" \
LDFLAGS="${ldflags}" \
${CONFIG_SHELL} \

View File

@ -17,6 +17,9 @@ do_finish() {
*darwin*)
strip_args=""
;;
*freebsd*)
strip_args="--strip-all"
;;
*)
strip_args="--strip-all -v"
;;

View File

@ -103,24 +103,28 @@ do_kernel_headers() {
esac
CT_DoLog EXTRA "Installing kernel headers"
CT_DoExecLog ALL \
make -C "${kernel_path}" \
CROSS_COMPILE="${CT_TARGET}-" \
O="${CT_BUILD_DIR}/build-kernel-headers" \
ARCH=${kernel_arch} \
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
${V_OPT} \
CT_DoExecLog ALL \
make -C "${kernel_path}" \
BASH="$(which bash)" \
HOSTCC="${CT_BUILD}-gcc" \
CROSS_COMPILE="${CT_TARGET}-" \
O="${CT_BUILD_DIR}/build-kernel-headers" \
ARCH=${kernel_arch} \
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
${V_OPT} \
headers_install
if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
CT_DoLog EXTRA "Checking installed headers"
CT_DoExecLog ALL \
make -C "${kernel_path}" \
CROSS_COMPILE="${CT_TARGET}-" \
O="${CT_BUILD_DIR}/build-kernel-headers" \
ARCH=${kernel_arch} \
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
${V_OPT} \
CT_DoExecLog ALL \
make -C "${kernel_path}" \
BASH="$(which bash)" \
HOSTCC="${CT_BUILD}-gcc" \
CROSS_COMPILE="${CT_TARGET}-" \
O="${CT_BUILD_DIR}/build-kernel-headers" \
ARCH=${kernel_arch} \
INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
${V_OPT} \
headers_check
fi

View File

@ -247,6 +247,10 @@ do_libc_backend_once() {
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
touch config.cache
# Hide host C++ binary from configure
echo "ac_cv_prog_ac_ct_CXX=${CT_TARGET}-g++" >>config.cache
if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then
echo "libc_cv_forced_unwind=yes" >>config.cache
echo "libc_cv_c_cleanup=yes" >>config.cache
@ -346,13 +350,21 @@ do_libc_backend_once() {
build_ldflags="${CT_LDFLAGS_FOR_BUILD}"
case "$CT_BUILD" in
*mingw*|*cygwin*|*msys*|*darwin*)
*mingw*|*cygwin*|*msys*|*darwin*|*freebsd*)
# When installing headers on Cygwin, Darwin, MSYS2 and MinGW-w64 sunrpc needs
# gettext for building cross-rpcgen.
build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/"
build_ldflags="${build_ldflags} -lintl -liconv"
case "$CT_BUILD" in
*cygwin*|*freebsd*)
# Additionally, stat in FreeBSD, Cygwin, and possibly others
# is always 64bit, so replace struct stat64 with stat.
build_cppflags="${build_cppflags} -Dstat64=stat"
;;
esac
;;
esac
extra_make_args+=( "BUILD_CFLAGS=${build_cflags}" )
extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" )
extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" )

View File

@ -227,7 +227,7 @@ CT_SYS_REVISION=$(uname -r)
CT_SYS_OS=$(uname -s)
CT_SYS_MACHINE=$(uname -m)
CT_SYS_PROCESSOR=$(uname -p)
CT_SYS_GCC=$(gcc -dumpversion)
CT_SYS_GCC=$(${CT_BUILD_PREFIX}gcc${CT_BUILD_SUFFIX} -dumpversion)
CT_SYS_TARGET=$(CT_DoConfigGuess)
CT_TOOLCHAIN_ID="crosstool-${CT_VERSION} build ${CT_STAR_DATE_HUMAN} by ${CT_SYS_USER}@${CT_SYS_HOSTNAME}"
@ -536,7 +536,7 @@ if [ -z "${CT_RESTART}" ]; then
fi
# Use the number of processors+1 when automatically setting the number of
# parallel jobs. Fall back to 1 if the host doesn't use GLIBC.
AUTO_JOBS=$((`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 0` + 1))
AUTO_JOBS=$((`@@CT_cpucount@@ 2>/dev/null || echo 0` + 1))
[ ${CT_PARALLEL_JOBS} -eq 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${AUTO_JOBS}"
[ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}"
JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}"