Skip to content

Instantly share code, notes, and snippets.

@nonakap
Created February 2, 2022 14:10
Show Gist options
  • Save nonakap/ed206389096bc60335f4600f44afd235 to your computer and use it in GitHub Desktop.
Save nonakap/ed206389096bc60335f4600f44afd235 to your computer and use it in GitHub Desktop.
pkgsrc/devel/meson 0.60.3nb2でinstall_rpathが効いていないことを確認するためのもの
# ./TEST.sh を実行して最後に"TEST"と表示されればrpathの書き換えに成功しています。
# /tmp/local/bin/fixelf-test: Shared object "libtestso.so.0" not foundの場合はrpathの書き換えが行われていません、多分。件のパッチ(※1)が当たっている場合はこっちになるはずです。
# (※1) 件のパッチ: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/meson/patches/patch-mesonbuild_scripts_depfixer.py?rev=1.3&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
#
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# pkgsrc-devel-meson-restore-fix_elf-test
# pkgsrc-devel-meson-restore-fix_elf-test/meson.build
# pkgsrc-devel-meson-restore-fix_elf-test/testso
# pkgsrc-devel-meson-restore-fix_elf-test/testso/meson.build
# pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.c
# pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.h
# pkgsrc-devel-meson-restore-fix_elf-test/TEST.sh
# pkgsrc-devel-meson-restore-fix_elf-test/autogen.sh
# pkgsrc-devel-meson-restore-fix_elf-test/fixelf-test.c
#
echo c - pkgsrc-devel-meson-restore-fix_elf-test
mkdir -p pkgsrc-devel-meson-restore-fix_elf-test > /dev/null 2>&1
echo x - pkgsrc-devel-meson-restore-fix_elf-test/meson.build
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/meson.build << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/meson.build'
Xproject('fixelf-test', 'c', version: '0.0.0')
X
Xsubdir('testso')
Xexecutable('fixelf-test', [ 'fixelf-test.c' ],
X dependencies: [ libtestso_dep ],
X install_rpath: join_paths(get_option('prefix'), get_option('libdir')),
X install: true)
END-of-pkgsrc-devel-meson-restore-fix_elf-test/meson.build
echo c - pkgsrc-devel-meson-restore-fix_elf-test/testso
mkdir -p pkgsrc-devel-meson-restore-fix_elf-test/testso > /dev/null 2>&1
echo x - pkgsrc-devel-meson-restore-fix_elf-test/testso/meson.build
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/testso/meson.build << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/testso/meson.build'
Xtestso_inc = include_directories([ '.' ])
Xtestso_lib = library('testso', [ 'testso.c' ],
X version: '0.0.0',
X soversion: '0',
X include_directories: testso_inc,
X install: true)
X
Xlibtestso_dep = declare_dependency(
X include_directories: testso_inc,
X link_with: testso_lib)
X
Xinstall_headers('testso.h')
END-of-pkgsrc-devel-meson-restore-fix_elf-test/testso/meson.build
echo x - pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.c
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.c << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.c'
X#include "testso.h"
Xconst char *test_str(void) { return "TEST"; }
END-of-pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.c
echo x - pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.h
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.h << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.h'
Xconst char *test_str(void);
END-of-pkgsrc-devel-meson-restore-fix_elf-test/testso/testso.h
echo x - pkgsrc-devel-meson-restore-fix_elf-test/TEST.sh
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/TEST.sh << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/TEST.sh'
X#!/bin/sh
Xrm -rf build /tmp/local && ./autogen.sh --prefix=/tmp/local && ninja install -v -C build && /tmp/local/bin/fixelf-test
END-of-pkgsrc-devel-meson-restore-fix_elf-test/TEST.sh
echo x - pkgsrc-devel-meson-restore-fix_elf-test/autogen.sh
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/autogen.sh << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/autogen.sh'
X#!/bin/sh
Xbuilddir=build
Xif [ -z "$MESON" ]; then MESON=$(which meson); fi
Xif [ -z "$MESON" ]; then echo "Error: Meson not found."; exit 1; fi
Xrm -rf ${builddir}; mkdir -p ${builddir}; ( cd "$builddir" && meson setup "$@" )
END-of-pkgsrc-devel-meson-restore-fix_elf-test/autogen.sh
echo x - pkgsrc-devel-meson-restore-fix_elf-test/fixelf-test.c
sed 's/^X//' >pkgsrc-devel-meson-restore-fix_elf-test/fixelf-test.c << 'END-of-pkgsrc-devel-meson-restore-fix_elf-test/fixelf-test.c'
X#include <stdio.h>
X#include "testso.h"
Xint main(void) { printf("%s\n", test_str()); return 0; }
END-of-pkgsrc-devel-meson-restore-fix_elf-test/fixelf-test.c
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment