Skip to content

Commit

Permalink
Merge pull request #147 from robinst/taglib-2
Browse files Browse the repository at this point in the history
Upgrade from TagLib 1 to TagLib 2
  • Loading branch information
jacobvosmaer authored Oct 26, 2024
2 parents c6f788c + eb80ee6 commit ddbd238
Show file tree
Hide file tree
Showing 29 changed files with 4,312 additions and 3,271 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
MAKEFLAGS: -j2
PLATFORM: x86_64-linux
TAGLIB_VERSION: 1.11.1
TAGLIB_VERSION: 2.0.1
SWIG_DIR: .swig-v4.1.1

steps:
Expand Down
33 changes: 21 additions & 12 deletions ext/extconf_common.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# frozen-string-literal: true

# Default opt dirs to help mkmf find taglib
opt_dirs = ['/usr/local', '/opt/local', '/sw']

# Heroku vendor dir
vendor = ENV.fetch('GEM_HOME', '')[/^[^ ]*\/vendor\//]
opt_dirs << "#{vendor}taglib" if vendor
opt_dirs_joined = opt_dirs.join(':')

configure_args = "--with-opt-dir=#{opt_dirs_joined} "
ENV['CONFIGURE_ARGS'] = configure_args + ENV.fetch('CONFIGURE_ARGS', '')
taglib_dir = ENV['TAGLIB_DIR']

unless taglib_dir
# Default opt dirs to help mkmf find taglib
opt_dirs = ['/usr/local', '/opt/local', '/sw']

# Heroku vendor dir
vendor = ENV.fetch('GEM_HOME', '')[/^[^ ]*\/vendor\//]
opt_dirs << "#{vendor}taglib" if vendor
opt_dirs_joined = opt_dirs.join(':')

configure_args = "--with-opt-dir=#{opt_dirs_joined} "
ENV['CONFIGURE_ARGS'] = configure_args + ENV.fetch('CONFIGURE_ARGS', '')
end

require 'mkmf'

Expand All @@ -18,14 +22,14 @@ def error(msg)
abort
end

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

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

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

$CFLAGS << ' -DSWIG_TYPE_TABLE=taglib'

# TagLib 2.0 requires C++17. Some compilers default to an older standard
# so we add this '-std=' option to make sure the compiler accepts C++17
# code.
$CXXFLAGS << ' -std=c++17'

# Allow users to override the Ruby runtime's preferred CXX
RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['TAGLIB_RUBY_CXX'] if ENV['TAGLIB_RUBY_CXX']
4 changes: 4 additions & 0 deletions ext/taglib_aiff/taglib_aiff.i
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
%ignore TagLib::RIFF::AIFF::Properties::length;
%ignore TagLib::RIFF::AIFF::Properties::sampleWidth;

%ignore TagLib::RIFF::File;
%include <taglib/rifffile.h>

%include <taglib/aiffproperties.h>

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

// Ignore IOStream and all the constructors using it.
%ignore IOStream;
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool, Properties::ReadStyle, ID3v2::FrameFactory *);
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool, Properties::ReadStyle);
%ignore TagLib::RIFF::AIFF::File::File(IOStream *, bool);
%ignore TagLib::RIFF::AIFF::File::File(IOStream *);
Expand Down
Loading

0 comments on commit ddbd238

Please sign in to comment.