CauldronDevelopmentLLC / cbang

C! (cbang) is a library for cross-platform C++ development.
GNU Lesser General Public License v2.1
57 stars 41 forks source link

Boost as shared #25

Closed srakitnican closed 1 year ago

srakitnican commented 7 years ago

I understand that it was complicated for you to check if boost is present on the system automatically so you've removed it 97e5ae8c416e7d0295b38ad13f6ab64977e2c78a, how about we toggle it with an already present switch disable_local. To build CAMotics without boost all I have to do is following:

From f8c261fe653a786152568d24fca0505d8f376da6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20Rakitni=C4=8Dan?= <samuel.rakitnican@gmail.com>
Date: Tue, 25 Jul 2017 23:42:47 +0200
Subject: [PATCH] Unbundle boost

---
 SConstruct               | 2 +-
 config/cbang/__init__.py | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/SConstruct b/SConstruct
index fcd9fa6..c465c71 100644
--- a/SConstruct
+++ b/SConstruct
@@ -51,7 +51,7 @@ if not env.GetOption('clean'):
     env.CBDefine('USING_CBANG') # Using CBANG macro namespace

 # Local includes
-env.Append(CPPPATH = ['#/include', '#/src', '#/src/boost'])
+env.Append(CPPPATH = ['#/include', '#/src'])

 # Build third-party libs
 force_local = env.get('force_local', '')
diff --git a/config/cbang/__init__.py b/config/cbang/__init__.py
index 932c77f..9b20840 100644
--- a/config/cbang/__init__.py
+++ b/config/cbang/__init__.py
@@ -31,6 +31,10 @@ def configure_deps(conf, local = True, with_openssl = True):

     # Boost
     if env['PLATFORM'] == 'win32': env.CBDefine('BOOST_ALL_NO_LIB')
+    for name in ['iostreams', 'system', 'filesystem', 'regex']:
+        libname = 'boost_' + name
+        if env['PLATFORM'] == 'win32': libname = 'lib' + libname
+        conf.CBRequireLib(libname)

     # clock_gettime() needed by boost iterprocess
     if env['PLATFORM'] == 'posix' and int(env.get('cross_osx', 0)) == 0 \
@@ -77,14 +81,12 @@ def configure(conf):
     env = conf.env

     home = GetHome() + '/../..'
-    env.AppendUnique(CPPPATH = [home + '/src', home + '/include',
-                                home + '/src/boost'])
+    env.AppendUnique(CPPPATH = [home + '/src', home + '/include'])
     env.AppendUnique(LIBPATH = [home + '/lib'])

     if not env.CBConfigEnabled('cbang-deps'):
         conf.CBConfig('cbang-deps', local = False)

-    conf.CBRequireLib('cbang-boost')
     conf.CBRequireLib('cbang')
     conf.CBRequireCXXHeader('cbang/Exception.h')
     env.CBDefine('HAVE_CBANG')
-- 
2.9.4

Now if we could somehow tie this up to disable_local in an elegant way, that would be awesome. What do you think about that?

srakitnican commented 7 years ago

Also, please note that I've removed boost_lib_suffix as I don't know a proper way of setting it, and it was not necessary in my case.

jcoffland commented 7 years ago

Why is this needed? Didn't Fedora accept the package as is?

FYI, I'm heading out on a backpacking trip tomorrow and will be out of communication until August 6th.

srakitnican commented 7 years ago

All separate project libraries should be shared when packaging for a distribution, where it is reasonable to do so. Boost is a common library, it is available and used by many other software already packaged. So it should be shared unless you have a good reason not to, for example library contains some modifications that are not upstreamed. Shared libraries share computer resources, they are easier to address security issues and software in general then uses less disk space.

srakitnican commented 7 years ago

Also, take a look at this: https://www.spinics.net/lists/fedora-devel/msg233948.html

Not sure how do you feel about flatpak, but it might be possible soon to build one from Fedora package.

jcoffland commented 7 years ago

Right, I understand the reasons for using system libs. However, boost is an exception. 99% of the code is in the header files. This negates nearly all of the benefits. Most changes to boost libraries, security fixes or otherwise, require that you rebuild the software. There is a little bit of library code with boost but it's very small so the space savings is also negligible. It just does not seem worth the added effort for boost. I can put my time to better use.

jcoffland commented 1 year ago

See #30