build script: package meson as zipped app

This commit is contained in:
alexey.lysiuk 2020-12-06 11:14:15 +02:00
parent bdb135ec38
commit a1f2a7d6b4
1 changed files with 7 additions and 15 deletions

View File

@ -32,6 +32,7 @@ import re
import shutil
import subprocess
import urllib.request
import zipapp
class CommandLineOptions(dict):
@ -701,28 +702,19 @@ class MesonTarget(Target):
return os.path.exists(builder.source_path + 'meson.py')
def post_build(self, builder: 'Builder'):
dest_path = builder.deps_path + self.name + os.sep
lib_path = 'lib' + os.sep + self.name + os.sep
dest_lib_path = dest_path + lib_path
os.makedirs(dest_lib_path, exist_ok=True)
script = 'meson.py'
shutil.copy(builder.source_path + script, dest_lib_path)
script = '__main__.py'
shutil.copy(builder.source_path + script, builder.build_path)
module = 'mesonbuild'
module_path = dest_lib_path + module
module_path = builder.build_path + module
if os.path.exists(module_path):
shutil.rmtree(module_path)
shutil.copytree(builder.source_path + module, module_path)
dest_bin_path = dest_path + 'bin' + os.sep
os.makedirs(dest_bin_path, exist_ok=True)
dest_path = builder.deps_path + self.name + os.sep + 'bin' + os.sep
os.makedirs(dest_path, exist_ok=True)
exe_path = dest_bin_path + self.name
if os.path.exists(exe_path):
os.unlink(exe_path)
os.symlink(os.pardir + os.sep + lib_path + script, exe_path)
zipapp.create_archive(builder.build_path, dest_path + self.name, '/usr/bin/env python3', compressed=True)
class Mpg123Target(ConfigureMakeStaticDependencyTarget):