Install Rust shared libraries.

pull/15/head
Jussi Pakkanen 11 years ago
parent 00b5c320da
commit 2366f822d2
  1. 19
      meson_install.py
  2. 2
      test cases/rust/2 sharedlib/installed_files.txt
  3. 4
      test cases/rust/2 sharedlib/meson.build

@ -15,6 +15,7 @@
# limitations under the License.
import sys, pickle, os, shutil, subprocess, gzip, platform
from glob import glob
class InstallData():
def __init__(self, prefix, depfixer, dep_prefix):
@ -99,9 +100,25 @@ def is_elf_platform():
return False
return True
def check_for_stampfile(fname):
'''Some languages e.g. Rust have output files
whose names are not known at configure time.
Check if this is the case and return the real
file instead.'''
if fname.endswith('.so') or fname.endswith('.dll'):
if os.stat(fname).st_size == 0:
(base, suffix) = os.path.splitext(fname)
files = glob(base + '-*' + suffix)
if len(files) > 1:
print("Stale library files in build dir. Can't install.")
sys.exit(1)
if len(files) == 1:
return files[0]
return fname
def install_targets(d):
for t in d.targets:
fname = t[0]
fname = check_for_stampfile(t[0])
outdir = os.path.join(d.prefix, t[1])
aliases = t[2]
outname = os.path.join(outdir, os.path.split(fname)[-1])

@ -0,0 +1,2 @@
bin/prog
lib/libstuff-e4d2ee75-1.0.so

@ -1,5 +1,5 @@
project('rust shared library', 'rust')
l = shared_library('stuff', 'stuff.rs')
e = executable('prog', 'prog.rs', link_with : l)
l = shared_library('stuff', 'stuff.rs', install : true)
e = executable('prog', 'prog.rs', link_with : l, install : true)
test('linktest', e)

Loading…
Cancel
Save