Boost logo

Boost :

From: Simon Barner (barner_at_[hidden])
Date: 2005-01-05 21:07:38


Hello Boosters,

I am maintaining the FreeBSD port of Boost, and I'd like to ask you to
review the changes I had to make in order to get things to work and
possibly to merge some of them into your CVS.

First some information about Boost on the FreeBSD platform...

There are two supported platforms:

 - FreeBSD 5.3, with gcc 3.4.2, wchar support
 - FreeBSD 4.10/11 with gcc 2.95.4, no wchar support,
   build with stlport 4.6.2 and spirit 1.6.2 to overcome compiler
   insufficiencies.

   Sprit 1.6.2 is obtained form http://spirit.sf.net, so I wounder if
   you guys can do anything about it, but it would be great to have
   tarball that uses UN*X encoded source files (i.e. without CRLF as
   line separator).

If you don't have a FreeBSD installation, you can find the port skeleton
(which is basically a set of patches and scripts needed to build a software
package) here:

http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/boost/

I will now present all of the patches I made (please don't beat me if I
did something ugly or something which might hurt a Boost developer's
feelings ;-)

The links above a particular patch enable you to download it from
FreeBSD's CVS.

After that I'll describe briefly the intention of that patch, which is
quoted below.

One of the intentions of this posting is to check whether I did my
changes at the right places, or if the are crude hacks (I suspect some
of my changes to the configuration files fall into this category).

A total of 8 patches follows, but don't be afraid, most of it is
FreeBSD specific, but I wonder if some patches could be merged into
Boost's CVS.

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/patch-boost%3a%3aconfig%3a%3aplatform%3absd.hpp?rev=1.1

This patch enables wchar support on FreeBSD 5 and disables it on older
versions.

Unfortunately, I can't remember, why BOOST_NO_INCLASS_MEMBER_INITIALIZATION
was necessary, but it won't hurt, will it?

--- boost/config/platform/bsd.hpp.orig Fri Feb 27 14:13:00 2004
+++ boost/config/platform/bsd.hpp Wed Dec 15 16:01:21 2004
@@ -39,9 +39,20 @@
 #endif
 
 //
-// No wide character support in the BSD header files:
+// Enable wide character support on FreeBSD 5 and above
 //
-#define BOOST_NO_CWCHAR
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 5)
+# undef BOOST_NO_CWCHAR
+# undef BOOST_NO_SWPRINTF
+# undef BOOST_NO_CWCTYPE
+# undef BOOST_DEDUCED_TYPENAME
+#else
+# define BOOST_NO_CWCHAR
+# define BOOST_NO_SWPRINTF
+# define BOOST_NO_CWCTYPE
+#endif
+
+#define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
 
 //
 // The BSD <ctype.h> has macros only, no functions:

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/patch-tools%3a%3abuild%3a%3av1%3a%3aallyourbase.jam?rev=1.2&content-type=text/plain

Starting with Boost v. 1.31.0, I intend to bump the shared library
version number with every boost release in order to prevent from
problems that are caused by ABI incompatiblities.

(This is a requirement of the FreeBSD Ports Collection).

--- tools/build/v1/allyourbase.jam.orig Wed Feb 18 14:04:28 2004
+++ tools/build/v1/allyourbase.jam Wed Feb 18 14:02:44 2004
@@ -457,7 +457,7 @@
 SPLITPATH ?= ":" ; # dwa -- added missing SPLITPATH
 STDHDRS ?= /usr/include ;
 SUFEXE ?= "" ;
-SUFDLL ?= .so ;
+SUFDLL ?= .so.2 ;
 SUFLIB ?= .a ;
 SUFOBJ ?= .o ;
 PREDLL ?= lib ;

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/patch-tools%3a%3abuild%3a%3av1%3a%3aboost-base.jam?rev=1.1&content-type=text/plain

Another requirement of the Ports Collection: Libraries are installed
into the same location regardless of built time options.

--- tools/build/v1/boost-base.jam.orig Wed Jan 28 23:52:25 2004
+++ tools/build/v1/boost-base.jam Wed Feb 18 14:06:58 2004
@@ -2621,11 +2621,6 @@
     local version-tag = [ MATCH "^([^.]+).([^.]+)" : $(version-number[1]) ] ;
     version-tag = $(version-tag:J="_") ;
     
- tags += $(toolset-tag:J=) ;
- tags += $(thread-tag:J=) ;
- tags += $(runtime-tag:J=) ;
- tags += $(version-tag) ;
-
     if $(tags)
     {
         return $(properties) <*><*><tag><prefix>-$(tags:J=-) ;

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/patch-tools%3a%3abuild%3a%3av1%3a%3agcc-stlport-tools.jam?rev=1.1&content-type=text/plain

Depending on the FreeBSD version, different compiler and linker options
are needed. These option are provided by two environment variables
PTHREAD_CFLAGS and PTHREAD_LIBS, but I found no other way of getting the
right values into Boost's config files than patching that will
placeholder values and using sed(1) to replace those dummies with the
actual ones.

--- tools/build/v1/gcc-stlport-tools.jam.orig Mon Dec 13 19:13:56 2004
+++ tools/build/v1/gcc-stlport-tools.jam Mon Dec 13 19:14:18 2004
@@ -40,7 +40,7 @@
         }
     case *BSD :
         {
- flags gcc LINKFLAGS <stlport-iostream>on : -pthread ;
+ flags gcc LINKFLAGS <stlport-iostream>on : %%PTHREAD_LIBS%% ;
         }
     case IRIX :
         {

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/patch-tools%3a%3abuild%3a%3av1%3a%3agcc-tools.jam?rev=1.1&content-type=text/plain

The first hunk of the patch is needed because ports in FreeBSD are
supposed to obey some global CFLAGS settings (whose optimiziation
settings would be overridden by -O0).

The second hunk is similar to the last patch.

--- tools/build/v1/gcc-tools.jam.orig Thu Jan 22 05:11:52 2004
+++ tools/build/v1/gcc-tools.jam Wed Feb 18 12:57:30 2004
@@ -61,7 +61,7 @@
 flags gcc LINKFLAGS <runtime-link>static : -static ;
 flags gcc CFLAGS <debug-symbols>on : -g ;
 flags gcc LINKFLAGS <debug-symbols>on : -g ;
-flags gcc CFLAGS <optimization>off : -O0 ;
+flags gcc CFLAGS <optimization>off : ;
 flags gcc CFLAGS <optimization>speed : -O3 ;
 
 # Other optimizations we might want for GCC
@@ -125,8 +125,8 @@
         }
     case *BSD :
         {
- flags gcc CFLAGS <threading>multi : -pthread ;
- flags gcc LINKFLAGS <threading>multi : -pthread ;
+ flags gcc CFLAGS <threading>multi : %%PTHREAD_CFLAGS%% ;
+ flags gcc LINKFLAGS <threading>multi : %%PTHREAD_LIBS%% ;
         # there is no -lrt on BSD
         }
     case IRIX :

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/FBSD4-patch-boost%3a%3aprogram_options%3a%3adetail%3a%3autf8_codecvt_facet.hpp?rev=1.1&content-type=text/plain

This patch is needed for FreeBSD 4 (gcc 2.95) only!

I am sure the first hunk could be solved more cleanly by some
configuration option, but where?

The second hunk is something I am really unsure about, and which I
suppose has something to do with FreeBSD's (or gcc 2.95's?) implementation
of std::codecvt. Is this necessary on other platforms?

--- boost/program_options/detail/utf8_codecvt_facet.hpp.orig Mon Dec 13 18:48:58 2004
+++ boost/program_options/detail/utf8_codecvt_facet.hpp Mon Dec 13 18:49:51 2004
@@ -67,7 +67,7 @@
 #elif defined(BOOST_NO_STDC_NAMESPACE)
     typedef std::mbstate_t mbstate_t;
     namespace std{
- using ::codecvt;
+ using std::codecvt;
     } // namespace std
 #endif
 
@@ -81,7 +81,7 @@
 {
 public:
     explicit utf8_codecvt_facet_wchar_t(std::size_t no_locale_manage=0)
- : std::codecvt<wchar_t, char, mbstate_t>(no_locale_manage)
+ : std::codecvt<wchar_t, char, mbstate_t>() // FIXME
     {}
 protected:
     virtual std::codecvt_base::result do_in(

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/FBSD4-patch-libs%3a%3aserialization%3a%3abuild%3a%3aJamfile?rev=1.1&content-type=text/plain

FreeBSD 4 only!

This disables the build of the wchar version of the serialization
library on this platform. I simply couldn't get it to work, AFAIK libc
is not ready for wide characters on this platform.

--- libs/serialization/build/Jamfile.orig Mon Dec 13 18:36:52 2004
+++ libs/serialization/build/Jamfile Mon Dec 13 18:37:28 2004
@@ -90,12 +90,10 @@
 
 install serialization lib :
     <lib>boost_serialization
- <lib>boost_wserialization
 ;
 
 stage stage/lib :
         <lib>boost_serialization
- <lib>boost_wserialization
     :
         <locate>$(BOOST_ROOT)
         common-stage-tag

http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/boost/files/FBSD5-patch-boost%3a%3apython%3a%3adetail%3a%3aconfig.hpp?rev=1.1&content-type=text/plain

FreeBSD 5 only!

This works around a bug in FreeBSD's gcc 3.4.2, which has been reported
to the maintainer of FreeBSD's system compiler.

--- boost/python/detail/config.hpp.orig Tue Dec 14 14:17:42 2004
+++ boost/python/detail/config.hpp Tue Dec 14 14:19:36 2004
@@ -110,7 +110,11 @@
 # define BOOST_PYTHON_OFFSETOF(s_name, s_member) \
         ((size_t)__INTADDR__(&(((s_name *)0)->s_member)))
 #else
-# define BOOST_PYTHON_OFFSETOF offsetof
+// workaround from http://www.freebsd.org/cgi/query-pr.cgi?pr=72307
+#define BOOST_PYTHON_OFFSETOF(TYPE, MEMBER)\
+ (__offsetof__ (reinterpret_cast <size_t>\
+ (&reinterpret_cast <const volatile char &>\
+ (static_cast<TYPE *> (0)->MEMBER))))
 #endif
 
 #endif // CONFIG_DWA052200_H_


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk