aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmeson_install.py19
-rw-r--r--test cases/rust/2 sharedlib/installed_files.txt2
-rw-r--r--test cases/rust/2 sharedlib/meson.build4
3 files changed, 22 insertions, 3 deletions
diff --git a/meson_install.py b/meson_install.py
index e42fd77..3333071 100755
--- a/meson_install.py
+++ b/meson_install.py
@@ -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])
diff --git a/test cases/rust/2 sharedlib/installed_files.txt b/test cases/rust/2 sharedlib/installed_files.txt
new file mode 100644
index 0000000..0606d1f
--- /dev/null
+++ b/test cases/rust/2 sharedlib/installed_files.txt
@@ -0,0 +1,2 @@
+bin/prog
+lib/libstuff-e4d2ee75-1.0.so
diff --git a/test cases/rust/2 sharedlib/meson.build b/test cases/rust/2 sharedlib/meson.build
index 563ef15..8f741aa 100644
--- a/test cases/rust/2 sharedlib/meson.build
+++ b/test cases/rust/2 sharedlib/meson.build
@@ -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)