meson: Support building lame as subproject

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1068>
This commit is contained in:
Thibault Saunier 2021-10-05 11:38:33 -03:00 committed by GStreamer Marge Bot
parent cdf1e24121
commit f60af61bb7
3 changed files with 37 additions and 22 deletions

View file

@ -29,7 +29,11 @@
G_BEGIN_DECLS
#ifndef LAME_SUBPROJECT
#include <lame/lame.h>
#else
#include "lame.h"
#endif
#define GST_TYPE_LAMEMP3ENC (gst_lamemp3enc_get_type())
G_DECLARE_FINAL_TYPE (GstLameMP3Enc, gst_lamemp3enc, GST, LAMEMP3ENC,

View file

@ -1,23 +1,25 @@
lame_option = get_option('lame')
lame_dep = cc.find_library('mp3lame', required : lame_option)
have_lame = lame_dep.found()
lame_dep = dependency('mp3lame', fallback: ['lame', 'lame_dep'], required: false)
# TODO: https://github.com/mesonbuild/meson/issues/3940
if have_lame
have_lame = cc.has_header_symbol('lame/lame.h', 'lame_init')
if not have_lame and lame_option.enabled()
error('Found libmp3lame but lame.h was not usable')
endif
endif
if have_lame
lame_extra_c_args = []
have_lame = lame_dep.found()
if not have_lame
lame_dep = cc.find_library('mp3lame', required : lame_option)
have_lame = cc.has_header_symbol('lame/lame.h', 'lame_init', required : lame_option)
if cc.has_header_symbol('lame/lame.h', 'lame_set_VBR_quality')
lame_extra_c_args += ['-DHAVE_LAME_SET_VBR_QUALITY']
endif
if cc.has_header_symbol('lame/lame.h', 'MEDIUM')
lame_extra_c_args += ['-DGSTLAME_PRESET']
endif
else
lame_extra_c_args += ['-DHAVE_LAME_SET_VBR_QUALITY', '-DGSTLAME_PRESET', '-DLAME_SUBPROJECT']
endif
if not have_lame
subdir_done()
endif
lame = library('gstlame',
['gstlamemp3enc.c', 'plugin.c'],
c_args : gst_plugins_good_args + lame_extra_c_args,
@ -26,6 +28,6 @@ if have_lame
install : true,
install_dir : plugins_install_dir,
)
pkgconfig.generate(lame, install_dir : plugins_pkgconfig_install_dir)
plugins += [lame]
endif

9
subprojects/lame.wrap Normal file
View file

@ -0,0 +1,9 @@
[wrap-file]
directory = lame-3.100
source_url = http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
source_filename = lame-3.100.tar.gz
source_hash = ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e
patch_url = https://wrapdb.mesonbuild.com/v2/lame_3.100-1/get_patch
patch_filename = lame-3.100-1-wrap.zip
patch_hash = 3e62e95d13aef0f139e4376e775acb367525a8ed2dbeb8d09c93fd318f093654