mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 10:26:19 +02:00
patch: add feature to build script
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
parent
30e85c8654
commit
803509d952
1 changed files with 23 additions and 6 deletions
29
build.py
29
build.py
|
@ -24,18 +24,21 @@ else:
|
||||||
flutter_build_dir_2 = f'flutter/{flutter_build_dir}'
|
flutter_build_dir_2 = f'flutter/{flutter_build_dir}'
|
||||||
skip_cargo = False
|
skip_cargo = False
|
||||||
|
|
||||||
|
|
||||||
def get_arch() -> str:
|
def get_arch() -> str:
|
||||||
custom_arch = os.environ.get("ARCH")
|
custom_arch = os.environ.get("ARCH")
|
||||||
if custom_arch is None:
|
if custom_arch is None:
|
||||||
return "amd64"
|
return "amd64"
|
||||||
return custom_arch
|
return custom_arch
|
||||||
|
|
||||||
|
|
||||||
def system2(cmd):
|
def system2(cmd):
|
||||||
err = os.system(cmd)
|
err = os.system(cmd)
|
||||||
if err != 0:
|
if err != 0:
|
||||||
print(f"Error occurred when executing: {cmd}. Exiting.")
|
print(f"Error occurred when executing: {cmd}. Exiting.")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
with open("Cargo.toml", encoding="utf-8") as fh:
|
with open("Cargo.toml", encoding="utf-8") as fh:
|
||||||
for line in fh:
|
for line in fh:
|
||||||
|
@ -123,6 +126,11 @@ def make_parser():
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Build windows portable'
|
help='Build windows portable'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--unix-file-copy-paste',
|
||||||
|
action='store_true',
|
||||||
|
help='Build with unix file copy paste feature'
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--flatpak',
|
'--flatpak',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
@ -185,6 +193,7 @@ def download_extract_features(features, res_dir):
|
||||||
import re
|
import re
|
||||||
|
|
||||||
proxy = ''
|
proxy = ''
|
||||||
|
|
||||||
def req(url):
|
def req(url):
|
||||||
if not proxy:
|
if not proxy:
|
||||||
return url
|
return url
|
||||||
|
@ -195,10 +204,12 @@ def download_extract_features(features, res_dir):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
for (feat, feat_info) in features.items():
|
for (feat, feat_info) in features.items():
|
||||||
includes = feat_info['include'] if 'include' in feat_info and feat_info['include'] else []
|
includes = feat_info['include'] if 'include' in feat_info and feat_info['include'] else [
|
||||||
includes = [ re.compile(p) for p in includes ]
|
]
|
||||||
excludes = feat_info['exclude'] if 'exclude' in feat_info and feat_info['exclude'] else []
|
includes = [re.compile(p) for p in includes]
|
||||||
excludes = [ re.compile(p) for p in excludes ]
|
excludes = feat_info['exclude'] if 'exclude' in feat_info and feat_info['exclude'] else [
|
||||||
|
]
|
||||||
|
excludes = [re.compile(p) for p in excludes]
|
||||||
|
|
||||||
print(f'{feat} download begin')
|
print(f'{feat} download begin')
|
||||||
download_filename = feat_info['zip_url'].split('/')[-1]
|
download_filename = feat_info['zip_url'].split('/')[-1]
|
||||||
|
@ -272,6 +283,8 @@ def get_features(args):
|
||||||
features.append('flatpak')
|
features.append('flatpak')
|
||||||
if args.appimage:
|
if args.appimage:
|
||||||
features.append('appimage')
|
features.append('appimage')
|
||||||
|
if args.unix_file_copy_paste:
|
||||||
|
features.append('unix-file-copy-paste')
|
||||||
print("features:", features)
|
print("features:", features)
|
||||||
return features
|
return features
|
||||||
|
|
||||||
|
@ -350,6 +363,7 @@ def build_flutter_deb(version, features):
|
||||||
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
|
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
def build_deb_from_folder(version, binary_folder):
|
def build_deb_from_folder(version, binary_folder):
|
||||||
os.chdir('flutter')
|
os.chdir('flutter')
|
||||||
system2('mkdir -p tmpdeb/usr/bin/')
|
system2('mkdir -p tmpdeb/usr/bin/')
|
||||||
|
@ -388,10 +402,12 @@ def build_deb_from_folder(version, binary_folder):
|
||||||
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
|
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
def build_flutter_dmg(version, features):
|
def build_flutter_dmg(version, features):
|
||||||
if not skip_cargo:
|
if not skip_cargo:
|
||||||
# set minimum osx build target, now is 10.14, which is the same as the flutter xcode project
|
# set minimum osx build target, now is 10.14, which is the same as the flutter xcode project
|
||||||
system2(f'MACOSX_DEPLOYMENT_TARGET=10.14 cargo build --features {features} --lib --release')
|
system2(
|
||||||
|
f'MACOSX_DEPLOYMENT_TARGET=10.14 cargo build --features {features} --lib --release')
|
||||||
# copy dylib
|
# copy dylib
|
||||||
system2(
|
system2(
|
||||||
"cp target/release/liblibrustdesk.dylib target/release/librustdesk.dylib")
|
"cp target/release/liblibrustdesk.dylib target/release/librustdesk.dylib")
|
||||||
|
@ -557,7 +573,8 @@ def main():
|
||||||
codesign -s "Developer ID Application: {0}" --force --options runtime ./target/release/bundle/osx/RustDesk.app/Contents/MacOS/*
|
codesign -s "Developer ID Application: {0}" --force --options runtime ./target/release/bundle/osx/RustDesk.app/Contents/MacOS/*
|
||||||
codesign -s "Developer ID Application: {0}" --force --options runtime ./target/release/bundle/osx/RustDesk.app
|
codesign -s "Developer ID Application: {0}" --force --options runtime ./target/release/bundle/osx/RustDesk.app
|
||||||
'''.format(pa))
|
'''.format(pa))
|
||||||
system2('create-dmg "RustDesk %s.dmg" "target/release/bundle/osx/RustDesk.app"' % version)
|
system2(
|
||||||
|
'create-dmg "RustDesk %s.dmg" "target/release/bundle/osx/RustDesk.app"' % version)
|
||||||
os.rename('RustDesk %s.dmg' %
|
os.rename('RustDesk %s.dmg' %
|
||||||
version, 'rustdesk-%s.dmg' % version)
|
version, 'rustdesk-%s.dmg' % version)
|
||||||
if pa:
|
if pa:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue