linux: Ship system dynamic libraries, closes #278.
This commit is contained in:
parent
42c2f87217
commit
d9e1861aff
2 changed files with 27 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -64,6 +65,11 @@ TARGET_DIRECTORIES = {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSTEM_LIBRARIES = [
|
||||||
|
'libudev.so',
|
||||||
|
'libgcrypt.so',
|
||||||
|
]
|
||||||
|
|
||||||
HEADERS_SUFFIX = [
|
HEADERS_SUFFIX = [
|
||||||
'.h',
|
'.h',
|
||||||
'.gypi',
|
'.gypi',
|
||||||
|
@ -94,6 +100,10 @@ def main():
|
||||||
copy_binaries()
|
copy_binaries()
|
||||||
copy_headers()
|
copy_headers()
|
||||||
copy_license()
|
copy_license()
|
||||||
|
|
||||||
|
if TARGET_PLATFORM == 'linux':
|
||||||
|
copy_system_libraries()
|
||||||
|
|
||||||
create_version()
|
create_version()
|
||||||
create_dist_zip()
|
create_dist_zip()
|
||||||
create_symbols_zip()
|
create_symbols_zip()
|
||||||
|
@ -157,6 +167,20 @@ def copy_license():
|
||||||
shutil.copy2(os.path.join(SOURCE_ROOT, 'LICENSE'), DIST_DIR)
|
shutil.copy2(os.path.join(SOURCE_ROOT, 'LICENSE'), DIST_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_system_libraries():
|
||||||
|
ldd = execute(['ldd', os.path.join(OUT_DIR, 'atom')])
|
||||||
|
lib_re = re.compile('\t(.*) => (.+) \(.*\)$')
|
||||||
|
for line in ldd.splitlines():
|
||||||
|
m = lib_re.match(line)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
for i, library in enumerate(SYSTEM_LIBRARIES):
|
||||||
|
real_library = m.group(1)
|
||||||
|
if real_library.startswith(library):
|
||||||
|
shutil.copy2(m.group(2), os.path.join(DIST_DIR, real_library))
|
||||||
|
SYSTEM_LIBRARIES[i] = real_library
|
||||||
|
|
||||||
|
|
||||||
def create_version():
|
def create_version():
|
||||||
version_path = os.path.join(SOURCE_ROOT, 'dist', 'version')
|
version_path = os.path.join(SOURCE_ROOT, 'dist', 'version')
|
||||||
with open(version_path, 'w') as version_file:
|
with open(version_path, 'w') as version_file:
|
||||||
|
@ -194,6 +218,8 @@ def create_dist_zip():
|
||||||
|
|
||||||
with scoped_cwd(DIST_DIR):
|
with scoped_cwd(DIST_DIR):
|
||||||
files = TARGET_BINARIES[TARGET_PLATFORM] + ['LICENSE', 'version']
|
files = TARGET_BINARIES[TARGET_PLATFORM] + ['LICENSE', 'version']
|
||||||
|
if TARGET_PLATFORM == 'linux':
|
||||||
|
files += SYSTEM_LIBRARIES
|
||||||
dirs = TARGET_DIRECTORIES[TARGET_PLATFORM]
|
dirs = TARGET_DIRECTORIES[TARGET_PLATFORM]
|
||||||
make_zip(zip_file, files, dirs)
|
make_zip(zip_file, files, dirs)
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ def safe_mkdir(path):
|
||||||
|
|
||||||
def execute(argv):
|
def execute(argv):
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(argv, stderr=subprocess.STDOUT)
|
return subprocess.check_output(argv, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print e.output
|
print e.output
|
||||||
raise e
|
raise e
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue