FreeBSD/build: Files specific for building on FreeBSD

- README.FreeBSD for the description of the current work thusfar
 - do_freebsd.sh, the srcipt to run autobuild/compile/tests
 - autogen_freebsd.sh set the options to use in the auto/configure tools
 - do_freebsd.sh: Install bash and softlink, so other bash scripts can
   run as is. Using /usr/bin/env would be more compliant.
   But not for now. This makes it compatible with the std-linux environment
 - So now we can even have Clang in /usr/bin and /usr/local/bin
   and still get the right one.
 - Use less error suppression, but start fixing warning.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
This commit is contained in:
Willem Jan Withagen 2016-03-24 12:47:34 +01:00
parent b89d793afc
commit 89f63d4ae8
3 changed files with 141 additions and 0 deletions

59
README.FreeBSD Normal file
View File

@ -0,0 +1,59 @@
The FreeBSD build will build most of the tools in Ceph.
Note that the RBD dependant items will not work since FreeBSD does not have RBS
Build Prerequisites
===================
Compiling and building Ceph is tested on 11-CURRENT
It uses the CLANG toolset that is available, which needs to be atleast 3.7
Clang 3.4 (on 10.2-STABLE) does not have all required capabilites to compile everything
The following setup will get things running for FreeBSD:
- Install bash and link it in /bin
# requires root privileges
sudo pkg install bash
sudo ln -s /usr/local/bin/bash /bin/bash
Building Ceph
=============
- Go and start building
./do_freebsd.sh
Parts not (yet) included:
=========================
- RBD kernel client
Rados Block Devices is implemented in the Linux kernel
It seems that there used to be a userspace implementation first.
And perhaps ggated could be used as a template since it does some of the
same, other than just between 2 disks. And it has a userspace counterpart.
* @trociny suggests:
Userspace RBD is available under FreeBSD (both librbd and rbd tool
(without linux specific commands) are buildable).
- BlueStore.
FreeBSD and Linux have different AIO API, and that needs to be made compatible
Next to that is there discussion in FreeBSD about aio_cancel not working for all
devicetypes
- CephFS
Cython tries to access an internal field in dirent which does not compile
Tests that verify the correct working of the above are also excluded from the testset
Test not (yet) include:
=======================
- ceph-detect-init/run-tox.sh
Because the current implementation does not know anything about FreeBSD rc-init.
- Tests that make use on nosestests.
Calling these doest not really work since nostests is not in /usr/bin, and calling
thru /usr/bin/env/nosetests does not work on FreeBSD.
test/pybind/test_ceph_argparse.py
test/pybind/test_ceph_daemon.py
Things to investigate:
======================
- ceph-{osd,mon} need 2 signals before they actually terminate.

63
autogen_freebsd.sh Normal file
View File

@ -0,0 +1,63 @@
# Set the FreeBSD specific configure flags
FREEBSD_CONFIGURE_FLAGS=
if [ x`uname`x = x"FreeBSD"x ]; then
MAKE=gmake
# We need at least something > clang 3.4
# tested with package clang37 on FreeBSD 10.2 ( Which has 3.4 as default )
if clang -v 2>&1 | grep -q "3.8" ; then
CC=clang
CXX=clang++
elif [ -f /usr/local/bin/clang37 ]; then
CC=clang37
CXX=clang++37
else
echo "Need a better compiler"
exit 1
fi
CWARN=""
CLANGWARN="-Wno-unused-function -Wno-unused-local-typedef -Wno-inconsistent-missing-override"
CLANGWARN="$CLANGWARN -Wno-unused-private-field"
CLANGWARN="$CLANGWARN -Wno-varargs"
CLANGWARN="$CLANGWARN -Wno-gnu-designator"
# "-Wno-unused-local-typedef -Wno-mismatched-tags -Wno-macro-redefined -Wno-unused-function -Wno-unused-label -Wno-undefined-bool-conversion -Wno-unused-private-field -Wno-unused-local-typedef -Wno-uninitialized -Wno-gnu-designator -Wno-inconsistent-missing-override -Wno-deprecated-declarations -Wno-parentheses"
CFLAGS="-g -I/usr/local/include ${CWARN} ${CLANGWARN}"
CXXFLAGS="-g -DGTEST_USE_OWN_TR1_TUPLE=1 -I/usr/local/include ${CWARN} ${CLANGWARN}"
LDFLAGS="-g ${LDFLAGS} -L/usr/local/lib -export-dynamic -luuid"
FREEBSD_CONFIGURE_FLAGS="
--disable-silent-rules
--disable-gitversion
--with-debug
--with-rados
--without-rbd
--with-radosgw
--with-radosstriper
--with-mon
--with-osd
--with-mds
--with-radosgw
--with-nss
--without-tcmalloc
--without-libaio
--without-libxfs
--without-fuse
--without-lttng
--with-libzfs=no
--without-rocksdb
--without-cephfs
"
# --without-radosgw
# --with-gnu-ld
fi
CONFIGURE_FLAGS="${FREEBSD_CONFIGURE_FLAGS}"
# Export these so that ./configure will pick up
export MAKE
export CC
export CXX
export CFLAGS
export CXXFLAGS
export CONFIGURE_FLAGS
export LDFLAGS

19
do_freebsd.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh -xve
NPROC=`sysctl -n hw.ncpu`
if [ x"$1"x = x"--deps"x ]; then
# we need bash first otherwise almost nothing will work
sudo pkg install bash
if [ ! -L /bin/bash ]; then
echo linking /bin/bash to /usr/local/bin/bash
ln -s /usr/local/bin/bash /bin/bash
fi
sudo ./install-deps.sh
fi
. ./autogen_freebsd.sh
./autogen.sh
./configure ${CONFIGURE_FLAGS}
( cd src/gmock/gtest; patch < /usr/ports/devel/googletest/files/patch-bsd-defines )
gmake -j$NPROC ENABLE_GIT_VERSION=OFF
gmake -j$NPROC check ENABLE_GIT_VERSION=OFF CEPH_BUFFER_NO_BENCH=yes