Skip to content

Commit ddbd238

Browse files
authored
Merge pull request #147 from robinst/taglib-2
Upgrade from TagLib 1 to TagLib 2
2 parents c6f788c + eb80ee6 commit ddbd238

29 files changed

+4312
-3271
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
env:
2525
MAKEFLAGS: -j2
2626
PLATFORM: x86_64-linux
27-
TAGLIB_VERSION: 1.11.1
27+
TAGLIB_VERSION: 2.0.1
2828
SWIG_DIR: .swig-v4.1.1
2929

3030
steps:

ext/extconf_common.rb

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# frozen-string-literal: true
22

3-
# Default opt dirs to help mkmf find taglib
4-
opt_dirs = ['/usr/local', '/opt/local', '/sw']
5-
6-
# Heroku vendor dir
7-
vendor = ENV.fetch('GEM_HOME', '')[/^[^ ]*\/vendor\//]
8-
opt_dirs << "#{vendor}taglib" if vendor
9-
opt_dirs_joined = opt_dirs.join(':')
10-
11-
configure_args = "--with-opt-dir=#{opt_dirs_joined} "
12-
ENV['CONFIGURE_ARGS'] = configure_args + ENV.fetch('CONFIGURE_ARGS', '')
3+
taglib_dir = ENV['TAGLIB_DIR']
4+
5+
unless taglib_dir
6+
# Default opt dirs to help mkmf find taglib
7+
opt_dirs = ['/usr/local', '/opt/local', '/sw']
8+
9+
# Heroku vendor dir
10+
vendor = ENV.fetch('GEM_HOME', '')[/^[^ ]*\/vendor\//]
11+
opt_dirs << "#{vendor}taglib" if vendor
12+
opt_dirs_joined = opt_dirs.join(':')
13+
14+
configure_args = "--with-opt-dir=#{opt_dirs_joined} "
15+
ENV['CONFIGURE_ARGS'] = configure_args + ENV.fetch('CONFIGURE_ARGS', '')
16+
end
1317

1418
require 'mkmf'
1519

@@ -18,14 +22,14 @@ def error(msg)
1822
abort
1923
end
2024

21-
if ENV.key?('TAGLIB_DIR') && !File.directory?(ENV['TAGLIB_DIR'])
25+
if taglib_dir && !File.directory?(taglib_dir)
2226
error 'When defined, the TAGLIB_DIR environment variable must point to a valid directory.'
2327
end
2428

2529
# If specified, use the TAGLIB_DIR environment variable as the prefix
2630
# for finding taglib headers and libs. See MakeMakefile#dir_config
2731
# for more details.
28-
dir_config('tag', (ENV['TAGLIB_DIR'] if ENV.key?('TAGLIB_DIR')))
32+
dir_config('tag', taglib_dir)
2933

3034
# When compiling statically, -lstdc++ would make the resulting .so to
3135
# have a dependency on an external libstdc++ instead of the static one.
@@ -46,5 +50,10 @@ def error(msg)
4650

4751
$CFLAGS << ' -DSWIG_TYPE_TABLE=taglib'
4852

53+
# TagLib 2.0 requires C++17. Some compilers default to an older standard
54+
# so we add this '-std=' option to make sure the compiler accepts C++17
55+
# code.
56+
$CXXFLAGS << ' -std=c++17'
57+
4958
# Allow users to override the Ruby runtime's preferred CXX
5059
RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['TAGLIB_RUBY_CXX'] if ENV['TAGLIB_RUBY_CXX']

ext/taglib_aiff/taglib_aiff.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414
%ignore TagLib::RIFF::AIFF::Properties::length;
1515
%ignore TagLib::RIFF::AIFF::Properties::sampleWidth;
1616

17+
%ignore TagLib::RIFF::File;
18+
%include <taglib/rifffile.h>
19+
1720
%include <taglib/aiffproperties.h>
1821

1922
%freefunc TagLib::RIFF::AIFF::File "free_taglib_riff_aiff_file";
2023

2124
// Ignore IOStream and all the constructors using it.
2225
%ignore IOStream;
26+
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool, Properties::ReadStyle, ID3v2::FrameFactory *);
2327
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool, Properties::ReadStyle);
2428
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool);
2529
%ignore TagLib::RIFF::AIFF::File::File(IOStream *);

0 commit comments

Comments
 (0)