diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b481397..14577e6f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -153,17 +153,22 @@ test nightly: rules: - if: '$UPDATE_IMG == null || $UPDATE_IMG == "nightly"' -meson shared: +.meson: extends: .img-stable + rules: + - if: '$UPDATE_IMG == null || $UPDATE_IMG == "stable"' + variables: + CSOUND_LIB_DIR: '/usr/lib' + +meson shared: + extends: .meson script: - meson build --default-library=shared --prefix=$(pwd)/install - ninja -C build install - ./ci/check-plugins-installed.py install - rules: - - if: '$UPDATE_IMG == null || $UPDATE_IMG == "stable"' meson static: - extends: .img-stable + extends: .meson script: - meson build --default-library=static --prefix=$(pwd)/install -Dsodium=built-in - ninja -C build install @@ -172,8 +177,6 @@ meson static: - PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/../install/lib/x86_64-linux-gnu/pkgconfig meson build - ninja -C build - ./build/test-gst-static - rules: - - if: '$UPDATE_IMG == null || $UPDATE_IMG == "stable"' rustfmt: extends: .img-stable diff --git a/meson.build b/meson.build index 51965565..710bafe3 100644 --- a/meson.build +++ b/meson.build @@ -78,23 +78,27 @@ endif cc = meson.get_compiler('c') csound_option = get_option('csound') -csound_dep = dependency('', required: false) # not-found dependency -if not csound_option.disabled() - csound_dep = cc.find_library('csound64', required: false) - if not csound_dep.found() - python3 = import('python').find_installation('python3') - res = run_command(python3, '-c', 'import os; print(os.environ["CSOUND_LIB_DIR"])') - if res.returncode() == 0 - csound_dep = cc.find_library('csound64', dirs: res.stdout(), required: csound_option) - elif csound_option.enabled() - error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set') +# try first to find csound using pkg-config +csound_dep = dependency('', required: false) +if not csound_dep.found() and not csound_option.disabled() + # if csound isn't distributed with pkg-config then user needs to define CSOUND_LIB_DIR with its location + python3 = import('python').find_installation('python3') + res = run_command(python3, '-c', 'import os; print(os.environ["CSOUND_LIB_DIR"])') + if res.returncode() == 0 + csound_libdir = res.stdout().strip() + csound_dep = cc.find_library('csound64', dirs: csound_libdir, required: false) + if csound_dep.found() + extra_env += {'CSOUND_LIB_DIR': csound_libdir} endif endif endif if csound_dep.found() plugins_rep += {'audio/csound' : 'libgstcsound'} +elif csound_option.enabled() + error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set') else + message('csound not found, disabling its plugin') exclude += ['audio/csound'] endif