Skip to content

Commit 5d2c13f

Browse files
authored
Allow setting the path to libbinaryen.so shared library (#3025)
This makes it easier to install libbinaryen.so into an alternative locations. Fixes part of issue #2999 for me.
1 parent ffdaad6 commit 5d2c13f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def run_gcc_tests():
292292
src = os.path.join(shared.get_test_dir('example'), t)
293293
expected = os.path.join(shared.get_test_dir('example'), '.'.join(t.split('.')[:-1]) + '.txt')
294294
# build the C file separately
295-
libpath = os.path.join(os.path.dirname(shared.options.binaryen_bin), 'lib')
295+
libpath = shared.options.binaryen_lib
296296
extra = [shared.NATIVECC, src, '-c', '-o', 'example.o',
297297
'-I' + os.path.join(shared.options.binaryen_root, 'src'), '-g', '-L' + libpath, '-pthread']
298298
if src.endswith('.cpp'):

scripts/test/shared.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def parse_args(args):
5454
' Default: bin/ of current directory (i.e. assume an in-tree build).'
5555
' If not specified, the environment variable BINARYEN_ROOT= can also'
5656
' be used to adjust this.'))
57+
parser.add_argument(
58+
'--binaryen-lib', dest='binaryen_lib', default='',
59+
help=('Specifies a path to where the built Binaryen shared library resides at.'
60+
' Default: ./lib relative to bin specified above.'))
5761
parser.add_argument(
5862
'--binaryen-root', dest='binaryen_root', default='',
5963
help=('Specifies a path to the root of the Binaryen repository tree.'
@@ -120,6 +124,11 @@ def warn(text):
120124

121125
options.binaryen_bin = os.path.normpath(os.path.abspath(options.binaryen_bin))
122126

127+
if not options.binaryen_lib:
128+
options.binaryen_lib = os.path.join(os.path.dirname(options.binaryen_bin), 'lib')
129+
130+
options.binaryen_lib = os.path.normpath(os.path.abspath(options.binaryen_lib))
131+
123132
# ensure BINARYEN_ROOT is set up
124133
os.environ['BINARYEN_ROOT'] = os.path.dirname(options.binaryen_bin)
125134

0 commit comments

Comments
 (0)