Fix rpath on MacOS, broken by moving binaries for signing (#411)

This commit is contained in:
Riccardo Schirone 2021-01-21 09:13:41 +01:00 committed by GitHub
parent 012d3e96c2
commit 1d9ffc916f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 33 deletions

View file

@ -4,13 +4,5 @@
ENTITLEMENT="$1"
SRC="$2"
if [ "$#" -ne 2 ]; then
DST="$3"
rm -f "${DST}"
cp -a "${SRC}" "${DST}"
else
DST="${MESON_INSTALL_DESTDIR_PREFIX}/${SRC}"
fi
codesign --entitlements "${ENTITLEMENT}" --force -s - "${DST}"
codesign --entitlements "${ENTITLEMENT}" --force -s - "${SRC}"

View file

@ -1,18 +1,4 @@
rizin_link_args = []
rizin_link_depends = []
rizin_name = 'rizin'
rizin_exe_name = rizin_name
if host_machine.system() == 'darwin'
# NOTE: we do not sign the binary with a certificate for now, so no need for this.
# However keep this in mind if/when we will sign rizin binary
# rizin_link_args += ['-Wl,-sectcreate,__TEXT,__info_plist,' + join_paths(meson.current_source_dir(), 'Info.plist')]
# rizin_link_args += ['-Wl,-framework,Security']
# rizin_link_args += ['-Wl,-framework,CoreFoundation']
# rizin_link_depends += 'Info.plist'
rizin_exe_name += '-unsigned'
endif
rizin_exe = executable(rizin_exe_name, 'rizin.c',
rizin_exe = executable('rizin', 'rizin.c',
include_directories: [platform_inc],
dependencies: [
rz_util_dep,
@ -37,11 +23,9 @@ rizin_exe = executable(rizin_exe_name, 'rizin.c',
rz_crypto_dep,
rz_magic_dep
],
install: rizin_exe_name == rizin_name,
install: true,
install_rpath: rpath_exe,
implicit_include_directories: false,
link_args: rizin_link_args,
link_depends: rizin_link_depends,
)
if host_machine.system() == 'darwin'
@ -49,23 +33,21 @@ if host_machine.system() == 'darwin'
# entitlements
entitlements = files('rizin_macos.xml')
macos_sign_sh = meson.current_source_dir() / 'macos_sign.sh'
custom_target(rizin_name,
custom_target('rizin-signing',
build_by_default: true,
build_always_stale: true,
command: [
macos_sign_sh,
entitlements,
rizin_exe.full_path(),
meson.current_build_dir() / rizin_name,
],
depends: rizin_exe,
output: rizin_name,
install: true,
install_dir: get_option('bindir'),
output: 'rizin-signing',
install: false,
)
meson.add_install_script(meson.current_source_dir() / 'macos_sign.sh',
entitlements,
get_option('bindir') / rizin_name,
rizin_prefix / rizin_bindir / 'rizin',
)
endif

View file

@ -155,6 +155,7 @@ endif
library_cflags = ['-DRZ_PLUGIN_INCORE=1']
rizin_prefix = get_option('prefix')
rizin_bindir = get_option('bindir')
rizin_libdir = get_option('libdir')
rizin_incdir = get_option('includedir') / 'librz'
rizin_datdir = get_option('datadir')
@ -712,6 +713,7 @@ endif
summary({
'prefix': rizin_prefix,
'bindir': rizin_bindir,
'libdir': rizin_libdir,
'includedir': rizin_incdir,
'datadir': rizin_datdir,