Skip to content

Commit

Permalink
Meson Fixes
Browse files Browse the repository at this point in the history
I made these changes while trying to use jose as a meson
subproject.

- moving headers from jose to include/jose
- defining a meson dependency for libjose (for subprojects)
- remove PATH modification from jose-fmt and jose-jwk-use
- Replace link flags with include_directories
  • Loading branch information
tcyrus authored and sergio-correia committed Sep 22, 2021
1 parent 1d15950 commit 320336b
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmd/jose.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include <cmd/jose.h>
#include "jose.h"

#include <sys/types.h>
#include <sys/stat.h>
Expand Down
4 changes: 2 additions & 2 deletions cmd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ executable(meson.project_name(),
'jwe/enc.c',
'alg.c',
'fmt.c',
dependencies: jansson,
link_with: libjose,

dependencies: libjose_dep,
install: true
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions jose/meson.build → include/jose/meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
cd = configuration_data()
cd.set('VERSION', meson.project_version())
configure_file(

jose_h = configure_file(
input: 'jose.h.in',
output: 'jose.h',
configuration: cd
)

install_headers(
meson.current_build_dir() + '/jose.h',
jose_h,
'cfg.h',
'io.h',
'b64.h',
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
incdir = include_directories('.')

subdir('jose')
8 changes: 7 additions & 1 deletion lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if not cc.links(code, args: flags, name: '-Wl,--version-script=...')
flags = [ '-export-symbols-regex=^jose_.*' ]
endif

libjose = library('jose',
libjose_lib = library('jose',
'misc.c', 'misc.h',
'cfg.c',
'io.c',
Expand Down Expand Up @@ -39,9 +39,15 @@ libjose = library('jose',
'openssl/rsaes.c',
'openssl/rsassa.c',

include_directories: incdir,
dependencies: [zlib, jansson, libcrypto, threads],
version: '0.0.0',
link_args: flags,
install: true
)

libjose_dep = declare_dependency(
include_directories: incdir,
dependencies: jansson,
link_with: libjose_lib
)
6 changes: 2 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ if build_machine.system() == 'freebsd'
endif

add_project_arguments(
'-I' + meson.current_source_dir(),
'-I' + meson.current_build_dir(),
'-Wstrict-aliasing',
'-Wchar-subscripts',
'-Wformat-security',
Expand Down Expand Up @@ -45,7 +43,7 @@ mans = []

licenses = ['COPYING']

subdir('jose')
subdir('include')
subdir('doc')
subdir('lib')
subdir('cmd')
Expand All @@ -61,7 +59,7 @@ pkg.generate(
name: 'José Library',

requires_private: [ 'zlib', 'libcrypto' ],
libraries: libjose,
libraries: libjose_lib,
requires: 'jansson',
)

Expand Down
3 changes: 1 addition & 2 deletions tests/issue-75/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ e = environment()
openssl = dependency('openssl', required: false)
if openssl.found()
issue75 = executable('issue75', 'issue-75.c',
dependencies: [jansson, openssl],
link_with: libjose)
dependencies: [libjose_dep, openssl])
test('issue75', issue75, workdir : meson.current_source_dir(), env: e, timeout: 30)
endif
2 changes: 0 additions & 2 deletions tests/jose-fmt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh -ex

export PATH=../cmd:$PATH

jose fmt -j '{}' -O
! jose fmt -j '{}' -A
! jose fmt -j '{}' -S
Expand Down
2 changes: 0 additions & 2 deletions tests/jose-jwk-use
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh -ex

export PATH=../cmd:$PATH

echo '{}' | jose jwk use -i- -u encrypt
! echo '{}' | jose jwk use -i- -r -u encrypt

Expand Down
2 changes: 1 addition & 1 deletion tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ e.prepend('PATH', meson.current_build_dir() + '/../cmd', separator: ':')
e.set('VECTORS', meson.current_source_dir() + '/vectors')

foreach p: progs
exe = executable(p, p + '.c', dependencies: jansson, link_with: libjose)
exe = executable(p, p + '.c', dependencies: libjose_dep)
if p == 'api_b64'
to = 1800
else
Expand Down

0 comments on commit 320336b

Please sign in to comment.