remove obsolete Boost dependency

Boost makes building a piece of software much more difficult than
necessary.  It's a huge library, and just uncompressing it takes a
considerable amount of time. MPD only used a tiny fraction of it, yet
its header bloat made the MPD build very slow.  Locating Boost was
difficult due to its arcane build system and its resistance to use
pkg-config; it's always a special case.  MPD could never use features
of newer Boost versions because Linux distributions always shipped old
Boost versions.  Boost made everything complicated and slow.

So, finally, after getting rid of GLib (commit ccdb94b06c), switching
to C++ and using Boost (commit 0801b3f495), we've finally get rid of
it 8 years later.

Unfortunately, I had to reimplement parts of it along the way
(e.g. IntrusiveList).  Kind of NIH, but on the other hand, compiling
MPD has become much easier for users.
This commit is contained in:
Max Kellermann 2023-01-23 13:18:40 +01:00
parent 7ef0bfbdf1
commit 3cc770a00b
14 changed files with 3 additions and 62 deletions

View File

@ -60,7 +60,7 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y --no-install-recommends \ sudo apt-get install -y --no-install-recommends \
${{ matrix.cxx }} ${{matrix.cc }} \ ${{ matrix.cxx }} ${{matrix.cc }} \
libfmt-dev libboost-dev \ libfmt-dev \
libgtest-dev \ libgtest-dev \
libpcre2-dev \ libpcre2-dev \
libsystemd-dev libdbus-1-dev \ libsystemd-dev libdbus-1-dev \
@ -137,7 +137,6 @@ jobs:
brew install \ brew install \
meson ninja \ meson ninja \
fmt \ fmt \
boost \
googletest \ googletest \
icu4c \ icu4c \
ffmpeg \ ffmpeg \

1
NEWS
View File

@ -25,6 +25,7 @@ ver 0.24 (not yet released)
- GCC 10 or clang 11 (or newer) recommended - GCC 10 or clang 11 (or newer) recommended
* static partition configuration * static partition configuration
* remove Haiku support * remove Haiku support
* remove Boost dependency
* require libfmt 7 or later * require libfmt 7 or later
ver 0.23.12 (2023/01/17) ver 0.23.12 (2023/01/17)

View File

@ -160,7 +160,6 @@ thirdparty_libs = [
openssl, openssl,
curl, curl,
libnfs, libnfs,
boost,
] ]
# build the third-party libraries # build the third-party libraries

View File

@ -60,7 +60,6 @@ In any case, you need:
* a C++20 compiler (e.g. GCC 10 or clang 11) * a C++20 compiler (e.g. GCC 10 or clang 11)
* `Meson 0.56.0 <http://mesonbuild.com/>`__ and `Ninja * `Meson 0.56.0 <http://mesonbuild.com/>`__ and `Ninja
<https://ninja-build.org/>`__ <https://ninja-build.org/>`__
* Boost 1.58
* pkg-config * pkg-config
Each plugin usually needs a codec library, which you also need to Each plugin usually needs a codec library, which you also need to
@ -95,7 +94,6 @@ For example, the following installs a fairly complete list of build dependencies
libsqlite3-dev \ libsqlite3-dev \
libsystemd-dev \ libsystemd-dev \
libgtest-dev \ libgtest-dev \
libboost-dev \
libicu-dev \ libicu-dev \
libchromaprint-dev \ libchromaprint-dev \
libgcrypt20-dev libgcrypt20-dev

View File

@ -240,13 +240,6 @@ inc = include_directories(
'.', '.',
) )
boost_dep = dependency('boost', version: '>= 1.58')
if boost_dep.version() == '1.67'
# https://github.com/MusicPlayerDaemon/MPD/pull/384
# https://github.com/boostorg/lockfree/commit/12726cda009a855073b9bedbdce57b6ce7763da2
warning('Your Boost version 1.67 is known to be buggy, and the MPD build will fail. Please upgrade to Boost 1.68 or later.')
endif
subdir('src/lib/fmt') subdir('src/lib/fmt')
log = static_library( log = static_library(

View File

@ -1,28 +0,0 @@
import os, shutil
import re
from build.project import Project
class BoostProject(Project):
def __init__(self, url, md5, installed,
**kwargs):
m = re.match(r'.*/boost_(\d+)_(\d+)_(\d+)\.tar\.bz2$', url)
version = "%s.%s.%s" % (m.group(1), m.group(2), m.group(3))
Project.__init__(self, url, md5, installed,
name='boost', version=version,
**kwargs)
def _build(self, toolchain):
src = self.unpack(toolchain)
# install the headers manually; don't build any library
# (because right now, we only use header-only libraries)
includedir = os.path.join(toolchain.install_prefix, 'include')
dest = os.path.join(includedir, 'boost')
shutil.rmtree(dest, ignore_errors=True)
shutil.copytree(os.path.join(src, 'boost'), dest)
# touch the boost/version.hpp file to ensure it's newer than
# the downloaded Boost tarball, to avoid reinstalling Boost on
# every run
os.utime(os.path.join(toolchain.install_prefix, self.installed))

View File

@ -8,7 +8,6 @@ from build.cmake import CmakeProject
from build.autotools import AutotoolsProject from build.autotools import AutotoolsProject
from build.ffmpeg import FfmpegProject from build.ffmpeg import FfmpegProject
from build.openssl import OpenSSLProject from build.openssl import OpenSSLProject
from build.boost import BoostProject
from build.jack import JackProject from build.jack import JackProject
libmpdclient = MesonProject( libmpdclient = MesonProject(
@ -448,9 +447,3 @@ jack = JackProject(
'38f674bbc57852a8eb3d9faa1f96a0912d26f7d5df14c11005ad499c8ae352f2', '38f674bbc57852a8eb3d9faa1f96a0912d26f7d5df14c11005ad499c8ae352f2',
'lib/pkgconfig/jack.pc', 'lib/pkgconfig/jack.pc',
) )
boost = BoostProject(
'https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2',
'71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa',
'include/boost/version.hpp',
)

View File

@ -96,9 +96,6 @@ def configure(toolchain, src, build, args=()):
env = toolchain.env.copy() env = toolchain.env.copy()
# Meson 0.54 requires the BOOST_ROOT environment variable
env['BOOST_ROOT'] = toolchain.install_prefix
subprocess.check_call(configure, env=env) subprocess.check_call(configure, env=env)
class MesonProject(Project): class MesonProject(Project):

View File

@ -5,9 +5,6 @@ endif
audiounit_dep = declare_dependency( audiounit_dep = declare_dependency(
link_args: ['-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreServices'], link_args: ['-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreServices'],
dependencies: [
boost_dep,
],
) )
apple = static_library( apple = static_library(

View File

@ -53,7 +53,6 @@ db_glue = static_library(
db_glue_sources, db_glue_sources,
include_directories: inc, include_directories: inc,
dependencies: [ dependencies: [
boost_dep,
fmt_dep, fmt_dep,
log_dep, log_dep,
], ],

View File

@ -10,9 +10,6 @@ input_api = static_library(
'ProxyInputStream.cxx', 'ProxyInputStream.cxx',
'LastInputStream.cxx', 'LastInputStream.cxx',
include_directories: inc, include_directories: inc,
dependencies: [
boost_dep,
],
) )
input_api_dep = declare_dependency( input_api_dep = declare_dependency(
@ -44,7 +41,6 @@ input_glue = static_library(
'cache/Stream.cxx', 'cache/Stream.cxx',
include_directories: inc, include_directories: inc,
dependencies: [ dependencies: [
boost_dep,
log_dep, log_dep,
], ],
) )

View File

@ -36,7 +36,7 @@ if get_option('httpd')
'httpd/HttpdClient.cxx', 'httpd/HttpdClient.cxx',
'httpd/HttpdOutputPlugin.cxx', 'httpd/HttpdOutputPlugin.cxx',
] ]
output_plugins_deps += [ event_dep, net_dep, boost_dep ] output_plugins_deps += [ event_dep, net_dep ]
need_encoder = true need_encoder = true
endif endif
@ -177,7 +177,6 @@ output_plugins = static_library(
sles_dep, sles_dep,
winmm_dep, winmm_dep,
wasapi_dep, wasapi_dep,
boost_dep,
output_plugins_deps, output_plugins_deps,
], ],
) )

View File

@ -19,7 +19,6 @@ storage_glue = static_library(
'Configured.cxx', 'Configured.cxx',
include_directories: inc, include_directories: inc,
dependencies: [ dependencies: [
boost_dep,
log_dep, log_dep,
], ],
) )

View File

@ -106,7 +106,6 @@ thirdparty_libs = [
curl, curl,
libnfs, libnfs,
jack, jack,
boost,
] ]
# build the third-party libraries # build the third-party libraries