Skip to content

Commit

Permalink
make sure the license is done before the dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
guijan committed Dec 29, 2024
1 parent 53a0cd9 commit 0b1d4ea
Showing 1 changed file with 43 additions and 41 deletions.
84 changes: 43 additions & 41 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,32 @@ libobsd = library('obsd', src,
gnu_symbol_visibility: 'hidden',
override_options: link)

libobsd_dep = declare_dependency(link_with: libobsd,
dependencies: deps,
include_directories: incdir,
sources: gen_inc,
compile_args: user_args)
meson.override_dependency('libbsd-overlay', libobsd_dep)
meson.override_dependency('libobsd', libobsd_dep)
### Installation. Headers and the library are handled elsewhere.

subdir('test')
if not subproj
install_man(man)

### Installation. Headers and the library are handled elsewhere.
pkg = import('pkgconfig')
pkg.generate(libobsd,
name: 'libobsd',
description: 'Transparent OpenBSD compatibility library',
filebase: 'libobsd',
url: 'https://github.com/guijan/libobsd',
subdirs: 'obsd',
# Kitchen sink approach: OpenBSD makes all symbols visible by
# default. We need to provide declarations for the OpenBSD
# functions the system provides, the easiest way to do this is to
# just tell the system to show all of its functions too.
extra_cflags: user_args)
if get_option('provide_libbsd')
# https://mesonbuild.com/Pkgconfig-module.html
# "install_dir the directory to install to, defaults to the value of option
# libdir followed by /pkgconfig"
install_symlink('libbsd-overlay.pc',
install_dir: get_option('libdir') / 'pkgconfig',
pointing_to: 'libobsd.pc')
endif
endif

libobsd_license = 'LICENSE.txt'
libobsd_readme = 'README.md'
Expand All @@ -125,17 +140,19 @@ if docdir == ''
docdir = get_option('datadir') / 'doc' \
/ meson.project_name() + '-' + meson.project_version()
endif
before_libobsd_dep = []
if windows_host
unix2dos = find_program('unix2dos')
custom_target('license',
command: [unix2dos],
input: libobsd_license,
feed: true,
capture: true,
output: subproj ? 'LICENSE_libobsd.txt' : libobsd_license,
build_by_default: true,
install: not subproj,
install_dir: docdir)
outname = subproj ? 'LICENSE_libobsd.txt' : libobsd_license
before_libobsd_dep += custom_target('license',
command: [unix2dos],
input: libobsd_license,
feed: true,
capture: true,
output: outname,
build_by_default: true,
install: not subproj,
install_dir: docdir)
custom_target('readme',
command: [unix2dos],
input: libobsd_readme,
Expand All @@ -151,27 +168,12 @@ elif not subproj
install_tag: 'doc')
endif

if not subproj
install_man(man)
libobsd_dep = declare_dependency(link_with: libobsd,
dependencies: deps,
include_directories: incdir,
sources: before_libobsd_dep + gen_inc,
compile_args: user_args)
meson.override_dependency('libbsd-overlay', libobsd_dep)
meson.override_dependency('libobsd', libobsd_dep)

pkg = import('pkgconfig')
pkg.generate(libobsd,
name: 'libobsd',
description: 'Transparent OpenBSD compatibility library',
filebase: 'libobsd',
url: 'https://github.com/guijan/libobsd',
subdirs: 'obsd',
# Kitchen sink approach: OpenBSD makes all symbols visible by
# default. We need to provide declarations for the OpenBSD
# functions the system provides, the easiest way to do this is to
# just tell the system to show all of its functions too.
extra_cflags: user_args)
if get_option('provide_libbsd')
# https://mesonbuild.com/Pkgconfig-module.html
# "install_dir the directory to install to, defaults to the value of option
# libdir followed by /pkgconfig"
install_symlink('libbsd-overlay.pc',
install_dir: get_option('libdir') / 'pkgconfig',
pointing_to: 'libobsd.pc')
endif
endif
subdir('test')

0 comments on commit 0b1d4ea

Please sign in to comment.