mirror of
https://github.com/SynologyOpenSource/pkgscripts-ng.git
synced 2025-07-20 18:20:23 +00:00
Release for DSM7.0
This commit is contained in:
BIN
CodeSign.php
BIN
CodeSign.php
Binary file not shown.
347
EnvDeploy
347
EnvDeploy
@ -1,339 +1,82 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import argparse
|
||||
import urllib.request
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import glob
|
||||
import shutil
|
||||
import logging
|
||||
|
||||
sys.path.append(os.path.realpath(os.path.dirname(__file__)) + "/include/python")
|
||||
import BuildEnv
|
||||
from parallel import doPlatformParallel
|
||||
from cache import cache
|
||||
from chroot import Chroot
|
||||
from tee import Tee
|
||||
from toolkit import TarballManager
|
||||
from pkgdeploy import (EnvDeployError, filter_platforms,
|
||||
ChrootToolkit, DownloadDir, set_log)
|
||||
|
||||
log_file = os.path.join(BuildEnv.SynoBase, 'envdeploy.log')
|
||||
sys.stdout = Tee(sys.stdout, log_file)
|
||||
sys.stderr = Tee(sys.stderr, log_file, move=False)
|
||||
|
||||
VersionMap = 'version_map'
|
||||
DownloadDir = os.path.join(BuildEnv.SynoBase, 'toolkit_tarballs')
|
||||
ToolkitServer = 'https://sourceforge.net/projects/dsgpl/files/toolkit'
|
||||
Product = "DSM"
|
||||
|
||||
|
||||
@cache
|
||||
def split_version(version):
|
||||
if '-' in version:
|
||||
return version.split('-')
|
||||
else:
|
||||
return version, None
|
||||
|
||||
|
||||
class EnvDeployError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
class TarballNotFoundError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
class PlatformNotAvailableError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
class DownloadToolkitError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
class ToolkitDownloader:
|
||||
def __init__(self, version, platforms, tarball_manager, quiet):
|
||||
self._download_list = []
|
||||
self.version, self.build_num = split_version(version)
|
||||
self.platforms = platforms
|
||||
self.tarball_manager = tarball_manager
|
||||
self.quiet = quiet
|
||||
|
||||
self.append_base_tarball()
|
||||
self.append_env_tarball()
|
||||
self.append_dev_tarball()
|
||||
|
||||
if not os.path.isdir(DownloadDir):
|
||||
os.makedirs(DownloadDir)
|
||||
|
||||
def _join_download_url(self, *patterns):
|
||||
url = ToolkitServer
|
||||
for pattern in list(patterns):
|
||||
if not pattern:
|
||||
continue
|
||||
url += '/%s' % pattern
|
||||
return url
|
||||
|
||||
def _download(self, url):
|
||||
print("Download... " + url)
|
||||
if self.quiet:
|
||||
reporthook = None
|
||||
else:
|
||||
reporthook = self.dl_progress
|
||||
|
||||
try:
|
||||
dest = os.path.join(DownloadDir, url.split("/")[-1])
|
||||
urllib.request.urlretrieve(url, dest, reporthook=reporthook)
|
||||
print("Download destination: " + dest)
|
||||
except urllib.error.HTTPError:
|
||||
raise DownloadToolkitError("Failed to download toolkit: " + url)
|
||||
|
||||
def dl_progress(self, count, dl_size, total_size):
|
||||
percent = int(count * dl_size * 50 / total_size)
|
||||
sys.stdout.write("[%-50s] %d%%" % ('=' * (percent-1) + ">", 2 * percent))
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write("\b" * 102)
|
||||
|
||||
def _test_url_available(self, url):
|
||||
try:
|
||||
return int(urllib.request.urlopen(url).getcode()) == 200
|
||||
except urllib.error.HTTPError:
|
||||
return False
|
||||
|
||||
def append_base_tarball(self):
|
||||
self._download_list.append(self._join_download_url(Product + self.version, self.tarball_manager.base_tarball_name))
|
||||
|
||||
def append_env_tarball(self):
|
||||
self.append_platform_tarball_list(self.tarball_manager.get_env_tarball_name)
|
||||
|
||||
def append_dev_tarball(self):
|
||||
self.append_platform_tarball_list(self.tarball_manager.get_dev_tarball_name)
|
||||
|
||||
def append_platform_tarball_list(self, get_tarball_name):
|
||||
for platform in self.platforms:
|
||||
self._download_list.append(self._join_download_url(Product + self.version, get_tarball_name(platform)))
|
||||
|
||||
def download_toolkit(self):
|
||||
for url in self._download_list:
|
||||
if self._test_url_available(url):
|
||||
self._download(url)
|
||||
else:
|
||||
raise DownloadToolkitError("URL {} does not exist. Please ask synology support for assistance.".format(url))
|
||||
|
||||
|
||||
class ToolkitDeployer:
|
||||
def __init__(self, args, platforms, tarball_manager):
|
||||
self.clear = args.clear
|
||||
self.version, self.build_num = split_version(args.version)
|
||||
self.platforms = platforms
|
||||
self.suffix = args.suffix
|
||||
self.tarball_manager = tarball_manager
|
||||
|
||||
@property
|
||||
def has_pixz(self):
|
||||
try:
|
||||
with open(os.devnull, 'rb') as null:
|
||||
subprocess.check_call(['which', 'pixz'], stdout=null, stderr=null)
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return True
|
||||
|
||||
def __extract__(self, tarball, dest_dir):
|
||||
cmd = ['tar']
|
||||
if self.has_pixz:
|
||||
cmd.append('-Ipixz')
|
||||
cmd += ['-xhf', tarball, '-C', dest_dir]
|
||||
print(" ".join(cmd))
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
def deploy_base_env(self, platform):
|
||||
base_tarball = self.tarball_manager.base_tarball_path
|
||||
self.__extract__(base_tarball, BuildEnv.getChrootSynoBase(platform, self.version, self.suffix))
|
||||
|
||||
def deploy_env(self, platform):
|
||||
self.__extract__(self.tarball_manager.get_env_tarball_path(platform),
|
||||
BuildEnv.getChrootSynoBase(platform, self.version, self.suffix))
|
||||
|
||||
# clear and mkdir chroot
|
||||
def setup_chroot(self, platform):
|
||||
chroot = BuildEnv.getChrootSynoBase(platform, self.version, self.suffix)
|
||||
if not os.path.isdir(chroot):
|
||||
os.makedirs(chroot)
|
||||
return
|
||||
|
||||
if not self.clear:
|
||||
return
|
||||
|
||||
print("Clear %s..." % chroot)
|
||||
try:
|
||||
with open(os.devnull, 'wb') as null:
|
||||
subprocess.check_call(['umount', os.path.join(chroot, 'proc')], stderr=null)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
for f in os.listdir(chroot):
|
||||
if 'ccaches' in f:
|
||||
continue
|
||||
file_path = os.path.join(chroot, f)
|
||||
subprocess.check_call(['rm', '-rf', file_path])
|
||||
|
||||
def __install_debs__(self, chroot):
|
||||
with Chroot(chroot) as chroot:
|
||||
deb_list = glob.glob('*.deb')
|
||||
if not deb_list:
|
||||
return
|
||||
|
||||
for deb in deb_list:
|
||||
subprocess.check_call(['dpkg', '-i', chroot.get_inside_path(deb)])
|
||||
os.remove(deb)
|
||||
|
||||
def deploy_dev(self, platform):
|
||||
chroot = BuildEnv.getChrootSynoBase(platform, self.version, self.suffix)
|
||||
self.__extract__(self.tarball_manager.get_dev_tarball_path(platform), chroot)
|
||||
self.__install_debs__(chroot)
|
||||
|
||||
def adjust_chroot(self, platform):
|
||||
def mkdir_source(chroot):
|
||||
source_dir = os.path.join(chroot, 'source')
|
||||
if not os.path.isdir(source_dir):
|
||||
os.makedirs(source_dir)
|
||||
|
||||
def link_python(chroot):
|
||||
python2_x = glob.glob(os.path.join(chroot, 'usr', 'bin', 'python2.[0-9]'))[0]
|
||||
python = os.path.join(chroot, 'usr', 'bin', 'python')
|
||||
if os.path.exists(python):
|
||||
os.remove(python)
|
||||
os.symlink(os.path.basename(python2_x), python)
|
||||
|
||||
def copy_user_env_config(chroot):
|
||||
configs = ['/etc/hosts', '/root/.gitconfig', '/root/.ssh', '/etc/resolv.conf']
|
||||
|
||||
for config in configs:
|
||||
dest = chroot + config
|
||||
if os.path.isdir(config):
|
||||
if os.path.isdir(dest):
|
||||
shutil.rmtree(dest)
|
||||
shutil.copytree(config, dest)
|
||||
elif os.path.isfile(config):
|
||||
shutil.copy(config, dest)
|
||||
|
||||
chroot = BuildEnv.getChrootSynoBase(platform, self.version, self.suffix)
|
||||
mkdir_source(chroot)
|
||||
link_python(chroot)
|
||||
copy_user_env_config(chroot)
|
||||
src = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
|
||||
if src == 'pkgscripts':
|
||||
dst = os.path.join(chroot, 'pkgscripts-ng')
|
||||
elif src == 'pkgscripts-ng':
|
||||
dst = os.path.join(chroot, 'pkgscripts')
|
||||
else:
|
||||
raise RuntimeError("Script directory should be pkgscripts or pkgscripts-ng.")
|
||||
if not os.path.islink(dst):
|
||||
os.symlink(src, dst)
|
||||
|
||||
def deploy(self):
|
||||
doPlatformParallel(self.setup_chroot, self.platforms)
|
||||
doPlatformParallel(self.deploy_base_env, self.platforms)
|
||||
doPlatformParallel(self.deploy_env, self.platforms)
|
||||
doPlatformParallel(self.deploy_dev, self.platforms)
|
||||
doPlatformParallel(self.adjust_chroot, self.platforms)
|
||||
|
||||
|
||||
def check_tarball_exists(build_num, platforms, tarball_manager):
|
||||
files = []
|
||||
files.append(tarball_manager.base_tarball_path)
|
||||
|
||||
for platform in platforms:
|
||||
files.append(tarball_manager.get_dev_tarball_path(platform))
|
||||
files.append(tarball_manager.get_env_tarball_path(platform))
|
||||
|
||||
for f in files:
|
||||
if not os.path.isfile(f):
|
||||
raise TarballNotFoundError("Needed file not found! " + f)
|
||||
|
||||
|
||||
def get_all_platforms(dsm_ver, build_num):
|
||||
pattern = 'AvailablePlatform_%s_%s' % (dsm_ver.split('.')[0], dsm_ver.split('.')[1])
|
||||
|
||||
# -v 6.0-8405
|
||||
if build_num:
|
||||
try:
|
||||
cmd = ['git', '-C', os.path.dirname(__file__), 'show', 'origin/%sPKGDEV:include/toolkit.config' % build_num]
|
||||
config = subprocess.check_output(cmd).decode().split('\n')
|
||||
except subprocess.CalledProcessError:
|
||||
raise PlatformNotAvailableError("Please check `%sPKGDEV' branch exist!" % build_num)
|
||||
|
||||
for line in config:
|
||||
if pattern in line:
|
||||
platforms = line.split('=')[1].strip('"').split()
|
||||
# -v 6.0
|
||||
else:
|
||||
platforms = BuildEnv.getIncludeVariable('toolkit.config', pattern).split()
|
||||
|
||||
return platforms
|
||||
|
||||
|
||||
def get_platforms(dsm_ver, build_num, platforms):
|
||||
all_platforms = get_all_platforms(dsm_ver, build_num)
|
||||
|
||||
if not platforms:
|
||||
return all_platforms
|
||||
|
||||
redundant_platforms = set(platforms) - set(all_platforms)
|
||||
if redundant_platforms:
|
||||
raise PlatformNotAvailableError("[%s] is not available platform." % " ".join(redundant_platforms))
|
||||
|
||||
return platforms
|
||||
set_log('envdeploy.log')
|
||||
|
||||
|
||||
def parse_args(argv):
|
||||
argparser = argparse.ArgumentParser()
|
||||
argparser.add_argument('-v', '--version', dest='version',
|
||||
help='Deploy toolkit version (6.0 or 6.0-9527), default is latest version')
|
||||
argparser.add_argument('-c', '--clear', action='store_true', default=False,
|
||||
help='Clear chroot before deploy')
|
||||
argparser.add_argument('-t', '--tarball', dest='local_tarball', default=None, help='Use local tarball dir')
|
||||
argparser.add_argument('-s', '--suffix', help='Assign build_env suffix, ex build_env-demo')
|
||||
argparser.add_argument('-q', '--quiet', action='store_true', help="Don't display download status bar")
|
||||
argparser.add_argument('-l', '--list', action="store_true", default=False, help='List available platforms')
|
||||
argparser.add_argument('-p', dest='platforms', default="", help='Deploy platforms')
|
||||
help='Deploy toolkit version (e.g., 6.2), default is latest version.')
|
||||
argparser.add_argument('-C', '--noclear', action='store_true', default=False,
|
||||
help='Not clear chroot before deploy.')
|
||||
argparser.add_argument('-t', '--tarball', dest='local_tarball',
|
||||
default=None, help='Use local tarball dir. Imply -D')
|
||||
argparser.add_argument(
|
||||
'-s', '--suffix', help='Assign build_env suffix, ex build_env-demo.')
|
||||
argparser.add_argument('-q', '--quiet', action='store_true',
|
||||
help="Don't display download status bar.")
|
||||
argparser.add_argument('-l', '--list', action="store_true",
|
||||
default=False, help='List available platforms.')
|
||||
argparser.add_argument('-p', dest='platforms',
|
||||
default="", help='Deploy platforms.')
|
||||
argparser.add_argument('-b', '--branch', default="",
|
||||
help='Package branch for customize environment.')
|
||||
argparser.add_argument('-c', '--clear-only',
|
||||
action='store_true', help='Only clear environment')
|
||||
argparser.add_argument('-D', '--no-download', dest="download",
|
||||
action="store_false", help="Do not download.")
|
||||
|
||||
args = argparser.parse_args(argv)
|
||||
args.platforms = args.platforms.split()
|
||||
args.platforms = list(set(args.platforms.split()))
|
||||
|
||||
if args.local_tarball:
|
||||
args.download = False
|
||||
|
||||
if not args.version:
|
||||
args.version = BuildEnv.getIncludeVariable('toolkit.config', 'LatestVersion')
|
||||
|
||||
args.platforms = filter_platforms(args.version, args.platforms)
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def main(argv):
|
||||
args = parse_args(argv)
|
||||
dsm_ver, build_num = split_version(args.version)
|
||||
platforms = get_platforms(dsm_ver, build_num, args.platforms)
|
||||
tarball_root = DownloadDir
|
||||
|
||||
if args.list:
|
||||
print("Available platforms: " + " ".join(platforms))
|
||||
logging.info("Available platforms: " + " ".join(args.platforms))
|
||||
return
|
||||
|
||||
if args.local_tarball:
|
||||
tarball_root = args.local_tarball
|
||||
tarball_root = args.local_tarball if args.local_tarball else DownloadDir
|
||||
toolkit = ChrootToolkit(
|
||||
args.version, args.platforms, args.suffix, tarball_root)
|
||||
|
||||
tarball_manager = TarballManager(dsm_ver, tarball_root)
|
||||
toolkit.clean()
|
||||
if args.clear_only:
|
||||
return
|
||||
if args.download:
|
||||
toolkit.download(args.quiet)
|
||||
|
||||
if not args.local_tarball:
|
||||
ToolkitDownloader(args.version, platforms, tarball_manager, args.quiet).download_toolkit()
|
||||
|
||||
check_tarball_exists(build_num, platforms, tarball_manager)
|
||||
ToolkitDeployer(args, platforms, tarball_manager).deploy()
|
||||
print("All task finished.")
|
||||
toolkit.deploy()
|
||||
logging.info("All task finished.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main(sys.argv[1:])
|
||||
except EnvDeployError as e:
|
||||
print("\n\033[91m%s:\033[0m" % type(e).__name__)
|
||||
print(str(e))
|
||||
print("\n[ERROR] " + " ".join(sys.argv) + " failed!")
|
||||
logging.error(type(e).__name__)
|
||||
logging.error(str(e))
|
||||
logging.error(" ".join(sys.argv) + " failed!")
|
||||
sys.exit(1)
|
||||
|
159
ParallelProjects.py
Executable file
159
ParallelProjects.py
Executable file
@ -0,0 +1,159 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
from ProjectDepends import ProjectNode, DepGraph # use for pickle
|
||||
import shelve
|
||||
from collections import defaultdict
|
||||
import os
|
||||
import pickle
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
|
||||
def parse_args(args):
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
parser.add_argument('--init', help='Init a project generator')
|
||||
group.add_argument('-r', dest='reverse', action='store_false', help="Direct: reverse")
|
||||
group.add_argument('-x', dest='traverse', action='store_true', help="Direct: traverse [Default]")
|
||||
parser.add_argument('-c', dest='count', type=int, help="Depends level.")
|
||||
parser.add_argument('--next', action='store_true', help='Get next build projects.')
|
||||
parser.add_argument('--failed', action='store_true', help="Tag given project failed.")
|
||||
parser.add_argument('--show', action='store_true', help="show build status.")
|
||||
parser.add_argument('--purge', action='store_true', help="Purge this task.")
|
||||
parser.add_argument('projects', nargs='*', help='Projects to serve')
|
||||
|
||||
args = parser.parse_args(args)
|
||||
if args.init:
|
||||
args.direct = args.reverse
|
||||
|
||||
return args
|
||||
|
||||
|
||||
class GraphTraverser:
|
||||
def __init__(self, direct, graph, builds):
|
||||
self.direct = direct
|
||||
self.graph = graph
|
||||
self.builds = sorted(builds)
|
||||
self.success = []
|
||||
self.failed = []
|
||||
self.skiped = defaultdict(set)
|
||||
self.visit_unreachable_node()
|
||||
|
||||
# We need to update not built projects to `Success`
|
||||
def visit_unreachable_node(self):
|
||||
set_builds = set(self.builds)
|
||||
for proj, node in self.graph.created_projects.items():
|
||||
if not set(node.getProjectDepends(0)) & set_builds:
|
||||
node.update_status(True)
|
||||
|
||||
def update_infected_projects_failed(self, depend_nodes, failed_root):
|
||||
for dep_node in depend_nodes:
|
||||
# If parent failed, we dont need to build all depend projects.
|
||||
if dep_node.visited:
|
||||
continue
|
||||
|
||||
dep_node.update_status(False)
|
||||
|
||||
if dep_node.proj in self.builds:
|
||||
self.skiped[failed_root].add(dep_node.proj)
|
||||
self.builds.remove(dep_node.proj)
|
||||
|
||||
self.update_infected_projects_failed(self.get_infected_projects(dep_node), failed_root)
|
||||
|
||||
def update_failed_projects(self, projs):
|
||||
for proj in projs:
|
||||
proj_node = self.graph.getProjectNode(proj)
|
||||
proj_node.update_status(False)
|
||||
self.failed.append(proj)
|
||||
if proj in self.builds:
|
||||
self.builds.remove(proj)
|
||||
self.update_infected_projects_failed(self.get_infected_projects(proj_node), proj)
|
||||
print('%s:%s' % (proj, ",".join(self.skiped[proj])))
|
||||
|
||||
def update_infected_projects_success(self, depend_nodes):
|
||||
for dep_node in depend_nodes:
|
||||
# We need to build depend proj later, dont update need built dep to success
|
||||
if dep_node.visited or dep_node.proj in self.builds:
|
||||
continue
|
||||
|
||||
if self.project_ready(dep_node):
|
||||
dep_node.update_status(True)
|
||||
self.update_infected_projects_success(self.get_infected_projects(dep_node))
|
||||
|
||||
def update_success_projects(self, projs):
|
||||
for proj in projs:
|
||||
proj_node = self.graph.getProjectNode(proj)
|
||||
proj_node.update_status(True)
|
||||
self.success.append(proj)
|
||||
if proj in self.builds:
|
||||
self.builds.remove(proj)
|
||||
self.update_infected_projects_success(self.get_infected_projects(proj_node))
|
||||
|
||||
def get_infected_projects(self, proj_node):
|
||||
if self.direct:
|
||||
return proj_node.rev_depends
|
||||
else:
|
||||
return proj_node.depends
|
||||
|
||||
def project_ready(self, node):
|
||||
if self.direct:
|
||||
return all([dep_node.success for dep_node in node.depends])
|
||||
else:
|
||||
return all([rev_node.success for rev_node in node.rev_depends])
|
||||
|
||||
def get_next(self, count):
|
||||
if not self.builds:
|
||||
return ['NULL']
|
||||
|
||||
output = []
|
||||
for proj in self.builds:
|
||||
proj_node = self.graph.getProjectNode(proj)
|
||||
if self.project_ready(proj_node):
|
||||
output.append(proj_node.proj)
|
||||
if len(output) >= count:
|
||||
break
|
||||
|
||||
return output
|
||||
|
||||
def show(self):
|
||||
if self.success:
|
||||
print("\n[Success projects]")
|
||||
print(" ".join(self.success))
|
||||
|
||||
if self.failed:
|
||||
print("\n[Failed projects -> Skiped projects]")
|
||||
for fail in self.failed:
|
||||
print("%s -> %s" % (fail, " ".join(self.skiped[fail])))
|
||||
print()
|
||||
|
||||
|
||||
def main(args):
|
||||
args = parse_args(args)
|
||||
sys.setrecursionlimit(3000)
|
||||
shelve_file = os.path.join('/', str(os.getppid()) + '.shelve')
|
||||
|
||||
with shelve.open(shelve_file, writeback=True) as sv:
|
||||
if args.init:
|
||||
with open(args.init, 'rb') as fd:
|
||||
depends = pickle.load(fd)
|
||||
sv['traverser'] = GraphTraverser(args.direct, depends, args.projects)
|
||||
return
|
||||
|
||||
traverser = sv['traverser']
|
||||
if args.next:
|
||||
traverser.update_success_projects(args.projects)
|
||||
print(" ".join(traverser.get_next(args.count)))
|
||||
|
||||
if args.failed:
|
||||
traverser.update_failed_projects(args.projects)
|
||||
|
||||
if args.show:
|
||||
traverser.show()
|
||||
|
||||
if args.purge:
|
||||
os.remove(shelve_file)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
782
PkgCreate.py
782
PkgCreate.py
@ -1,730 +1,192 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2014 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import sys
|
||||
import os
|
||||
from subprocess import check_call, check_output, CalledProcessError, STDOUT, Popen
|
||||
import argparse
|
||||
import glob
|
||||
import shutil
|
||||
from time import localtime, strftime, gmtime, time
|
||||
from collections import defaultdict
|
||||
import traceback
|
||||
import multiprocessing
|
||||
import logging
|
||||
|
||||
# Paths
|
||||
ScriptDir = os.path.dirname(os.path.abspath(__file__))
|
||||
BaseDir = os.path.dirname(ScriptDir)
|
||||
ScriptName = os.path.basename(__file__)
|
||||
PkgScripts = '/pkgscripts-ng'
|
||||
sys.path.append(ScriptDir + '/include')
|
||||
sys.path.append(ScriptDir + '/include/python')
|
||||
|
||||
from pkgcommon import check_stage, show_msg_block, BaseDir, logger
|
||||
from pkgerror import PkgCreateError
|
||||
from pkgcustomize import PreBuilder, PostBuilder, PreInstaller, PostInstaller, PreCollecter, PostCollecter
|
||||
from pkguniform import StreamToLogging, PackagePacker, WorkerFactory, EnvPrepareWorker, ProjectTraverser, ProjectLinker, PackageBuilder, PackageInstaller, PackageCollecter
|
||||
|
||||
sys.path.append(ScriptDir+'/include')
|
||||
sys.path.append(ScriptDir+'/include/python')
|
||||
import BuildEnv
|
||||
from chroot import Chroot
|
||||
from parallel import doPlatformParallel, doParallel
|
||||
from link_project import link_projects, link_scripts, LinkProjectError
|
||||
from tee import Tee
|
||||
import parallel
|
||||
from utils import move_old
|
||||
import config_parser
|
||||
from project_visitor import UpdateHook, ProjectVisitor, UpdateFailedError, ConflictError
|
||||
from version_file import VersionFile
|
||||
|
||||
log_file = os.path.join(BaseDir, 'pkgcreate.log')
|
||||
sys.stdout = Tee(sys.stdout, log_file)
|
||||
sys.stderr = Tee(sys.stderr, log_file, move=False)
|
||||
EnvVersion = BaseDir + '/EnvVersion'
|
||||
MinSDKVersion = "6.2"
|
||||
|
||||
MinSDKVersion = "6.0"
|
||||
BasicProjects = set()
|
||||
|
||||
|
||||
class PkgCreateError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
class SignPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class CollectPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class LinkPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class BuildPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class InstallPacageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class TraverseProjectError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
def show_msg_block(msg, title=None, error=False):
|
||||
if not msg:
|
||||
return
|
||||
|
||||
if error:
|
||||
tok_s = "#"
|
||||
tok_e = "#"
|
||||
else:
|
||||
tok_s = "="
|
||||
tok_e = "-"
|
||||
|
||||
if title:
|
||||
print("\n" + tok_s * 60)
|
||||
print("{:^60s}".format(title))
|
||||
print(tok_e * 60)
|
||||
print("\n".join(msg))
|
||||
print()
|
||||
sys.stdout = StreamToLogging(logging)
|
||||
sys.error = StreamToLogging(logging, logging.ERROR)
|
||||
|
||||
|
||||
def args_parser(argv):
|
||||
global sys
|
||||
argparser = argparse.ArgumentParser()
|
||||
argparser.add_argument('-p', dest='platforms',
|
||||
help='Specify target platforms. Default to detect available platforms under build_env/')
|
||||
argparser.add_argument('-e', '--env', dest='env_section', default='default',
|
||||
help='Specify environment section in SynoBuildConf/depends. Default is [default].')
|
||||
argparser.add_argument('-v', '--version', dest='env_version', help='Specify target DSM version manually.')
|
||||
argparser.add_argument('-x', dest='dep_level', type=int, default=1, help='Build dependant level')
|
||||
argparser.add_argument('-b', dest='branch', default='master', help='Specify branch of package.')
|
||||
argparser.add_argument('-v', '--version', dest='env_version',
|
||||
help='Specify target DSM version manually.')
|
||||
argparser.add_argument('-x', dest='dep_level', type=int,
|
||||
default=1, help='Build dependant level')
|
||||
argparser.add_argument('-X', dest='parallel_proj', type=int, default=1,
|
||||
help='SynoBuild parallel build projects, 0 means build with {} parallel jobs'.format(multiprocessing.cpu_count()))
|
||||
argparser.add_argument('-b', dest='branch',
|
||||
default='master', help='Specify branch of package.')
|
||||
argparser.add_argument('-s', dest='suffix', default="",
|
||||
help='Specify suffix of folder of build environment (build_env/).')
|
||||
argparser.add_argument('-c', dest='collect', action='store_true', help='collect package.')
|
||||
argparser.add_argument('-U', dest='update', action='store_false', help='Not update projects.')
|
||||
argparser.add_argument('-L', dest='link', action='store_false', help='Not link projects.')
|
||||
argparser.add_argument('-B', dest='build', action='store_false', help='Not build projects.')
|
||||
argparser.add_argument('-I', dest='install', action='store_false', help='Not install projects.')
|
||||
argparser.add_argument('-i', dest='only_install', action='store_true', help='Only install projects.')
|
||||
argparser.add_argument('-S', dest="sign", action='store_false', help='Do not make code sign.')
|
||||
argparser.add_argument('--build-opt', default="", help='Argument pass to SynoBuild')
|
||||
argparser.add_argument('--install-opt', default="", help='Argument pass to SynoInstall')
|
||||
argparser.add_argument('--print-log', action='store_true', help='Print SynoBuild/SynoInstall error log.')
|
||||
argparser.add_argument('--min-sdk', dest='sdk_ver', default=MinSDKVersion, help='Min sdk version, default=6.0')
|
||||
argparser.add_argument('-c', dest='collect',
|
||||
action='store_true', help='collect package.')
|
||||
argparser.add_argument('--no-collecter', dest='collecter',
|
||||
action='store_false', help='skip doing all collecting behaviors.')
|
||||
argparser.add_argument(
|
||||
'-L', dest='link', action='store_false', help='Not link projects.')
|
||||
argparser.add_argument('-l', dest='update_link',
|
||||
action='store_true', help='Update and link projects.')
|
||||
argparser.add_argument(
|
||||
'-B', dest='build', action='store_false', help='Not build projects.')
|
||||
argparser.add_argument('-I', dest='install',
|
||||
action='store_false', help='Not install projects.')
|
||||
argparser.add_argument('-i', dest='only_install',
|
||||
action='store_true', help='Only install projects.')
|
||||
argparser.add_argument('-P', dest='parallel', type=int, default=multiprocessing.cpu_count(),
|
||||
help='Parallel platforms, default is {}'.format(multiprocessing.cpu_count()))
|
||||
argparser.add_argument('--build-opt', default="",
|
||||
help='Argument pass to SynoBuild')
|
||||
argparser.add_argument('--install-opt', default="",
|
||||
help='Argument pass to SynoInstall')
|
||||
argparser.add_argument('--print-log', action='store_true',
|
||||
help='Print SynoBuild/SynoInstall error log.')
|
||||
argparser.add_argument(
|
||||
'--no-tee', dest='tee', action='store_false', help='Not tee stdout/stderr to log.')
|
||||
argparser.add_argument('--min-sdk', dest='sdk_ver',
|
||||
default=MinSDKVersion, help='Min sdk version, default={}'.format(MinSDKVersion))
|
||||
argparser.add_argument('package', help='Target packages')
|
||||
|
||||
args = argparser.parse_args(argv)
|
||||
|
||||
if args.tee:
|
||||
logfile = os.path.join(BuildEnv.SynoBase, 'pkgcreate.log')
|
||||
move_old(logfile)
|
||||
fh = logging.FileHandler(logfile)
|
||||
fh.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter(
|
||||
'[%(asctime)s] %(levelname)s: %(message)s')
|
||||
fh.setFormatter(formatter)
|
||||
logging.getLogger().addHandler(fh)
|
||||
|
||||
if not args.build:
|
||||
args.link = False
|
||||
|
||||
if args.only_install:
|
||||
args.update = args.link = args.build = False
|
||||
args.link = args.build = False
|
||||
|
||||
if args.update_link:
|
||||
args.build = args.install = args.collect = False
|
||||
args.link = True
|
||||
|
||||
if args.platforms:
|
||||
args.platforms = args.platforms.split()
|
||||
|
||||
parallel.PROCESSES = args.parallel
|
||||
|
||||
if args.parallel_proj == 0:
|
||||
args.parallel_proj = multiprocessing.cpu_count()
|
||||
|
||||
if args.parallel_proj > 1:
|
||||
parallel_opt = '--parallel'
|
||||
|
||||
if parallel_opt in args.build_opt:
|
||||
logger.warning(
|
||||
"[WARNING] Skipped -P option in SynoBuild, there is --parallel in --build-opt")
|
||||
else:
|
||||
args.build_opt += '{} {} {}'.format(
|
||||
args.build_opt, parallel_opt, args.parallel_proj)
|
||||
|
||||
if parallel_opt in args.install_opt:
|
||||
logger.warning(
|
||||
"[WARNING] Skipped -P option in SynoInstall, there is --parallel in --install-opt")
|
||||
else:
|
||||
args.install_opt += '{} {} {}'.format(
|
||||
args.install_opt, parallel_opt, args.parallel_proj)
|
||||
|
||||
msg = []
|
||||
for key, value in vars(args).items():
|
||||
if isinstance(value, list):
|
||||
value = " ".join(value)
|
||||
else:
|
||||
value = str(value)
|
||||
msg.append("{:13s}".format(key) + ": " + value)
|
||||
|
||||
msg.append("{:13s} : {}".format(key, value))
|
||||
show_msg_block(msg, "Parse argument result")
|
||||
|
||||
return args
|
||||
|
||||
|
||||
class WorkerFactory:
|
||||
def __init__(self, args):
|
||||
self.package = Package(args.package)
|
||||
self.env_config = EnvConfig(args.package, args.env_section, args.env_version, args.platforms, args.dep_level,
|
||||
args.branch, args.suffix)
|
||||
self.package.chroot = self.env_config.get_chroot()
|
||||
|
||||
def new(self, worker_class, *args, **kwargs):
|
||||
return worker_class(self.package, self.env_config, *args, **kwargs)
|
||||
|
||||
|
||||
class Worker:
|
||||
def __init__(self, package, env_config):
|
||||
self.package = package
|
||||
self.env_config = env_config
|
||||
self.__time_log = None
|
||||
|
||||
def execute(self, *argv):
|
||||
if not self._check_executable():
|
||||
return
|
||||
|
||||
init_time = time()
|
||||
if hasattr(self, 'title'):
|
||||
print("\n" + "=" * 60)
|
||||
print("{:^60s}".format('Start to run "%s"' % self.title))
|
||||
print("-" * 60)
|
||||
self._process_output(self._run(*argv))
|
||||
self.__time_log = strftime('%H:%M:%S', gmtime(time()-init_time))
|
||||
|
||||
def _run(self):
|
||||
pass
|
||||
|
||||
def _check_executable(self):
|
||||
return True
|
||||
|
||||
def _process_output(self, output):
|
||||
pass
|
||||
|
||||
def get_time_cost(self):
|
||||
time_cost = []
|
||||
if hasattr(self, 'title') and self.__time_log:
|
||||
time_cost.append("%s: %s" % (self.__time_log, self.title))
|
||||
|
||||
return time_cost
|
||||
|
||||
|
||||
class EnvPrepareWorker(Worker):
|
||||
def __init__(self, package, env_config, update):
|
||||
Worker.__init__(self, package, env_config)
|
||||
self.update = update
|
||||
self.sub_workers = []
|
||||
|
||||
def _run(self, *argv):
|
||||
depends_cache = None
|
||||
update_hook = None
|
||||
for version, platforms in self.env_config.toolkit_versions.items():
|
||||
print("Processing [%s]: " % version + " ".join(platforms))
|
||||
dsm_ver, build_num = version.split('-')
|
||||
|
||||
if self.update:
|
||||
update_hook = UpdateHook(self.env_config.branch, build_num)
|
||||
|
||||
for worker in self.sub_workers:
|
||||
worker.execute(version, update_hook, depends_cache)
|
||||
|
||||
def add_subworker(self, sub_worker):
|
||||
self.sub_workers.append(sub_worker)
|
||||
|
||||
def get_time_cost(self):
|
||||
time_cost = []
|
||||
if self.sub_workers:
|
||||
for sub_worker in self.sub_workers:
|
||||
time_cost += sub_worker.get_time_cost()
|
||||
|
||||
return time_cost
|
||||
|
||||
|
||||
class ProjectTraverser(Worker):
|
||||
title = "Traverse project"
|
||||
|
||||
def _run(self, version, update_hook, cache):
|
||||
dep_level = self.env_config.dep_level
|
||||
platforms = self.env_config.toolkit_versions[version]
|
||||
|
||||
try:
|
||||
visitor = ProjectVisitor(update_hook, dep_level, platforms, depends_cache=cache)
|
||||
dict_projects = visitor.traverse(self.package.name)
|
||||
visitor.checkout_git_refs()
|
||||
visitor.show_proj_info()
|
||||
except UpdateFailedError as e:
|
||||
log = os.path.join(BaseDir, 'logs', 'error.update')
|
||||
with open(log, 'r') as fd:
|
||||
print(fd.read())
|
||||
raise TraverseProjectError("Error log: " + log)
|
||||
except ConflictError as e:
|
||||
raise TraverseProjectError(str(e))
|
||||
|
||||
self.package.dict_projects = dict_projects
|
||||
|
||||
|
||||
class ProjectLinker(Worker):
|
||||
title = "Link Project"
|
||||
|
||||
def _run(self, version, *argv):
|
||||
tasks = []
|
||||
for platform in self.env_config.toolkit_versions[version]:
|
||||
chroot = self.env_config.get_chroot(platform)
|
||||
if not os.path.isdir(os.path.join(chroot, 'source')):
|
||||
os.makedirs(os.path.join(chroot, 'source'))
|
||||
link_scripts(chroot)
|
||||
tasks.append((set(BasicProjects) |
|
||||
self.package.get_build_projects(platform) |
|
||||
self.package.ref_projs, chroot))
|
||||
|
||||
try:
|
||||
doParallel(link_projects, tasks)
|
||||
except LinkProjectError as e:
|
||||
raise LinkPackageError(str(e))
|
||||
|
||||
|
||||
class CodeSignWorker(Worker):
|
||||
title = "Generate code sign"
|
||||
|
||||
def _run(self):
|
||||
return doPlatformParallel(self._code_sign, self.env_config.platforms)
|
||||
|
||||
def check_gpg_key_exist(self):
|
||||
try:
|
||||
gpg = check_output(['gpg', '--list-keys']).decode().strip()
|
||||
except CalledProcessError:
|
||||
return False
|
||||
|
||||
return gpg
|
||||
|
||||
def _code_sign(self, platform):
|
||||
spks = self.package.spk_config.chroot_spks(self.env_config.get_chroot(platform))
|
||||
if not spks:
|
||||
raise SignPackageError('[%s] No spk found' % platform)
|
||||
|
||||
for spk in spks:
|
||||
cmd = ' php ' + PkgScripts + '/CodeSign.php --sign=/image/packages/' + os.path.basename(spk)
|
||||
with Chroot(self.env_config.get_chroot(platform)):
|
||||
if not self.check_gpg_key_exist():
|
||||
raise SignPackageError("[%s] Gpg key not exist. You can add `-S' to skip package code sign or import gpg key first." % platform)
|
||||
|
||||
print("[%s] Sign package: " % platform + cmd)
|
||||
try:
|
||||
check_call(cmd, shell=True, executable="/bin/bash")
|
||||
except CalledProcessError:
|
||||
raise SignPackageError('Failed to create signature: ' + spk)
|
||||
|
||||
|
||||
class PackageCollecter(Worker):
|
||||
title = "Collect package"
|
||||
|
||||
def _run(self):
|
||||
spks = defaultdict(list)
|
||||
|
||||
dest_dir = self.package.spk_config.spk_result_dir(self.env_config.suffix)
|
||||
if os.path.exists(dest_dir):
|
||||
old_dir = dest_dir + '.bad.' + strftime('%Y%m%d-%H%M', localtime())
|
||||
if os.path.isdir(old_dir):
|
||||
shutil.rmtree(old_dir)
|
||||
os.rename(dest_dir, old_dir)
|
||||
os.makedirs(dest_dir)
|
||||
|
||||
for platform in self.env_config.platforms:
|
||||
for spk in self.package.spk_config.chroot_spks(self.env_config.get_chroot(platform)):
|
||||
spks[os.path.basename(spk)].append(spk)
|
||||
|
||||
hook = self.package.collect
|
||||
if os.path.isfile(hook):
|
||||
print("Run hook " + hook)
|
||||
hook_env = {
|
||||
'SPK_SRC_DIR': self.package.spk_config.chroot_packages_dir(self.env_config.get_chroot(platform)),
|
||||
'SPK_DST_DIR': dest_dir,
|
||||
'SPK_VERSION': self.package.spk_config.version,
|
||||
'SPK_NAME': self.package.spk_config.name
|
||||
}
|
||||
pipe = Popen(hook, shell=True, stdout=None, stderr=None, env=hook_env)
|
||||
pipe.communicate()
|
||||
if pipe.returncode != 0:
|
||||
raise CollectPackageError("Execute package collect script failed.")
|
||||
|
||||
for spk, source_list in spks.items():
|
||||
print("%s -> %s" % (source_list[0], dest_dir))
|
||||
try:
|
||||
shutil.copy(source_list[0], dest_dir)
|
||||
except:
|
||||
raise CollectPackageError("Collect package failed")
|
||||
|
||||
if len(source_list) > 1:
|
||||
raise CollectPackageError("Found duplicate %s: \n%s" % (spk, "\n".join(source_list)))
|
||||
|
||||
|
||||
class CommandRunner(Worker):
|
||||
__log__ = None
|
||||
__error_msg__ = None
|
||||
__failed_exception__ = None
|
||||
|
||||
def _rename_log(self, suffix='.old'):
|
||||
if os.path.isfile(self.log):
|
||||
os.rename(self.log, self.log + suffix)
|
||||
|
||||
def _run(self, *argv):
|
||||
self._rename_log()
|
||||
cmd = self._wrap_cmd(self._get_command(*argv))
|
||||
|
||||
try:
|
||||
print(" ".join(cmd))
|
||||
output = check_output(" ".join(cmd), stderr=STDOUT, shell=True, executable="/bin/bash").decode()
|
||||
self._post_hook()
|
||||
except CalledProcessError as e:
|
||||
output = e.output.decode()
|
||||
print(output)
|
||||
raise self.__failed_exception__(self.__error_msg__)
|
||||
|
||||
return output
|
||||
|
||||
def _get_command(self):
|
||||
raise PkgCreateError("Not implement")
|
||||
|
||||
def _post_hook(self):
|
||||
pass
|
||||
|
||||
def _process_output(self, output):
|
||||
pass
|
||||
|
||||
def _wrap_cmd(self, cmd):
|
||||
return ["set -o pipefail;"] + cmd + ["2>&1", '|', 'tee', self.log]
|
||||
|
||||
@property
|
||||
def log(self):
|
||||
return os.path.join(BaseDir, self.__log__)
|
||||
|
||||
|
||||
# Run SynoBuild/SynoInstall in chroot
|
||||
class ChrootRunner(CommandRunner):
|
||||
def __init__(self, package, env_config, print_log=False):
|
||||
CommandRunner.__init__(self, package, env_config)
|
||||
self.print_log = print_log
|
||||
self.__log__ = None
|
||||
|
||||
def _process_output(self, output):
|
||||
msg = []
|
||||
log_file = []
|
||||
|
||||
for platform, failed_projs in output.items():
|
||||
if not failed_projs:
|
||||
continue
|
||||
|
||||
if self.print_log:
|
||||
self._dump_log(platform)
|
||||
|
||||
msg.append(self.__error_msg__ + ' [%s] : %s' % (platform, " ".join(failed_projs)))
|
||||
log_file.append("Error log: " + self.get_platform_log(platform))
|
||||
|
||||
if msg:
|
||||
show_msg_block(msg + log_file, title=self.__error_msg__, error=True)
|
||||
raise self.__failed_exception__(self.__error_msg__)
|
||||
|
||||
def _dump_log(self, platform):
|
||||
log = self.get_platform_log(platform)
|
||||
with open(log, 'r') as fd:
|
||||
show_msg_block(fd.read().split("\n"), title=log, error=True)
|
||||
|
||||
def get_platform_log(self, platform):
|
||||
return os.path.join(self.env_config.get_chroot(platform), self.log)
|
||||
|
||||
def run_command(self, platform, *argv):
|
||||
cmd = self._wrap_cmd(self._get_command(platform, *argv))
|
||||
|
||||
with Chroot(self.env_config.get_chroot(platform)):
|
||||
self._rename_log()
|
||||
try:
|
||||
print("[%s] " % platform + " ".join(cmd))
|
||||
with open(os.devnull, 'wb') as null:
|
||||
check_call(" ".join(cmd), stdout=null, shell=True, executable='/bin/bash')
|
||||
except CalledProcessError:
|
||||
failed_projs = self.__get_failed_projects()
|
||||
if not failed_projs:
|
||||
raise self.__failed_exception__("%s failed. \n Error log: %s"
|
||||
% (" ".join(cmd), self.get_platform_log(platform)))
|
||||
return failed_projs
|
||||
|
||||
def __get_failed_projects(self):
|
||||
projects = []
|
||||
with open(self.log, 'r') as fd:
|
||||
for line in fd:
|
||||
if 'Error(s) occurred on project' not in line:
|
||||
continue
|
||||
projects.append(line.split('"')[1])
|
||||
|
||||
return projects
|
||||
|
||||
def _run(self):
|
||||
return doPlatformParallel(self.run_command, self.env_config.platforms)
|
||||
|
||||
@property
|
||||
def log(self):
|
||||
raise PkgCreateError("Not implemented")
|
||||
|
||||
|
||||
class PackageBuilder(ChrootRunner):
|
||||
title = "Build Package"
|
||||
log = "logs.build"
|
||||
__error_msg__ = "Failed to build package."
|
||||
__failed_exception__ = BuildPackageError
|
||||
|
||||
def __init__(self, package, env_config, sdk_ver, build_opt, *argv, **kwargs):
|
||||
ChrootRunner.__init__(self, package, env_config, *argv, **kwargs)
|
||||
self.build_opt = build_opt
|
||||
self.sdk_ver = sdk_ver
|
||||
|
||||
def _get_command(self, platform):
|
||||
build_script = os.path.join(PkgScripts, 'SynoBuild')
|
||||
projects = self.package.get_build_projects(platform)
|
||||
|
||||
build_cmd = ['env', 'PackageName=' + self.package.name, build_script, '--' + platform,
|
||||
'-c', '--min-sdk', self.sdk_ver]
|
||||
if self.build_opt:
|
||||
build_cmd.append(self.build_opt)
|
||||
|
||||
return build_cmd + list(projects)
|
||||
|
||||
|
||||
class PackageInstaller(ChrootRunner):
|
||||
title = "Install Package"
|
||||
log = "logs.install"
|
||||
__error_msg__ = "Failed to install package."
|
||||
__failed_exception__ = InstallPacageError
|
||||
|
||||
def __init__(self, package, env_config, install_opt, print_log):
|
||||
ChrootRunner.__init__(self, package, env_config, print_log)
|
||||
self.install_opt = list(install_opt)
|
||||
|
||||
def _get_command(self, platform):
|
||||
cmd = ['env', 'PackageName=' + self.package.name, os.path.join(PkgScripts, 'SynoInstall')]
|
||||
if self.install_opt:
|
||||
cmd += self.install_opt
|
||||
|
||||
return cmd + [self.package.name]
|
||||
|
||||
|
||||
class Package():
|
||||
def __init__(self, package):
|
||||
self.name = package
|
||||
self.package_proj = BuildEnv.Project(self.name)
|
||||
self.dict_projects = dict()
|
||||
self.__additional_build = defaultdict(list)
|
||||
self.__spk_config = None
|
||||
self.__chroot = None
|
||||
|
||||
def get_additional_build_projs(self, platform):
|
||||
if platform in self.__additional_build:
|
||||
return set(self.__additional_build[platform])
|
||||
return set()
|
||||
|
||||
def add_additional_build_projs(self, platform, projs):
|
||||
self.__additional_build[platform] += projs
|
||||
|
||||
@property
|
||||
def ref_projs(self):
|
||||
return self.dict_projects['refs'] | self.dict_projects['refTags']
|
||||
|
||||
def get_build_projects(self, platform):
|
||||
return self.dict_projects['branches'] | self.get_additional_build_projs(platform)
|
||||
|
||||
@property
|
||||
def spk_config(self):
|
||||
if not self.__spk_config:
|
||||
self.__spk_config = SpkConfig(self.name, self.info, self.settings)
|
||||
|
||||
return self.__spk_config
|
||||
|
||||
@property
|
||||
def info(self):
|
||||
return self.package_proj.info(self.chroot)
|
||||
|
||||
@property
|
||||
def settings(self):
|
||||
return self.package_proj.settings(self.chroot)
|
||||
|
||||
@property
|
||||
def collect(self):
|
||||
return self.package_proj.collect(self.chroot)
|
||||
|
||||
@property
|
||||
def chroot(self):
|
||||
return self.__chroot
|
||||
|
||||
@chroot.setter
|
||||
def chroot(self, chroot):
|
||||
self.__chroot = chroot
|
||||
|
||||
|
||||
class SpkConfig:
|
||||
def __init__(self, name, info, settings):
|
||||
self.info = config_parser.KeyValueParser(info)
|
||||
try:
|
||||
self.settings = config_parser.PackageSettingParser(settings).get_section(name)
|
||||
except config_parser.ConfigNotFoundError:
|
||||
self.settings = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self.settings and "pkg_name" in self.settings:
|
||||
return self.settings["pkg_name"][0]
|
||||
|
||||
return self.info['package']
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
return self.info['version']
|
||||
|
||||
@property
|
||||
def build_num(self):
|
||||
try:
|
||||
return self.version.split("-")[-1]
|
||||
except IndexError:
|
||||
return self.version
|
||||
|
||||
@property
|
||||
def spk_pattern(self):
|
||||
return self.name + '*' + self.version + '*spk'
|
||||
|
||||
def chroot_packages_dir(self, chroot):
|
||||
return os.path.join(chroot, 'image', 'packages')
|
||||
|
||||
def chroot_spks(self, chroot):
|
||||
return glob.glob(os.path.join(self.chroot_packages_dir(chroot), self.spk_pattern))
|
||||
|
||||
def spk_result_dir(self, suffix=""):
|
||||
if suffix:
|
||||
suffix = '-' + suffix
|
||||
|
||||
return os.path.join(BaseDir, 'result_spk' + suffix, self.name + '-' + self.version)
|
||||
|
||||
|
||||
class EnvConfig():
|
||||
def __init__(self, package, env_section, version, platforms, dep_level, branch, suffix):
|
||||
self.dict_env = getBaseEnvironment(package, env_section, version)
|
||||
self.suffix = suffix
|
||||
self.env_section = env_section
|
||||
self.env_version = version
|
||||
self.dep_level = dep_level
|
||||
self.branch = branch
|
||||
self.platforms = set(self.__get_package_platforms(platforms))
|
||||
self.toolkit_versions = self.__resolve_toolkit_versions()
|
||||
|
||||
if not self.platforms:
|
||||
raise PkgCreateError("No platform found!")
|
||||
|
||||
def __get_package_platforms(self, platforms):
|
||||
def __get_toolkit_available_platforms(version):
|
||||
toolkit_config = os.path.join(ScriptDir, 'include', 'toolkit.config')
|
||||
major, minor = version.split('.')
|
||||
pattern = '$AvailablePlatform_%s_%s' % (major, minor)
|
||||
return check_output('source %s && echo %s' % (toolkit_config, pattern),
|
||||
shell=True, executable='/bin/bash').decode().split()
|
||||
|
||||
package_platforms = set()
|
||||
for platform in self.dict_env:
|
||||
if platform == 'all':
|
||||
package_platforms |= set(__get_toolkit_available_platforms(self.dict_env['all']))
|
||||
else:
|
||||
package_platforms.add(platform)
|
||||
|
||||
if platforms:
|
||||
package_platforms = set(package_platforms) & set(platforms)
|
||||
|
||||
# remove platform if dir not exist
|
||||
return [platform for platform in package_platforms if os.path.isdir(self.get_chroot(platform))]
|
||||
|
||||
def __get_version(self, platform):
|
||||
if platform in self.dict_env:
|
||||
version = self.dict_env[platform]
|
||||
elif 'all' in self.dict_env:
|
||||
version = self.dict_env['all']
|
||||
else:
|
||||
raise PkgCreateError("Package version not found")
|
||||
|
||||
return version
|
||||
|
||||
def get_version_map_file(self, platform):
|
||||
return os.path.join(self.get_chroot(platform), 'version_map')
|
||||
|
||||
def get_chroot(self, platform=None):
|
||||
if not platform:
|
||||
platform = list(self.platforms)[0]
|
||||
|
||||
return BuildEnv.getChrootSynoBase(platform, self.__get_version(platform), self.suffix)
|
||||
|
||||
def __resolve_toolkit_versions(self):
|
||||
def __get_toolkit_version(version_file):
|
||||
version = VersionFile(version_file)
|
||||
return "%s-%s" % (version.dsm_version, version.buildnumber)
|
||||
|
||||
versions = defaultdict(list)
|
||||
for platform in self.platforms:
|
||||
toolkit_version = __get_toolkit_version(self.__get_version_file(platform))
|
||||
versions[toolkit_version].append(platform)
|
||||
|
||||
if len(versions) > 1:
|
||||
msg = []
|
||||
for version, platforms in versions.items():
|
||||
msg.append("[%s]: %s" % (version, " ".join(platforms)))
|
||||
show_msg_block(msg, title="[WARNING] Multiple toolkit version found", error=True)
|
||||
|
||||
return versions
|
||||
|
||||
def __get_version_file(self, platform):
|
||||
return os.path.join(self.get_chroot(platform), 'PkgVersion')
|
||||
|
||||
def get_chroot_synodebug(self, platform):
|
||||
return os.path.join(self.get_chroot(platform), 'image', 'synodebug')
|
||||
|
||||
@property
|
||||
def prebuild_projects(self):
|
||||
return BuildEnv.getList('PreBuildProjects') or []
|
||||
|
||||
|
||||
class PackagePacker:
|
||||
def __init__(self):
|
||||
self.__workers = []
|
||||
|
||||
def add_worker(self, worker):
|
||||
self.__workers.append(worker)
|
||||
|
||||
def pack_package(self):
|
||||
for worker in self.__workers:
|
||||
worker.execute()
|
||||
|
||||
def show_time_cost(self):
|
||||
time_cost = []
|
||||
for worker in self.__workers:
|
||||
time_cost += worker.get_time_cost()
|
||||
|
||||
show_msg_block(time_cost, title="Time Cost Statistic")
|
||||
|
||||
|
||||
def getBaseEnvironment(proj, env, ver=None):
|
||||
dict_env = {}
|
||||
if ver:
|
||||
dict_env['all'] = ver
|
||||
return dict_env
|
||||
|
||||
if not env:
|
||||
env = 'default'
|
||||
|
||||
depends = config_parser.DependsParser(BuildEnv.Project(proj).depends_script)
|
||||
dict_env = depends.get_env_section(env)
|
||||
return dict_env
|
||||
|
||||
|
||||
def main(argv):
|
||||
args = args_parser(argv)
|
||||
packer = PackagePacker()
|
||||
|
||||
packer = PackagePacker(args.package)
|
||||
worker_factory = WorkerFactory(args)
|
||||
new_worker = worker_factory.new
|
||||
|
||||
prepare_worker = new_worker(EnvPrepareWorker, args.update)
|
||||
prepare_worker = new_worker(EnvPrepareWorker, None, None)
|
||||
prepare_worker.add_subworker(new_worker(ProjectTraverser))
|
||||
if args.link:
|
||||
prepare_worker.add_subworker(new_worker(ProjectLinker))
|
||||
packer.add_worker(prepare_worker)
|
||||
|
||||
packer.register_worker(prepare_worker)
|
||||
|
||||
if args.build:
|
||||
packer.add_worker(new_worker(PackageBuilder, args.sdk_ver, args.build_opt, args.print_log))
|
||||
packer.register_worker(new_worker(
|
||||
PreBuilder, None, args.sdk_ver, args.build_opt, args.print_log))
|
||||
packer.register_worker(new_worker(
|
||||
PackageBuilder, None, args.sdk_ver, args.build_opt, args.print_log))
|
||||
packer.register_worker(new_worker(
|
||||
PostBuilder, None, args.sdk_ver, args.build_opt, args.print_log))
|
||||
|
||||
if args.install:
|
||||
packer.add_worker(new_worker(PackageInstaller,
|
||||
install_opt=[args.install_opt, '--with-debug'],
|
||||
print_log=args.print_log))
|
||||
packer.add_worker(new_worker(PackageInstaller,
|
||||
install_opt=[args.install_opt],
|
||||
print_log=args.print_log))
|
||||
packer.register_worker(new_worker(
|
||||
PreInstaller, args.install_opt, args.print_log))
|
||||
packer.register_worker(new_worker(PackageInstaller,
|
||||
install_opt=[
|
||||
args.install_opt, '--with-debug'],
|
||||
print_log=args.print_log))
|
||||
packer.register_worker(new_worker(PackageInstaller,
|
||||
install_opt=[args.install_opt],
|
||||
print_log=args.print_log))
|
||||
packer.register_worker(new_worker(
|
||||
PostInstaller, args.install_opt, args.print_log))
|
||||
|
||||
if args.collect:
|
||||
if args.sign:
|
||||
packer.add_worker(new_worker(CodeSignWorker))
|
||||
|
||||
packer.add_worker(new_worker(PackageCollecter))
|
||||
if args.collecter:
|
||||
packer.register_worker(new_worker(PreCollecter))
|
||||
packer.register_worker(new_worker(PackageCollecter))
|
||||
packer.register_worker(new_worker(PostCollecter))
|
||||
|
||||
packer.pack_package()
|
||||
packer.show_time_cost()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ret = 0
|
||||
try:
|
||||
main(sys.argv[1:])
|
||||
print("[SUCCESS] " + " ".join(sys.argv) + " finished.")
|
||||
logger.info("[SUCCESS] " + " ".join(sys.argv) + " finished.")
|
||||
except PkgCreateError as e:
|
||||
ret = 1
|
||||
print("\n\033[91m%s:\033[0m" % type(e).__name__)
|
||||
print(str(e))
|
||||
print("\n[ERROR] " + " ".join(sys.argv) + " failed!")
|
||||
logger.debug("".join(traceback.format_tb(sys.exc_info()[2])))
|
||||
logger.error(" ".join(sys.argv) + " failed!")
|
||||
raise e
|
||||
|
||||
sys.exit(ret)
|
||||
|
@ -1,18 +1,22 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import sys
|
||||
import string
|
||||
import os
|
||||
import glob
|
||||
import argparse
|
||||
import pickle
|
||||
import pprint
|
||||
from collections import defaultdict
|
||||
import re
|
||||
|
||||
ScriptDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
sys.path.append(ScriptDir + '/include')
|
||||
sys.path.append(ScriptDir + '/include/python')
|
||||
import BuildEnv
|
||||
from include import pythonutils
|
||||
from include.python import BuildEnv
|
||||
from config_parser import DependsParser, ProjectDependsParser
|
||||
ScriptDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
|
||||
# XXX: unified the variable with pythonutils.py
|
||||
# config file, to get basic project parameters
|
||||
section_depends = "project dependency"
|
||||
section_variables = "variables"
|
||||
@ -42,64 +46,135 @@ class DependencyError(Exception):
|
||||
print(self.project)
|
||||
|
||||
|
||||
class ProjectNode:
|
||||
def __init__(self, proj):
|
||||
# FIXME name
|
||||
self.proj = proj
|
||||
self.depends = []
|
||||
self.rev_depends = []
|
||||
self.levels = defaultdict(set)
|
||||
self.addProject(1, [self.proj])
|
||||
self.success = False
|
||||
self.visited = False
|
||||
|
||||
def updateDependLevel(self, child_node):
|
||||
for level, projs in child_node.levels.items():
|
||||
self.addProject(level + 1, projs)
|
||||
|
||||
def addProject(self, level, projs):
|
||||
self.levels[level].update(projs)
|
||||
|
||||
def addDependProj(self, child_node):
|
||||
self.depends.append(child_node)
|
||||
child_node.rev_depends.append(self)
|
||||
self.updateDependLevel(child_node)
|
||||
|
||||
def getProjectOrder(self):
|
||||
orders = []
|
||||
for level, projs in sorted(self.levels.items(), key=lambda x: x[0], reverse=True):
|
||||
for proj in projs:
|
||||
if proj not in orders:
|
||||
orders.append(proj)
|
||||
return orders
|
||||
|
||||
def update_status(self, success):
|
||||
self.visited = True
|
||||
self.success = success
|
||||
|
||||
def getProjectDepends(self, level):
|
||||
order = self.getProjectOrder()
|
||||
if level == 0:
|
||||
return order
|
||||
else:
|
||||
return sorted(self.getLevelsProjects(1, level), key=lambda x: order.index(x))
|
||||
|
||||
def getLevelsProjects(self, low, high):
|
||||
output = set()
|
||||
|
||||
for i in range(low, high + 1):
|
||||
output.update(self.levels[i])
|
||||
|
||||
return output
|
||||
|
||||
def __repr__(self):
|
||||
return self.proj
|
||||
|
||||
|
||||
class DepGraph:
|
||||
# all these attributes are not necessary, just for prototype reference
|
||||
def __init__(self, dictIn, level, direct):
|
||||
self.dict = dictIn
|
||||
def __init__(self, dictDepends, direct):
|
||||
self.root = ProjectNode('DependRoot')
|
||||
self.root.update_status(True)
|
||||
self.direct = direct
|
||||
self.stack = []
|
||||
self.listOut = []
|
||||
self.level = level
|
||||
self.visited = {}
|
||||
self.graph = {}
|
||||
self.dictDepends = dictDepends
|
||||
self.reverseDep = defaultdict(list)
|
||||
self.created_projects = {}
|
||||
|
||||
def traveseList(self, listProjs, t_level):
|
||||
if self.level != 0 and t_level >= self.level:
|
||||
return
|
||||
def getProjectNode(self, proj):
|
||||
if proj not in self.created_projects:
|
||||
raise RuntimeError("%s not created." % proj)
|
||||
return self.created_projects[proj]
|
||||
|
||||
def createDepGraph(self, head, listProjs):
|
||||
for proj in listProjs:
|
||||
if proj in self.stack:
|
||||
raise DependencyError(self.stack, proj)
|
||||
if proj in self.visited and t_level >= self.visited[proj]:
|
||||
continue
|
||||
self.stack.append(proj)
|
||||
|
||||
self.visited[proj] = t_level
|
||||
if proj in self.created_projects:
|
||||
proj_node = self.created_projects[proj]
|
||||
else:
|
||||
proj_node = self.created_projects[proj] = ProjectNode(proj)
|
||||
|
||||
depProj = self.getDepProjList(proj)
|
||||
if len(depProj) > 0:
|
||||
self.traveseList(depProj, t_level+1)
|
||||
depProj = self.getDepProjList(proj)
|
||||
if len(depProj) > 0:
|
||||
self.createDepGraph(proj_node, depProj)
|
||||
|
||||
if proj not in self.listOut:
|
||||
self.listOut.append(proj)
|
||||
head.addDependProj(proj_node)
|
||||
|
||||
self.stack.pop()
|
||||
|
||||
def traverseDepends(self, listProjs):
|
||||
def dumpGraph(self, head):
|
||||
print(head.proj)
|
||||
pprint.pprint(head.levels)
|
||||
for p in head.depends:
|
||||
self.dumpGraph(p)
|
||||
|
||||
def traverseDepends(self, listProjs, level):
|
||||
try:
|
||||
self.traveseList(listProjs, 0)
|
||||
self.createDepGraph(self.root, listProjs)
|
||||
# self.dumpGraph(self.root)
|
||||
except DependencyError as e:
|
||||
e.dumpCircluarDepList()
|
||||
sys.exit(1)
|
||||
return self.listOut
|
||||
|
||||
def getReverseList(self, proj, traveseDict):
|
||||
reverseList = []
|
||||
for key in traveseDict.keys():
|
||||
if proj in traveseDict[key]:
|
||||
reverseList.append(key)
|
||||
return reverseList
|
||||
output = []
|
||||
t_level = level if level == 0 else level + 1
|
||||
output = self.root.getProjectDepends(t_level)
|
||||
output.remove(self.root.proj)
|
||||
|
||||
if self.direct == 'backwardDependency':
|
||||
output.reverse()
|
||||
|
||||
return output
|
||||
|
||||
def getReverseDep(self, proj):
|
||||
return self.getReverseList(proj, self.dict)
|
||||
reverseList = []
|
||||
if proj in self.reverseDep:
|
||||
return self.reverseDep[proj]
|
||||
|
||||
def getTraverseList(self, proj, Dict):
|
||||
if proj in Dict:
|
||||
return Dict[proj]
|
||||
return []
|
||||
for key in self.dictDepends.keys():
|
||||
if proj in self.dictDepends[key]:
|
||||
reverseList.append(key)
|
||||
self.reverseDep[proj] = reverseList
|
||||
|
||||
return reverseList
|
||||
|
||||
def getTraverseDep(self, proj):
|
||||
return self.getTraverseList(proj, self.dict)
|
||||
if proj in self.dictDepends:
|
||||
return self.dictDepends[proj]
|
||||
return []
|
||||
|
||||
def getDepProjList(self, proj):
|
||||
# -r : Expand project dependency list reversely.
|
||||
@ -205,22 +280,38 @@ def replaceVariableInDictSection(dictDepends, variable, projsToReplace):
|
||||
listDepProj.remove(variable)
|
||||
|
||||
|
||||
def is64BitPlatform(platform):
|
||||
listPlatform64 = ['x64', 'bromolow', 'cedarview', 'avoton',
|
||||
'bromolowESM', 'baytrail', 'dockerx64']
|
||||
if platform in listPlatform64:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
# Replace ${XXXX} in dependency list by [${XXXX}] section
|
||||
def replacePlatformDependsVariable(dictDepends, platforms, config):
|
||||
def replaceVariableWithSection(variable, section_name):
|
||||
try:
|
||||
dictSection = config.get_section_dict(section_name)
|
||||
except KeyError:
|
||||
print("No such section:" + variable)
|
||||
|
||||
listPlatformDependsProj = findPlatformDependsProj(dictSection, platforms)
|
||||
replaceVariableInDictSection(dictDepends, variable, listPlatformDependsProj)
|
||||
|
||||
if not config.dynamic_variables:
|
||||
# for old project depends compatibility
|
||||
replaceVariableWithSection("${KernelProjs}", pythonutils.SECTION_KERNEL_OLD)
|
||||
return
|
||||
for variable in config.dynamic_variables:
|
||||
replaceVariableWithSection(variable, variable)
|
||||
|
||||
|
||||
def ParseArgs():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-d', dest='display', action='store_true', help='Display (deprecated)')
|
||||
parser.add_argument('-p', dest='platform', type=str, help='Platform')
|
||||
parser.add_argument('-r', dest='r_level', type=int, default=-1, help='Reverse depenedency traverse level')
|
||||
parser.add_argument('-x', dest='level', type=int, default=-1, help="Traverse level")
|
||||
parser.add_argument('-r', dest='r_level', type=int, default=-1, help='Reverse depenedency traverse level')
|
||||
parser.add_argument('-x', dest='level', type=int, default=-1, help="Traverse level")
|
||||
parser.add_argument('--header', dest='dump_header', default=False, action='store_true', help="Output kernel header")
|
||||
parser.add_argument('--dump', dest='dump_pickle', help="Dump project depends graph into pickle file.")
|
||||
|
||||
group = parser.add_argument_group('Cache')
|
||||
group.add_argument('--version', type=int, default=0)
|
||||
group.add_argument('--type', choices=['tag', 'dep', 'both'], default='both')
|
||||
|
||||
parser.add_argument('listProj', nargs='*', type=str, help='Replace project list')
|
||||
return parser.parse_args()
|
||||
|
||||
@ -229,11 +320,14 @@ def loadConfigFiles(config):
|
||||
dictDepends = config.project_depends
|
||||
|
||||
confList = glob.glob(ScriptDir + "/../source/*/SynoBuildConf/depends*")
|
||||
confList = [conf for conf in confList if re.search(r'^depends(-virtual-[-.\w]+)*$', os.path.basename(conf))]
|
||||
for confPath in confList:
|
||||
project = confPath.split('/')[-3]
|
||||
filename = confPath.split('/')[-1]
|
||||
if BuildEnv.isVirtualProject(filename):
|
||||
project = BuildEnv.deVirtual(project) + BuildEnv.VIRTUAL_PROJECT_SEPARATOR + BuildEnv.getVirtualName(filename)
|
||||
project = BuildEnv.deVirtual(project) + \
|
||||
BuildEnv.VIRTUAL_PROJECT_SEPARATOR + \
|
||||
BuildEnv.getVirtualName(filename)
|
||||
|
||||
if os.path.isfile(confPath):
|
||||
depends = DependsParser(confPath)
|
||||
@ -244,6 +338,7 @@ def loadConfigFiles(config):
|
||||
|
||||
return dictDepends
|
||||
|
||||
|
||||
# main procedure
|
||||
if __name__ == "__main__":
|
||||
# get command line arguments
|
||||
@ -258,10 +353,11 @@ if __name__ == "__main__":
|
||||
|
||||
dictArgs = ParseArgs()
|
||||
|
||||
if dictArgs.level >= 0 and dictArgs.r_level >= 0:
|
||||
raise RuntimeError("Error! x and r can not use simultaneously")
|
||||
if dictArgs.platform:
|
||||
platforms = dictArgs.platform.strip().split(" ")
|
||||
|
||||
if dictArgs.level >= 0 and dictArgs.r_level >= 0:
|
||||
raise RuntimeError("Error! x and r can not use simultaneously")
|
||||
if dictArgs.level >= 0:
|
||||
level = dictArgs.level
|
||||
elif dictArgs.r_level >= 0:
|
||||
@ -283,8 +379,15 @@ if __name__ == "__main__":
|
||||
dictDepGraph = {}
|
||||
blAddKernelHeader, normalizedProjList = normalizeProjects(listProjs, config, kernels)
|
||||
replaceVariableSection(config, dictDepends)
|
||||
depGraph = DepGraph(dictDepends, level, direct)
|
||||
listOut = depGraph.traverseDepends(normalizedProjList)
|
||||
replacePlatformDependsVariable(dictDepends, platforms, config)
|
||||
|
||||
depGraph = DepGraph(dictDepends, direct)
|
||||
listOut = depGraph.traverseDepends(normalizedProjList, level)
|
||||
if dictArgs.dump_pickle:
|
||||
sys.setrecursionlimit(3000)
|
||||
with open(dictArgs.dump_pickle, 'wb') as fd:
|
||||
pickle.dump(depGraph, fd)
|
||||
sys.exit(0)
|
||||
|
||||
# reorder need filter while args not contain 'x' and 'r'
|
||||
if dictArgs.level == -1 and dictArgs.r_level == -1:
|
||||
|
46
README.md
46
README.md
@ -1,46 +0,0 @@
|
||||
# Synology package toolkit framework
|
||||
|
||||
## Prepare Build Environment
|
||||
You can download and set up pre-built environments by using **EnvDeploy** as follows. Use -v to specify DSM version and -p to specify desired platform.
|
||||
If -p is not given, all available platforms for given version will be set up.
|
||||
|
||||
```
|
||||
cd /toolkit/pkgscripts
|
||||
./EnvDeploy -v 6.1 -p x64 # for example
|
||||
```
|
||||
|
||||
Finally, the whole working directory will look like the following figure,
|
||||
and **ds.x64-6.1** is the chroot environment to build your own projects.
|
||||
|
||||
```
|
||||
toolkit/
|
||||
├── pkgscripts/
|
||||
└── build_env/
|
||||
├── ds.x64-6.1/
|
||||
├── ...
|
||||
└── ds.x64-6.1/
|
||||
|
||||
```
|
||||
|
||||
### Available Platforms
|
||||
You can use one of following commands to show available platforms. If -v is not given, available platforms for all versions are listed.
|
||||
|
||||
```
|
||||
./EnvDeploy -v 6.1 --list
|
||||
./EnvDeploy -v 6.1 --info platform
|
||||
```
|
||||
|
||||
### Update Environment
|
||||
Use EnvDeploy again to update your environments. For example, update x64 for DSM {{ book.ToolkitVersion }} by running the following command.
|
||||
```
|
||||
./EnvDeploy -v 6.1 -p x64
|
||||
```
|
||||
|
||||
### Remove Environment
|
||||
Removing a building environment is very easy. First chroot to the building environment, umount the **/proc** folder and exit chroot.
|
||||
After that, remove the building environment folder. The following command illustrates how to remove a building environment with version 5.2 and platform x64.
|
||||
|
||||
```
|
||||
chroot /toolkit/build_env/ds.x64-6.1 umount /proc
|
||||
rm -rf /toolkit/build_env/ds.x64-6.1
|
||||
```
|
178
SynoBuild
178
SynoBuild
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
LANG=""
|
||||
LC_ALL=""
|
||||
@ -22,9 +22,11 @@ Options
|
||||
-C, --cleanonly
|
||||
Cleanup only and exit.
|
||||
-j, --jobs {num}
|
||||
Specify how many jobs to build in parallel. Default is 4.
|
||||
Specify how many jobs to build in parallel. Default is numb of CPUs.
|
||||
-J Disable parallel build.
|
||||
-S Disable silent make.
|
||||
--parallel {N}
|
||||
parallel build projects with N parallel job.
|
||||
-x {level}
|
||||
Build all dependant projects. Can specify level of dependency.
|
||||
Expand project dependency list, and build them in turn.
|
||||
@ -50,98 +52,126 @@ Options
|
||||
EOF
|
||||
}
|
||||
|
||||
GetBaseSDKVersion() {
|
||||
local bringupMajor=
|
||||
local bringupMinor=
|
||||
|
||||
if [ -n "$BRINGUP_VERSION" ]; then
|
||||
bringupMajor=$(echo $BRINGUP_VERSION | cut -d. -f1)
|
||||
bringupMinor=$(echo $BRINGUP_VERSION | cut -d. -f2)
|
||||
if [ -n "$bringupMajor" -a -n "$bringupMinor" -a "$bringupMajor" = "$DSM_SHLIB_MAJOR" ]; then
|
||||
echo "$BRINGUP_VERSION"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$DSM_SHLIB_MAJOR.0"
|
||||
}
|
||||
|
||||
AppendSynoXtraCflags(){
|
||||
local baseSDKVersion=$(GetBaseSDKVersion)
|
||||
SYNO_XTRACFLAGS="-g"
|
||||
}
|
||||
|
||||
ParseExtArgs() {
|
||||
while [ -n "$1" ]; do # {{{
|
||||
case "$1" in
|
||||
"--no-builtin")
|
||||
IgnoreBuiltin="No"
|
||||
;;
|
||||
"--dont-remove-deb")
|
||||
DontRemoveDeb="Y"
|
||||
;;
|
||||
"--min-sdk")
|
||||
MinSdkVersion="$2"
|
||||
shift
|
||||
;;
|
||||
"--enable-apt")
|
||||
ENABLE_APT="yes"
|
||||
;;
|
||||
*)
|
||||
ERROR "Unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ -z "$BUILD_OPT" ]; then
|
||||
# call again without parameters
|
||||
# to prompt user interactively
|
||||
AskPlatform
|
||||
fi
|
||||
}
|
||||
|
||||
CollectBuiltinProjs(){
|
||||
local builtinProjs=
|
||||
# Resolve built-in projects
|
||||
|
||||
if [ "$IgnoreBuiltin" = "Yes" -a -f "$ExcludeListFile" ]; then
|
||||
ForceBuildProjects="`cat $ExcludeListFile | sed 's/ /|/g'`"
|
||||
builtinProjs="`echo "$BuiltinProjects" | sed 's/ /\n/g' | grep -vE "$ForceBuildProjects"`"
|
||||
fi
|
||||
echo "$builtinProjs"
|
||||
SYNO_XTRACFLAGS="$SYNO_XTRACFLAGS -D`ResolveMinSdkMacro ${MinSdkVersion:-$baseSDKVersion}`"
|
||||
}
|
||||
|
||||
Source "include/config"
|
||||
Source "include/build"
|
||||
|
||||
IgnoreBuiltin="Yes"
|
||||
MakeClean="Yes"
|
||||
ExcludeListFile="/seen_curr.list"
|
||||
ARGS=`getopt -u -l "$BuildDefaultLongArgs,dont-remove-deb,min-sdk:,no-builtin,enable-apt" $BuildDefaultArgs $@`
|
||||
DoBuild() {
|
||||
local ThisProj=$1
|
||||
local logFile="$LogDir/${ThisProj}.build"
|
||||
[ -f "$logFile" ] && mv -f $logFile $logFile.old
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
Usage
|
||||
exit 1
|
||||
fi
|
||||
set -- $ARGS
|
||||
(
|
||||
INFO "Start to build ${ThisProj}."
|
||||
Date0=`date +%s`
|
||||
SetupBuildProjEnv $ThisProj
|
||||
BuildProject $ThisProj
|
||||
Date1=`date +%s`
|
||||
ShowTimeCost $Date0 $Date1 "Build-->$ThisProj"
|
||||
INFO "Build ${ThisProj} finished!"
|
||||
|
||||
CheckPermission
|
||||
) &> >(tee $logFile)
|
||||
}
|
||||
|
||||
ParallelBuildProjects() {
|
||||
local projects=$@
|
||||
local pickle="/tmp/$$.pickle"
|
||||
local buildProjs failedProjs successProjs blockedList logFile blockedProjs
|
||||
|
||||
if [ -z "$projects" ]; then
|
||||
echo "No projects input."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "${ScriptsDir}/ProjectDepends.py --dump $pickle ${DEP_OPT} ${BUILD_DEP_LEVEL} -p ${PLATFORM_ABBR} $projects"
|
||||
${ScriptsDir}/ProjectDepends.py --dump $pickle ${DEP_OPT} ${BUILD_DEP_LEVEL} -p "${PLATFORM_ABBR}" $projects
|
||||
echo "${ScriptsDir}/ParallelProjects.py --init $pickle ${DEP_OPT} $projects"
|
||||
${ScriptsDir}/ParallelProjects.py --init $pickle ${DEP_OPT} $projects
|
||||
|
||||
while true; do
|
||||
buildProjs=$(${ScriptsDir}/ParallelProjects.py --next -c "$ProcessCount" $successProjs)
|
||||
if [ "NULL" = "$buildProjs" ]; then
|
||||
echo "Done."
|
||||
break
|
||||
fi
|
||||
|
||||
for ThisProj in $buildProjs; do
|
||||
DoBuild $ThisProj >/dev/null &
|
||||
echo "[Building] $ThisProj"
|
||||
done
|
||||
wait
|
||||
|
||||
successProjs=
|
||||
failedProjs=
|
||||
for proj in $buildProjs; do
|
||||
if CheckProjectStatus build $proj > /dev/null; then
|
||||
successProjs="$successProjs $proj"
|
||||
echo "[Success] $proj"
|
||||
else
|
||||
failedProjs="$failedProjs $proj"
|
||||
echo "[Failed] $proj"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$failedProjs" ]; then
|
||||
blockedList=$(${ScriptsDir}/ParallelProjects.py --failed $failedProjs)
|
||||
for block in $blockedList; do
|
||||
proj=$(echo $block | cut -d: -f1)
|
||||
blockedProjs=$(echo $block | cut -d: -f2 | sed 's/,/ /g')
|
||||
for blockProj in $blockedProjs; do
|
||||
logFile="$LogDir/${blockProj}.build"
|
||||
[ -f "$logFile" ] && mv -f $logFile ${logFile}.old
|
||||
echo "[Blocked] $blockProj is blocked due to $proj build failed." | tee $logFile
|
||||
done
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
${ScriptsDir}/ParallelProjects.py --purge
|
||||
rm $pickle
|
||||
}
|
||||
|
||||
main() {
|
||||
local projectList=
|
||||
local logFile=
|
||||
local builtinProjs=
|
||||
|
||||
ParseBuildDefaultArgs "$@"
|
||||
ParseExtArgs $UnHandledOpt
|
||||
CheckPermission
|
||||
ParseArgs "$@"
|
||||
|
||||
# Setup build environment
|
||||
SetupBuildEnv AppendSynoXtraCflags
|
||||
|
||||
projectList=$(NormalizeBuildProjects $InputProjs)
|
||||
INFO "" "projectList=\"$projectList\""
|
||||
builtinProjs=$(CollectBuiltinProjs)
|
||||
projectList=$(GetBuildProjList)
|
||||
|
||||
for ThisProj in $projectList; do
|
||||
logFile="$LogDir/${ThisProj}.build"
|
||||
[ -f "$logFile" ] && mv -f $logFile $logFile.old
|
||||
INFO "projectList=\"$projectList\""
|
||||
|
||||
(
|
||||
INFO "Start to build ${ThisProj}."
|
||||
Date0=`date +%s`
|
||||
SetupBuildProjEnv $ThisProj
|
||||
BuildProject $ThisProj
|
||||
Date1=`date +%s`
|
||||
ShowTimeCost $Date0 $Date1 "Build-->$ThisProj"
|
||||
INFO "Build ${ThisProj} finished!"
|
||||
|
||||
) &> >(tee $logFile)
|
||||
|
||||
done
|
||||
if $Parallel && [ "$(wc -w <<< "$projectList")" -gt 1 ]; then
|
||||
ParallelBuildProjects ${projectList}
|
||||
else
|
||||
for ThisProj in $projectList; do
|
||||
DoBuild "$ThisProj"
|
||||
done
|
||||
fi
|
||||
|
||||
CheckTimeCostLog build $projectList
|
||||
if ! CheckErrorLog build $projectList; then
|
||||
@ -150,4 +180,4 @@ main() {
|
||||
return 0
|
||||
}
|
||||
|
||||
main $@
|
||||
main "$@"
|
||||
|
123
SynoCustomize
Executable file
123
SynoCustomize
Executable file
@ -0,0 +1,123 @@
|
||||
#! /bin/bash
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
PackageBuilder=true # shellcheck disable=SC2034
|
||||
PackageInstaller=true # shellcheck disable=SC2034
|
||||
PackageCollecter=true # shellcheck disable=SC2034
|
||||
|
||||
CAN_BE_CLOSED="PackageBuilder PackageInstaller PackageCollecter"
|
||||
UNIFORM="PackagePacker WorkerFactory EnvPrepareWorker ProjectTraverser ProjectLinker"
|
||||
CUSTOMIZED="PreBuilder PostBuilder PreInstaller PostInstaller PreCollecter PostCollecter"
|
||||
|
||||
DO_CHECK=false
|
||||
DO_EXECUTE=false
|
||||
|
||||
Usage()
|
||||
{
|
||||
cat << EOF
|
||||
$0 [-c|-e] CUSTOMIZE_FILE STAGE_NAME
|
||||
CUSTOMIZE_FILE the customize file to source
|
||||
STAGE the stage to execute
|
||||
|
||||
Options
|
||||
-c,
|
||||
check if the stage is legal
|
||||
-e,
|
||||
execute the stage
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "ceh" opt; do
|
||||
case "$opt" in
|
||||
c)
|
||||
DO_CHECK=true
|
||||
shift
|
||||
;;
|
||||
e)
|
||||
DO_EXECUTE=true
|
||||
shift
|
||||
;;
|
||||
h)
|
||||
Usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
Usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
CUSTOMIZE_FILE="$1"
|
||||
STAGE_NAME="$2"
|
||||
|
||||
|
||||
if [ -z "$CUSTOMIZE_FILE" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$CUSTOMIZE_FILE" ]; then
|
||||
source "$CUSTOMIZE_FILE"
|
||||
fi
|
||||
|
||||
if [ -z "$STAGE_NAME" ]; then
|
||||
echo "no input stage name"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
CheckStage()
|
||||
{
|
||||
for stage in $CAN_BE_CLOSED; do
|
||||
if [ "$STAGE_NAME" = "$stage" ]; then
|
||||
if "${!STAGE_NAME}"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
for stage in $UNIFORM; do
|
||||
if [ "$STAGE_NAME" = "$stage" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
local is_stage_exist=false
|
||||
for stage in $CUSTOMIZED; do
|
||||
if [ "$STAGE_NAME" = "$stage" ]; then
|
||||
is_stage_exist=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if ! $is_stage_exist; then
|
||||
echo "stage [$STAGE_NAME] does not allowed."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if type "$STAGE_NAME" > /dev/null 2>&1; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
ExecuteStage()
|
||||
{
|
||||
$STAGE_NAME || return 1
|
||||
}
|
||||
|
||||
if $DO_CHECK; then
|
||||
CheckStage || exit 1
|
||||
fi
|
||||
if $DO_EXECUTE; then
|
||||
ExecuteStage || exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
129
SynoInstall
129
SynoInstall
@ -1,11 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
. $(dirname `readlink -f "$0"`)/include/init
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
LANG=""
|
||||
LC_ALL=""
|
||||
|
||||
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/include/init
|
||||
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
|
||||
Source include/install
|
||||
Source include/util
|
||||
|
||||
CheckPermission
|
||||
|
||||
Usage() {
|
||||
cat << EOF
|
||||
|
||||
@ -20,30 +28,16 @@ Options
|
||||
Specify target platform.
|
||||
-d, --with-debug
|
||||
Install binaries with debug symbols.
|
||||
--parallel N
|
||||
Parallel install projects with N processes
|
||||
-h, --help
|
||||
This help message.
|
||||
EOF
|
||||
}
|
||||
|
||||
Source include/install
|
||||
CheckPermission
|
||||
|
||||
ARGS=`getopt -u -l $DefaultLongArgs,enable-apt,single $DefaultArgs $@`
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "You gave me option(s) that I do not know."
|
||||
Usage
|
||||
exit 1
|
||||
fi
|
||||
set -- $ARGS
|
||||
|
||||
|
||||
ParsePkgInstallArgs() {
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
"--enable-apt")
|
||||
ENABLE_APT="yes"
|
||||
;;
|
||||
"--single")
|
||||
# for backward compatibility
|
||||
;;
|
||||
@ -57,8 +51,82 @@ while [ -n "$1" ]; do
|
||||
done
|
||||
}
|
||||
|
||||
InstallProj() {
|
||||
local ThisProj=$1
|
||||
local logFile="${LogDir}/${ThisProj}.install"
|
||||
[ -f "$logFile" ] && mv -f "$logFile" "${logFile}.old"
|
||||
|
||||
(
|
||||
INFO "Start to install ${ThisProj}."
|
||||
rm -rf "$TmpInstDir"/*
|
||||
SetupProjInstallEnv $ThisProj
|
||||
|
||||
InstallProject $ThisProj && CreateTarball $ThisProj
|
||||
|
||||
INFO "Install $ThisProj finished!"
|
||||
|
||||
) &> >(tee $logFile)
|
||||
}
|
||||
|
||||
ParallelInstallProjects() {
|
||||
local projects=$@
|
||||
local pickle="/tmp/$$.pickle"
|
||||
local installProjs doneProjs
|
||||
|
||||
if [ -z "$projects" ]; then
|
||||
echo "No projects input."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "${ScriptsDir}/ProjectDepends.py --dump $pickle -p ${PLATFORM_ABBR} $projects"
|
||||
${ScriptsDir}/ProjectDepends.py --dump $pickle -p "${PLATFORM_ABBR}" $projects
|
||||
echo "${ScriptsDir}/ParallelProjects.py --init $pickle -x $projects"
|
||||
${ScriptsDir}/ParallelProjects.py --init $pickle -x $projects
|
||||
|
||||
while true; do
|
||||
installProjs=$(${ScriptsDir}/ParallelProjects.py --next -c "$ProcessCount" $doneProjs)
|
||||
if [ "NULL" = "$installProjs" ]; then
|
||||
echo "Done."
|
||||
break
|
||||
fi
|
||||
|
||||
for ThisProj in $installProjs; do
|
||||
InstallProj $ThisProj >/dev/null &
|
||||
echo "[Installing] $ThisProj"
|
||||
done
|
||||
wait
|
||||
|
||||
doneProjs=
|
||||
for proj in $installProjs; do
|
||||
doneProjs="$doneProjs $proj"
|
||||
if CheckProjectStatus install $proj > /dev/null; then
|
||||
echo "[Success] $proj"
|
||||
else
|
||||
echo "[Failed] $proj"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
${ScriptsDir}/ParallelProjects.py --purge
|
||||
rm $pickle
|
||||
}
|
||||
|
||||
main() {
|
||||
local projectList=
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
Usage
|
||||
fi
|
||||
|
||||
ARGS=$(getopt -u -l $DefaultLongArgs,single $DefaultArgs $@)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "You gave me option(s) that I do not know."
|
||||
Usage
|
||||
exit 1
|
||||
fi
|
||||
set -- $ARGS
|
||||
|
||||
local logFile=
|
||||
local installFailed=N
|
||||
|
||||
@ -67,23 +135,16 @@ main() {
|
||||
|
||||
SetupInstallEnv "$IsDebugBuild"
|
||||
|
||||
projectList=$(UnifyInstallProjects $InputProjs)
|
||||
projectList=$(NormalizeInstallProjects $InputProjs)
|
||||
INFO "projectList=\"$projectList\""
|
||||
|
||||
for ThisProj in $projectList; do
|
||||
logFile="$LogDir/$ThisProj.install"
|
||||
[ -f "$logFile" ] && mv -f $logFile ${logFile}.old
|
||||
|
||||
(
|
||||
INFO "Start to install ${ThisProj}."
|
||||
SetupProjInstallEnv $ThisProj
|
||||
|
||||
InstallProject $ThisProj && CreateTarball $ThisProj
|
||||
|
||||
INFO "Install $ThisProj finished!"
|
||||
|
||||
) &> >(tee $logFile)
|
||||
done
|
||||
if $Parallel && [ "$(wc -w <<< "$projectList")" -gt 1 ] ; then
|
||||
ParallelInstallProjects $projectList
|
||||
else
|
||||
for ThisProj in $projectList; do
|
||||
InstallProj "$ThisProj"
|
||||
done
|
||||
fi
|
||||
|
||||
if ! CheckErrorLog install $projectList; then
|
||||
return 1;
|
||||
|
0
include/__init__.py
Normal file
0
include/__init__.py
Normal file
50
include/applyEnv
Normal file → Executable file
50
include/applyEnv
Normal file → Executable file
@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_APPLY_ENV__" ]; then
|
||||
__INCLUDE_APPLY_ENV__=defined
|
||||
|
||||
Source "include/check"
|
||||
Source include/check
|
||||
|
||||
FunCreateCCacheWrap() # {{{
|
||||
FunCreateCCacheWrap()
|
||||
{
|
||||
for bin in $*
|
||||
do
|
||||
@ -26,6 +26,7 @@ _ApplyEnvDir() {
|
||||
SynoBinDir="$SynoDir/bin"
|
||||
SynoIncludeDir="$SynoDir/include"
|
||||
SynoShareDir="$SynoDir/share"
|
||||
SynoPluginDir="$SynoDir/plugin"
|
||||
LibDir="/usr/lib"
|
||||
BinDir="/usr/bin"
|
||||
IncludeDir="/usr/include"
|
||||
@ -40,12 +41,10 @@ _ApplyEnvDir() {
|
||||
KSP="$KERNEL_SEARCH_PATH"
|
||||
KSRC="$KERNEL_SEARCH_PATH"
|
||||
KDIR="$KERNEL_SEARCH_PATH"
|
||||
|
||||
}
|
||||
|
||||
_ApplyBuildFlag() {
|
||||
local arch="$1"
|
||||
local phase="`GetBuildPhase $VERSION_FILE`"
|
||||
|
||||
_AssignArch "ToolChainDir" $arch
|
||||
_AssignArch "ToolChainPrefix" $arch
|
||||
@ -62,7 +61,9 @@ _ApplyBuildFlag() {
|
||||
_AssignArch "CXX" $arch
|
||||
_AssignArch "LD" $arch
|
||||
_AssignArch "AR" $arch
|
||||
_AssignArch "STRIP" $arch
|
||||
|
||||
eval "STRIP_ORI=\$STRIP$arch"
|
||||
SSTRIP="/usr/syno/bin/sstrip"
|
||||
|
||||
_AssignArch "RANLIB" $arch
|
||||
_AssignArch "CFLAGS" $arch
|
||||
@ -70,19 +71,6 @@ _ApplyBuildFlag() {
|
||||
_AssignArch "NM" $arch
|
||||
_AssignArch "READELF" $arch
|
||||
|
||||
_AssignArch "StaticDir" $arch
|
||||
_AssignArch "StaticPrefix" $arch
|
||||
_AssignArch "StaticLib" $arch
|
||||
_AssignArch "StaticInclude" $arch
|
||||
_AssignArch "STATIC_CFLAGS" $arch
|
||||
_AssignArch "STATIC_LDFLAGS" $arch
|
||||
_AssignArch "STATIC_CC" $arch
|
||||
_AssignArch "STATIC_LD" $arch
|
||||
_AssignArch "STATIC_AR" $arch
|
||||
_AssignArch "STATIC_STRIP" $arch
|
||||
_AssignArch "STATIC_RANLIB" $arch
|
||||
_AssignArch "STATIC_NM" $arch
|
||||
|
||||
#For Grub in EFI framework
|
||||
_AssignArch "GrubHOST" $arch
|
||||
_AssignArch "GrubToolChainDir" $arch
|
||||
@ -105,6 +93,8 @@ _ApplyBuildFlag() {
|
||||
|
||||
ApplyBuildEnv() {
|
||||
local arch="$1"
|
||||
local proj="$2"
|
||||
|
||||
_ApplyBuildFlag "${arch}"
|
||||
_ApplyEnvDir "build"
|
||||
|
||||
@ -118,34 +108,42 @@ ApplyBuildEnv() {
|
||||
|
||||
CC="${ToolChainPrefix}ccache-gcc"
|
||||
CXX="${ToolChainPrefix}ccache-g++"
|
||||
[ -n "$StaticPrefix" ] && STATIC_CC="${StaticPrefix}ccache-gcc"
|
||||
|
||||
if [ -n "$StaticPrefix" ]; then
|
||||
STATIC_CC="${StaticPrefix}ccache-gcc"
|
||||
fi
|
||||
if [ -n "${GrubToolChainPrefix}" ]; then
|
||||
GrubCC="${GrubToolChainPrefix}ccache-gcc"
|
||||
GrubCXX="${GrubToolChainPrefix}ccache-g++"
|
||||
fi
|
||||
|
||||
FunCreateCCacheWrap "${CC}" "${CXX}" "${STATIC_CC}" "${GrubCC}" "${GrubCXX}" /usr/bin/ccache-gcc /usr/bin/ccache-g++
|
||||
|
||||
CFLAGS="$CFLAGS -DBUILD_ARCH=${arch} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DSYNO_PLATFORM=${BUILD_TARGET}"
|
||||
CFLAGS="$CFLAGS -DBUILD_ARCH=${arch} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
|
||||
if [ -n "$SYNO_XTRACFLAGS" ]; then
|
||||
CFLAGS="${CFLAGS} ${SYNO_XTRACFLAGS}"
|
||||
STATIC_CFLAGS="${STATIC_CFLAGS} ${SYNO_XTRACFLAGS}"
|
||||
fi
|
||||
|
||||
InstallDevLayout="prefix=/usr PREFIX=/usr libdir=/usr/lib LIBDIR=/usr/lib bindir=/usr/bin BINDIR=/usr/bin includedir=/usr/include INCLUDEDIR=/usr/include DESTDIR=${DebDevDir}"
|
||||
InstallDevLayout="prefix=/usr PREFIX=/usr libdir=/usr/lib LIBDIR=/usr/lib bindir=/usr/bin BINDIR=/usr/bin includedir=/usr/include INCLUDEDIR=/usr/include DESTDIR=${DebDevDir} FILESDIR=${DebFilesRootDir}/${proj} SYNODOCDIR=/usr/include/synodoc"
|
||||
|
||||
CXXFLAGS="${CFLAGS}"
|
||||
CFLAGS="$CFLAGS $PLAT_FLAGS -DSYNO_PLATFORM=${BUILD_TARGET}"
|
||||
CXXFLAGS="${CFLAGS} ${CXXSTANDARD}"
|
||||
GOROOT="/usr/lib/go"
|
||||
}
|
||||
|
||||
ApplyInstallEnv() {
|
||||
local InstallArch="$1"
|
||||
local proj="$2"
|
||||
|
||||
export BUILD_ARCH="${InstallArch}"
|
||||
_ApplyBuildFlag "${InstallArch}"
|
||||
_ApplyEnvDir "install"
|
||||
export PATH="/bin:/sbin:/usr/bin:/usr/syno/bin:${SysRootBin}"
|
||||
|
||||
SynoInstallLayout="prefix=/usr/syno PREFIX=/usr/syno libdir=/usr/lib LIBDIR=/usr/lib bindir=/usr/syno/bin BINDIR=/usr/syno/bin includedir=/usr/syno/include INCLUDEDIR=/usr/syno/include DESTDIR=${TmpInstDir}"
|
||||
SynoInstallLayout="prefix=/usr/syno PREFIX=/usr/syno libdir=/usr/lib LIBDIR=/usr/lib bindir=/usr/syno/bin BINDIR=/usr/syno/bin includedir=/usr/syno/include INCLUDEDIR=/usr/syno/include FILESDIR=${FilesDir}/${proj} PLUGINDIR=${SynoPluginDir} DESTDIR=${TmpInstDir}"
|
||||
|
||||
CFLAGS="$CFLAGS $PLAT_FLAGS -DSYNO_PLATFORM=${BUILD_TARGET}"
|
||||
CXXFLAGS="${CFLAGS} ${CXXSTANDARD}"
|
||||
GOROOT="/usr/lib/go"
|
||||
}
|
||||
|
||||
fi
|
||||
|
207
include/build
207
include/build
@ -1,27 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_BUILD__" ]; then
|
||||
__INCLUDE_BUILD__=defined
|
||||
|
||||
Source "include/config"
|
||||
Source "include/check"
|
||||
Source "include/platforms"
|
||||
Source "include/check"
|
||||
Source "include/applyEnv"
|
||||
Source include/parallel
|
||||
Source include/parallelbuild
|
||||
Source include/config
|
||||
Source include/check
|
||||
Source include/platforms
|
||||
Source include/virtualProject
|
||||
Source include/applyEnv
|
||||
Source include/util
|
||||
|
||||
PlatformOpts=`AllPlatformOptionsComma`
|
||||
BuildDefaultArgs="acCNdhx:r:p:jJSgT"
|
||||
BuildDefaultArgs="acCNdhx:r:p:j:JSsT"
|
||||
BuildDefaultLongArgs="${PlatformOpts}platform:,\
|
||||
clean,noclean,cleanonly,dontask,\
|
||||
jobs:,without-ccache,with-ccache:,with-clean-ccache,\
|
||||
with-debug,help"
|
||||
|
||||
MakeSilent="Yes"
|
||||
MakeSilent="No"
|
||||
MakeJobs="Yes"
|
||||
WithCcache="Yes"
|
||||
WithCleanCcache="No"
|
||||
WithDebug="No"
|
||||
BuildAllProject="N"
|
||||
|
||||
BUILD_DEP_LEVEL=""
|
||||
DEP_OPT=""
|
||||
@ -29,6 +33,18 @@ DEP_OPT=""
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
|
||||
ParseArgs() {
|
||||
ARGS=$(getopt -u -l "$BuildDefaultLongArgs","$BuildExtraLongArgs" "$BuildDefaultArgs""$BuildExtraArgs" "$@")
|
||||
if [ $? -ne 0 ]; then
|
||||
Usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -- $ARGS
|
||||
|
||||
ParseBuildDefaultArgs $ARGS
|
||||
ParseBuildExtraArgs $UnHandledOpt
|
||||
}
|
||||
|
||||
# This function will parse default build args
|
||||
# InputProjs and UnHandledOpt will be export
|
||||
@ -54,10 +70,10 @@ ParseBuildDefaultArgs(){
|
||||
MakeClean="Yes"
|
||||
CleanOnly="Yes"
|
||||
;;
|
||||
"-c" | "--clean" | "--dontask")
|
||||
"-c" | "--clean")
|
||||
MakeClean="Yes"
|
||||
;;
|
||||
"-N" | "--noclean")
|
||||
"-N" | "--noclean" | "--dontask")
|
||||
MakeClean="No"
|
||||
;;
|
||||
"-d" | "--with-debug")
|
||||
@ -67,13 +83,10 @@ ParseBuildDefaultArgs(){
|
||||
Usage
|
||||
exit 0
|
||||
;;
|
||||
"-j")
|
||||
MakeJobs="Yes"
|
||||
;;
|
||||
"-J")
|
||||
MakeJobs="No"
|
||||
;;
|
||||
"--jobs")
|
||||
"-j"|"--jobs")
|
||||
JOBS="$2"
|
||||
if [ "$2" -gt 1 ]; then
|
||||
MakeJobs="Yes"
|
||||
@ -82,6 +95,9 @@ ParseBuildDefaultArgs(){
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
"-s")
|
||||
MakeSilent="Yes"
|
||||
;;
|
||||
"-S")
|
||||
MakeSilent="No"
|
||||
;;
|
||||
@ -111,9 +127,6 @@ ParseBuildDefaultArgs(){
|
||||
BUILD_DEP_LEVEL="0" # 0 means to traverse all dependencies
|
||||
fi
|
||||
;;
|
||||
"-T")
|
||||
ENABLE_LTTNG_FLAGS=true
|
||||
;;
|
||||
"--")
|
||||
# remaining are project names
|
||||
shift
|
||||
@ -137,12 +150,19 @@ ParseBuildDefaultArgs(){
|
||||
InputProjs=$@
|
||||
|
||||
if [ -z "$BUILD_OPT" ]; then
|
||||
# call again without parameters
|
||||
# call again without parameters
|
||||
# to prompt user interactively
|
||||
AskPlatform
|
||||
fi
|
||||
}
|
||||
|
||||
GetConflictProjects() {
|
||||
local proj="$1"
|
||||
local conf=$(FindConflictConf "$proj" "conflict")
|
||||
|
||||
[ -f "$conf" ] && grep "^$proj=" "$conf" | cut -d\" -f2
|
||||
}
|
||||
|
||||
NormalizeBuildProjects() {
|
||||
local projName=
|
||||
local projBaseName=
|
||||
@ -160,10 +180,6 @@ NormalizeBuildProjects() {
|
||||
CheckErrorOut 2 "You have to specify at least one poject name."
|
||||
fi
|
||||
|
||||
if ! projList=$(${ScriptsDir}/ProjectDepends.py ${DEP_OPT} ${BUILD_DEP_LEVEL} -p "${PLATFORM_ABBR}" ${projList}) ; then
|
||||
CheckErrorOut 1 "Failed to get dependency list !!"
|
||||
fi
|
||||
|
||||
if [ -z "${projList}" ]; then
|
||||
CheckErrorOut 2 "No Project actually needed to be built."
|
||||
fi
|
||||
@ -172,13 +188,13 @@ NormalizeBuildProjects() {
|
||||
return 0
|
||||
}
|
||||
|
||||
ExcludeProjects() {
|
||||
local projList=$@
|
||||
local retProjs=
|
||||
ReorderBuildProjects() {
|
||||
if ! projList=$(${ScriptsDir}/ProjectDepends.py ${DEP_OPT} ${BUILD_DEP_LEVEL} -p "${PLATFORM_ABBR}" $*) ; then
|
||||
CheckErrorOut 1 "Failed to get dependency list !!"
|
||||
fi
|
||||
|
||||
retProjs=$(ExcludeList "$projList" "$(getPlatformExcludeProjs)")
|
||||
BuildMachineOnly || retProjs=$(ExcludeList "$retProjs" ".*-virtual-protection dsm-Protection")
|
||||
echo $retProjs
|
||||
echo $projList
|
||||
return 0
|
||||
}
|
||||
|
||||
CheckCleanSource() {
|
||||
@ -205,7 +221,7 @@ SetupBuildEnv() # {{{
|
||||
CheckCleanSource
|
||||
|
||||
export SYNO_PLATFORM="${BUILD_TARGET}"
|
||||
JOBS=${JOBS:-4}
|
||||
[ -z "$JOBS" ] && JOBS=$(DetectCPUCount)
|
||||
|
||||
# Execute build env hook
|
||||
if [ -n "$hook" ] && [ "$(type -t $hook)" = "function" ]; then
|
||||
@ -238,14 +254,12 @@ EOF
|
||||
WriteEnvToFile() {
|
||||
local file="$1"
|
||||
|
||||
rm $file
|
||||
rm -f "$file"
|
||||
|
||||
# env.mak and env64.mak
|
||||
echo "SOURCE_DIR=$SourceDir" >> $file
|
||||
echo "ToolChainDir=$ToolChainDir" >> $file
|
||||
echo "ToolChainSysRoot=${ToolChainSysRoot}" >> $file
|
||||
echo "PLATFORM_ABBR=$PLATFORM_ABBR" >> $file
|
||||
echo "SYNO_PLATFORM=$SYNO_PLATFORM" >> $file
|
||||
echo "ConfigOpt=\"$ConfigOpt\"" >> $file
|
||||
echo "HOST=$HOST" >> $file
|
||||
echo "ToolChainPrefix=$ToolChainPrefix" >> $file
|
||||
@ -255,19 +269,20 @@ WriteEnvToFile() {
|
||||
echo "CFLAGS=$CFLAGS" >> $file
|
||||
echo "CXXFLAGS=$CXXFLAGS" >> $file
|
||||
echo "LDFLAGS=$LDFLAGS" >> $file
|
||||
echo "CC=${ToolChainPrefix}ccache-gcc" >> $file
|
||||
echo "CXX=${ToolChainPrefix}ccache-g++" >> $file
|
||||
echo "CC=$CC" >> $file
|
||||
echo "CXX=$CXX" >> $file
|
||||
echo "LD=$LD" >> $file
|
||||
echo "AR=$AR" >> $file
|
||||
echo "STRIP=$STRIP" >> $file
|
||||
echo "# STRIP is decided by the env.mak." >> $file
|
||||
echo "STRIP_ORI=$STRIP_ORI" >> $file
|
||||
echo "SSTRIP=$SSTRIP" >> $file
|
||||
echo "RANLIB=$RANLIB" >> $file
|
||||
echo "NM=$NM" >> $file
|
||||
echo "READELF=$READELF" >> $file
|
||||
|
||||
echo "DSM_BUILD_NUM=$DSM_BUILD_NUM" >> $file
|
||||
echo "DSM_SHLIB_MAJOR=$DSM_SHLIB_MAJOR" >> $file
|
||||
echo "DSM_SHLIB_MINOR=$DSM_SHLIB_MINOR" >> $file
|
||||
echo "DSM_STAGE=$DSM_STAGE" >> $file
|
||||
echo "SynoDir=$SynoDir" >> $file
|
||||
echo "SynoIncludeDir=$SynoIncludeDir" >> $file
|
||||
echo "SynoLibDir=$SynoLibDir" >> $file
|
||||
@ -295,6 +310,8 @@ WriteEnvToFile() {
|
||||
echo "GrubNM=$GrubNM64" >> $file
|
||||
fi
|
||||
|
||||
echo "GOROOT=/usr/lib/go" >> $file
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -322,18 +339,9 @@ GenerateEnvMak() # {{{
|
||||
SetupCcache() {
|
||||
if [ "${WithCcache}" = "Yes" ]; then
|
||||
CCACHE_BIN="/usr/bin/ccache"
|
||||
|
||||
if [ ! -x ${CCACHE_BIN} ]; then
|
||||
cat << EOF
|
||||
|
||||
Binary ${CCACHE_BIN} doesn't exist.
|
||||
Use script SynoUpdate --single $SynoBaseProj to check out it, and run SynoBase first.
|
||||
EOF
|
||||
exit 2
|
||||
fi
|
||||
|
||||
export CCACHE_DIR="/ccaches/${PLATFORM_ABBR}"
|
||||
export CCACHE_NOCOMPRESS=YES
|
||||
export CCACHE_CPP2=YES
|
||||
export CCACHE_SLOPPINESS=file_macro,include_file_mtime,time_macros
|
||||
mkdir -p ${CCACHE_DIR}
|
||||
chmod 1777 ${CCACHE_DIR}
|
||||
@ -346,42 +354,6 @@ EOF
|
||||
fi
|
||||
}
|
||||
|
||||
AssignMakeFlags() {
|
||||
local proj="$1"
|
||||
|
||||
MAKE_FLAGS=""
|
||||
if [ "Yes" == "$MakeSilent" ]; then
|
||||
MAKE_FLAGS="$MAKE_FLAGS -s -w"
|
||||
fi
|
||||
|
||||
if [ "Yes" == "$MakeJobs" ]; then
|
||||
# Check if we can build this project in parallel
|
||||
MAKE_FLAGS="$MAKE_FLAGS -j $JOBS"
|
||||
# Keep completely quite if (MakeSilent && MakeJons)
|
||||
if [ "Yes" == "$MakeSilent" ]; then
|
||||
MAKE_FLAGS="$MAKE_FLAGS --no-print-directory"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
SetupBuildProjEnv(){
|
||||
local proj=$1
|
||||
export BuildingProj=$proj
|
||||
|
||||
if Is64BitProject "$proj"; then
|
||||
ApplyBuildEnv "64"
|
||||
else
|
||||
ApplyBuildEnv "32"
|
||||
fi
|
||||
|
||||
AssignMakeFlags $proj
|
||||
|
||||
#clean /deb/build dir
|
||||
rm -rf $DebDevDir/*
|
||||
rm -rf $DebDevBuild/*
|
||||
}
|
||||
|
||||
|
||||
ReplaceSynoSysRoot() {
|
||||
local configFile=$@
|
||||
for file in $configFile; do
|
||||
@ -393,6 +365,48 @@ ReplaceSynoSysRoot() {
|
||||
done
|
||||
}
|
||||
|
||||
AssignMakeFlags() {
|
||||
local proj="$1"
|
||||
|
||||
MAKE_FLAGS=""
|
||||
if [ "Yes" == "$MakeSilent" ]; then
|
||||
MAKE_FLAGS="$MAKE_FLAGS -s -w"
|
||||
fi
|
||||
|
||||
if [ "Yes" == "$MakeJobs" ]; then
|
||||
# Check if we can build this project in parallel
|
||||
if ProjectParallelizable ${proj}; then
|
||||
MAKE_FLAGS="$MAKE_FLAGS -j $JOBS"
|
||||
# Keep completely quite if (MakeSilent && MakeJons)
|
||||
if [ "Yes" == "$MakeSilent" ]; then
|
||||
MAKE_FLAGS="$MAKE_FLAGS --no-print-directory"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
SetupBuildProjEnv() {
|
||||
local proj=$1
|
||||
export BuildingProj=$proj
|
||||
DebDevBuild="${DebDir}/build_$proj"
|
||||
DebDevDir="${DebDir}/tmpInstallDir_$proj"
|
||||
|
||||
if Is64BitProject "$proj"; then
|
||||
ApplyBuildEnv "64" "$proj"
|
||||
else
|
||||
ApplyBuildEnv "32" "$proj"
|
||||
fi
|
||||
|
||||
AssignMakeFlags $proj
|
||||
|
||||
for dir in $DebDevDir $DebDevBuild; do
|
||||
rm -rf "$dir"
|
||||
mkdir -p "$dir"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
RunBuildScript() # {{{
|
||||
{
|
||||
@ -408,7 +422,6 @@ RunBuildScript() # {{{
|
||||
|
||||
if [ ! -d "$proj" ]; then
|
||||
ERROR "Project $proj doesn't exist."
|
||||
INFO "" "Use script SynoUpdate $proj to check out it."
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -424,17 +437,18 @@ RunBuildScript() # {{{
|
||||
fi
|
||||
|
||||
INFO "======= Run build script ======="
|
||||
(. $buildScript)
|
||||
(
|
||||
. $buildScript
|
||||
)
|
||||
|
||||
CheckProjectStatus build $proj > /dev/null
|
||||
return
|
||||
} # }}}
|
||||
|
||||
|
||||
PackProjectDeb() {
|
||||
#TODO Use SynoDeb to install files instead of copy
|
||||
ProjectInstallDev() {
|
||||
|
||||
if [ "$(ls -A "$DebDevDir" 2>/dev/null)" ]; then
|
||||
# remove SysRoot path in pc file
|
||||
for pc in $(find "$DebDevDir" -name "*.pc"); do
|
||||
sed -i "s|${ToolChainSysRoot}||g" "$pc"
|
||||
done
|
||||
@ -442,31 +456,30 @@ PackProjectDeb() {
|
||||
find "$DebDevDir" -name '*.la' | xargs rm -rf
|
||||
cp -r "$DebDevDir"/* "$ToolChainSysRoot"
|
||||
fi
|
||||
CheckProjectStatus build $proj > /dev/null
|
||||
}
|
||||
|
||||
|
||||
BuildProject() {
|
||||
local ret=
|
||||
local proj=$1
|
||||
local installDevScript=
|
||||
|
||||
if ! RunBuildScript "$proj"; then
|
||||
if ! RunBuildScript $proj; then
|
||||
ERROR "Build project fail!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! installDevScript=$(findInstallDevScript "$proj"); then
|
||||
INFO "install-dev scripts not found!"
|
||||
if [ -z "$InstallDevScript" ]; then
|
||||
INFO "No install-dev script."
|
||||
return 0
|
||||
fi
|
||||
|
||||
INFO "======= Run install-dev script ======="
|
||||
INFO "SCRIPT" "install-dev script: ${installDevScript}"
|
||||
INFO "SCRIPT" "install-dev script: ${InstallDevScript}"
|
||||
(
|
||||
. "$installDevScript"
|
||||
. $InstallDevScript
|
||||
)
|
||||
PackProjectDeb "$proj"
|
||||
return $?
|
||||
|
||||
ProjectInstallDev $proj
|
||||
CheckProjectStatus build $proj > /dev/null
|
||||
}
|
||||
|
||||
fi
|
||||
|
47
include/build.pkg
Normal file
47
include/build.pkg
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_BUILD_PKG__" ]; then
|
||||
__INCLUDE_BUILD_PKG__=defined
|
||||
|
||||
BuildExtraArgs=""
|
||||
BuildExtraLongArgs="min-sdk:,parallel:"
|
||||
Parallel=false
|
||||
|
||||
ParseBuildExtraArgs() {
|
||||
while [ -n "$1" ]; do # {{{
|
||||
case "$1" in
|
||||
"--min-sdk")
|
||||
MinSdkVersion="$2"
|
||||
shift
|
||||
;;
|
||||
"--parallel")
|
||||
Parallel=true
|
||||
ProcessCount=$2
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
ERROR "Unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ -z "$BUILD_OPT" ]; then
|
||||
# call again without parameters
|
||||
# to prompt user interactively
|
||||
AskPlatform
|
||||
fi
|
||||
}
|
||||
|
||||
GetBuildProjList() {
|
||||
local projectList=
|
||||
|
||||
projectList=$(NormalizeBuildProjects $InputProjs)
|
||||
projectList=$(ExcludeList "$projectList" "$(getPlatformExcludeProjs)")
|
||||
projectList=$(ReorderBuildProjects $projectList)
|
||||
|
||||
echo $projectList
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
216
include/check
216
include/check
@ -1,24 +1,36 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_CHECK__" ]; then
|
||||
__INCLUDE_CHECK__=defined
|
||||
|
||||
Source include/init
|
||||
Source "include/config"
|
||||
Source "include/platforms"
|
||||
Source "include/errors"
|
||||
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/init
|
||||
|
||||
Source include/variable
|
||||
Source include/virtualProject
|
||||
Source include/config
|
||||
Source include/platforms
|
||||
|
||||
|
||||
GetProjectPath() {
|
||||
local project="$1"
|
||||
|
||||
if [ "$(basename "$SynoBase")" = "ds.base" ]; then
|
||||
echo "$SourceDir/$(GetVirtualProjectName "$(GetVirInstProjectName "$project")")"
|
||||
else
|
||||
echo "$SourceDir/$(GetVirInstProjectName "$project")"
|
||||
fi
|
||||
}
|
||||
|
||||
# Build system will select virtual build script first and then projName script in build.
|
||||
CheckScript() {
|
||||
local projName="$1"
|
||||
local type=$2
|
||||
local findScript=
|
||||
local virtualName=$(GetVirtualProjectExtension $projName)
|
||||
local projPath="$(GetProjectPath "$projName")"
|
||||
|
||||
if [ -f "$SourceDir/$projName/$ConfDir/$type" ]; then
|
||||
findScript="$SourceDir/$projName/$ConfDir/$type"
|
||||
elif [ -f "$ScriptsDir/$type/$projName" ]; then
|
||||
findScript="$ScriptsDir/$type/$projName"
|
||||
if [ -f "$projPath/$ConfDir/$type$virtualName" ]; then
|
||||
findScript="$projPath/$ConfDir/$type$virtualName"
|
||||
fi
|
||||
|
||||
echo $findScript
|
||||
@ -29,24 +41,11 @@ FindScript() {
|
||||
local projName=$1
|
||||
local type=$2
|
||||
local script=
|
||||
local removeArchExt="-32"
|
||||
# if default build 32bit, user will input project-virtual-64.
|
||||
if [ "$DefaultBuild32Bit" = "yes" ]; then
|
||||
removeArchExt="-64"
|
||||
fi
|
||||
|
||||
script=$(CheckScript $projName $type)
|
||||
if [ -z "$script" ]; then
|
||||
# for project-virtual-junior-32
|
||||
script=$(CheckScript ${projName//$removeArchExt/} $type)
|
||||
if [ -z "$script" ]; then
|
||||
# for project-virtual-32
|
||||
script=$(CheckScript ${projName//-virtual$removeArchExt/} $type)
|
||||
fi
|
||||
fi
|
||||
script="$(CheckScript "$projName" "$type")"
|
||||
|
||||
if [ -n "$script" ]; then
|
||||
echo $script
|
||||
echo "$script"
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -58,6 +57,11 @@ findBuildScript() {
|
||||
FindScript "$projName" "build"
|
||||
}
|
||||
|
||||
findBuildFlagsScript() {
|
||||
local projName=$1
|
||||
FindScript "$projName" "buildflags"
|
||||
}
|
||||
|
||||
findInstallDevScript() {
|
||||
local projName=$1
|
||||
FindScript "$projName" "install-dev"
|
||||
@ -70,12 +74,17 @@ findInstallScript() {
|
||||
|
||||
findDependConf() {
|
||||
local projName="$1"
|
||||
local conf=$(FindScript "$projName" "depends")
|
||||
if [ -n "$conf" ]; then
|
||||
echo "$conf"
|
||||
else
|
||||
echo "$ScriptsDir/$GlobalDependConf"
|
||||
fi
|
||||
FindScript "$projName" "depends"
|
||||
}
|
||||
|
||||
FindConflictConf() {
|
||||
local projName="$1"
|
||||
FindScript "$projName" "conflict"
|
||||
}
|
||||
|
||||
findErrorScript() {
|
||||
local projName=$1
|
||||
FindScript "$projName" "error"
|
||||
}
|
||||
|
||||
CheckPermission()
|
||||
@ -107,15 +116,20 @@ CheckInList() {
|
||||
return 1
|
||||
}
|
||||
|
||||
CheckProjectStatus() {
|
||||
$ScriptsDir/include/errors.py $1 $2
|
||||
}
|
||||
|
||||
CheckErrorLog()
|
||||
{
|
||||
local errors
|
||||
local warns
|
||||
local logFile
|
||||
local warnCount
|
||||
local warnCount blocked blockedList
|
||||
local allProjCount=0
|
||||
local errProjCount=0
|
||||
local warnProjCount=0
|
||||
local blockProjCount=0
|
||||
local ret=
|
||||
local logType=$1
|
||||
shift
|
||||
@ -149,21 +163,25 @@ CheckErrorLog()
|
||||
if [ "$1" = "build" ]; then
|
||||
warnCount=`grep -s "warning:" $logFile | wc -l`
|
||||
if [ 0 -ne $warnCount ]; then
|
||||
printf "%-30s:\t%4d warning(s)\n" $proj $warnCount
|
||||
printf "%-40s:\t%4d warning(s)\n" $proj $warnCount
|
||||
warns="Y"
|
||||
warnProjCount=$(( $warnProjCount + 1 ))
|
||||
fi
|
||||
fi
|
||||
blocked="$(grep -s "^\[Blocked\]" $logFile)"
|
||||
if [ -n "$blocked" ]; then
|
||||
blockedList="$blockedList $proj"
|
||||
blockProjCount=$(( $blockProjCount + 1 ))
|
||||
fi
|
||||
fi
|
||||
allProjCount=$(( $allProjCount + 1 ))
|
||||
done
|
||||
[ -n "$blockedList" ] && echo -e "\nBlocked projects:$blockedList\n"
|
||||
echo -n "$allProjCount projects, $errProjCount failed"
|
||||
if [ "$1" = "build" ]; then
|
||||
echo ", $warnProjCount have warnings."
|
||||
else
|
||||
echo "."
|
||||
echo -n ", $warnProjCount have warnings"
|
||||
fi
|
||||
|
||||
echo ", $blockProjCount blocked."
|
||||
echo ""
|
||||
if [ "$errors" = "Y" ]; then
|
||||
ERROR "Check [${errorFile}] for fixing errors."
|
||||
@ -184,29 +202,36 @@ CheckErrorOut()
|
||||
}
|
||||
|
||||
INFO(){
|
||||
local std_dest
|
||||
[ "$ShowDebug" = "yes" ] && std_dest=">&3"
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo -e "[INFO] $1"
|
||||
eval echo -e "[INFO] $1" $std_dest
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
echo -e [INFO] $2
|
||||
eval echo -e "[INFO] $2" "$std_dest"
|
||||
else
|
||||
echo -e [$1] $2
|
||||
eval echo -e "[$1] $2" "$std_dest"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ERROR(){
|
||||
if [ $# -lt 2 ]; then
|
||||
echo -e "\n[Error] $1\n" >&2
|
||||
echo -e "[Error] $1" >&2
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
echo -e [Error] $2 >&2
|
||||
echo -e "[Error] $2" >&2
|
||||
else
|
||||
echo -e [$1] $2 >&2
|
||||
echo -e "[$1] $2" >&2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
WARNING()
|
||||
{
|
||||
echo -e "\033[93m[WARNING] $1\033[0m" >&2
|
||||
}
|
||||
|
||||
ShowTimeCost()
|
||||
{
|
||||
@ -225,7 +250,7 @@ ShowTimeCost()
|
||||
DIFF_MIN=$(((${DIFF_INT}/60)%60))
|
||||
DIFF_HOUR=$(((${DIFF_INT}/3600)%60))
|
||||
|
||||
printf "Time cost: %02d:%02d:%02d %s\n" ${DIFF_HOUR} ${DIFF_MIN} ${DIFF_SEC} ${TAG_INTERNAL}
|
||||
printf "Time cost: %02d:%02d:%02d %s\n" ${DIFF_HOUR} ${DIFF_MIN} ${DIFF_SEC} "${TAG_INTERNAL}"
|
||||
}
|
||||
|
||||
CheckTimeCostLog()
|
||||
@ -244,13 +269,27 @@ CheckTimeCostLog()
|
||||
if [ -r "$logFile" ]; then
|
||||
#echo "file: ${logFile}"
|
||||
result=`grep "Time cost:" $logFile`
|
||||
echo $result
|
||||
[ -n "$result" ] && echo "$result"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
}
|
||||
|
||||
GetBaseDirs()
|
||||
{
|
||||
# by default, the BASEDIR should be /synosrc or /synosrc.xxx
|
||||
# get dir path of scripts for following inclusion of other scripts
|
||||
CurDir=`pwd`
|
||||
BASEDIR=`dirname $1`
|
||||
BASEDIR=`dirname ${BASEDIR}`
|
||||
|
||||
#echo "file: $0"
|
||||
#echo "CurDir: ${CurDir}"
|
||||
#echo "ScriptDir: ${ScriptsDir}"
|
||||
echo "BASEDIR: ${BASEDIR}"
|
||||
}
|
||||
|
||||
# FIXME for test
|
||||
Debug()
|
||||
{
|
||||
@ -274,10 +313,22 @@ _get_key_value()
|
||||
echo "$val"
|
||||
}
|
||||
|
||||
GetDSMCriticalUpdateNumber() {
|
||||
_get_key_value "smallfixnumber" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetDSMBuildNumber() {
|
||||
_get_key_value "buildnumber" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetDSMPacking() {
|
||||
_get_key_value "packing" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetDSMPackingID() {
|
||||
_get_key_value "packing_id" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetDSMMajorNumber()
|
||||
{
|
||||
_get_key_value "majorversion" "$VERSION_FILE"
|
||||
@ -288,10 +339,36 @@ GetDSMMinorNumber()
|
||||
_get_key_value "minorversion" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetSmallFixNumber()
|
||||
{
|
||||
_get_key_value "smallfixnumber" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetProductVersion()
|
||||
{
|
||||
_get_key_value "productversion" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetBuildTime()
|
||||
{
|
||||
_get_key_value "buildtime" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetBuildDate()
|
||||
{
|
||||
_get_key_value "builddate" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
Is64BitProject() {
|
||||
local Proj=$1
|
||||
local ProjExt=
|
||||
|
||||
if [ "$DefaultBuild32Bit" = "yes" ]; then
|
||||
ProjExt=`GetVirtualProjectExtension $Proj`
|
||||
HasSubStr "$ProjExt" "64$"
|
||||
return
|
||||
fi
|
||||
|
||||
Is32BitProject $Proj && return 1
|
||||
return 0
|
||||
}
|
||||
@ -304,7 +381,8 @@ Is32BitProject() { #{{{
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
ProjExt=`GetVirtualProjectExtension $Proj`
|
||||
HasSubStr "$ProjExt" "32$"
|
||||
} #}}}
|
||||
|
||||
getPlatformExcludeProjs() {
|
||||
@ -338,42 +416,20 @@ ExcludeList() {
|
||||
return 0
|
||||
}
|
||||
|
||||
GetBuildPhase() {
|
||||
local _file=$1
|
||||
local _phase=
|
||||
|
||||
[ -z "$_file" ] && _file=$VERSION_FILE
|
||||
|
||||
_phase="`grep buildphase $_file | cut -d'"' -f2`"
|
||||
|
||||
if [ -n "$_phase" ]; then
|
||||
echo $_phase
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
GetBuildStage() {
|
||||
echo release
|
||||
return 0
|
||||
}
|
||||
|
||||
SetupDSMBuildNumber() {
|
||||
unset DSM_BUILD_NUM DSM_SHLIB_MAJOR DSM_SHLIB_MAJOR
|
||||
unset DSM_BUILD_NUM DSM_SHLIB_MAJOR DSM_SHLIB_MINOR SMALLFIX_NUM DSM_STAGE PRODUCT_VERSION PACKING PACKING_ID
|
||||
local file=${1:-$VERSION_FILE}
|
||||
local phase=`GetBuildPhase $file`
|
||||
|
||||
if [ -z "$DSM_STAGE" ]; then
|
||||
# get global info
|
||||
DSM_BUILD_NUM=$(GetDSMBuildNumber "$file")
|
||||
DSM_SHLIB_MAJOR=$(GetDSMMajorNumber "$file")
|
||||
DSM_SHLIB_MINOR=$(GetDSMMinorNumber "$file")
|
||||
DSM_STAGE=$(GetBuildStage $file $phase)
|
||||
if [ $? -ne 0 ]; then
|
||||
ERROR "cannot get build stage"
|
||||
exit 1
|
||||
fi
|
||||
DSM_BUILD_NUM=$(GetDSMBuildNumber "$file")
|
||||
DSM_SHLIB_MAJOR=$(GetDSMMajorNumber "$file")
|
||||
DSM_SHLIB_MINOR=$(GetDSMMinorNumber "$file")
|
||||
SMALLFIX_NUM=$(GetSmallFixNumber "$file")
|
||||
PRODUCT_VERSION=$(GetProductVersion "$file")
|
||||
PACKING=$(GetDSMPacking "$file")
|
||||
PACKING_ID=$(GetDSMPackingID "$file")
|
||||
if [ $? -ne 0 ]; then
|
||||
ERROR "cannot get build stage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DSM_BUILD_NUM" ]; then
|
||||
@ -383,7 +439,7 @@ SetupDSMBuildNumber() {
|
||||
[ -z "$DSM_SHLIB_MAJOR" ] && DSM_SHLIB_MAJOR=0
|
||||
[ -z "$DSM_SHLIB_MINOR" ] && DSM_SHLIB_MINOR=0
|
||||
|
||||
export DSM_BUILD_NUM DSM_SHLIB_MAJOR DSM_SHLIB_MINOR
|
||||
export DSM_BUILD_NUM DSM_SHLIB_MAJOR DSM_SHLIB_MINOR SMALLFIX_NUM PRODUCT_VERSION PACKING PACKING_ID
|
||||
}
|
||||
|
||||
fi
|
||||
|
24
include/check.pkg
Executable file → Normal file
24
include/check.pkg
Executable file → Normal file
@ -1,25 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
# $1: config file, $2 milestone
|
||||
CheckMileStone()
|
||||
{
|
||||
[ $# -ne 2 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
[ -f "$1" ] || { echo "Config '$1' not exist!"; return 1; }
|
||||
[ -n "$2" ] || { echo "Please specify section name!"; return 1; }
|
||||
grep -q "^\[$2\]" $1 && return 0
|
||||
echo "Section '$2' not found in '$1'!"
|
||||
return 1
|
||||
}
|
||||
if [ -z "$__INCLUDE_CHECK_PKG__" ]; then
|
||||
__INCLUDE_CHECK_PKG__=defined
|
||||
|
||||
ResolvePkgVersion() {
|
||||
ResolveMinSdkMacro() {
|
||||
[ $# -ne 1 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
local regexp_version='^[0-9][0-9A-Za-z\.\-]*(-[0-9]+)?$'
|
||||
[[ "$1" =~ $regexp_version ]] || CheckErrorOut 1 "$1 is not a valid package version!"
|
||||
PkgVersion="`echo $1 | awk -F- '{print $NF}'`"
|
||||
[[ $1 =~ ^[0-9]+\.[0-9]+$ ]] || CheckErrorOut 1 "Invalid SDK version \"$1\""
|
||||
local major="`echo $1 | cut -d'.' -f1`"
|
||||
local minor="`echo $1 | cut -d'.' -f2`"
|
||||
echo "SDK_VER_MIN_REQUIRED=$((${major}*100+${minor}))"
|
||||
}
|
||||
|
||||
[ "$(caller)" != "0 NULL" ] && return 0
|
||||
`$@`
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
||||
|
8
include/config
Executable file → Normal file
8
include/config
Executable file → Normal file
@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_CONFIG__" ]; then
|
||||
__INCLUDE_CONFIG__=defined
|
||||
|
||||
if [ -z "$IS_GIT_SERVER" ]; then
|
||||
Source "include/variable"
|
||||
fi
|
||||
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/init
|
||||
|
||||
Source "include/projects"
|
||||
Source include/variable
|
||||
Source include/projects
|
||||
|
||||
fi # header guard
|
||||
# vim:ft=sh
|
||||
|
@ -1,27 +0,0 @@
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
|
||||
# $1 = version, $2 = arch
|
||||
SetBuildEnvPre() {
|
||||
if [ $# -gt 2 ]; then
|
||||
echo "Wrong number of parameters to SetBuildEnvPre()"
|
||||
return 1
|
||||
elif [ "$1" = "unknown" ]; then
|
||||
echo "Unknown version is given to SetBuildEnvPre()"
|
||||
return 1
|
||||
fi
|
||||
local version="$1" arch="$2"
|
||||
|
||||
case "$arch" in
|
||||
"6180" | "6281") arch="88f$arch" ;;
|
||||
*) arch="$arch" ;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
UpdatePkgScripts() {
|
||||
echo "UpdatePkgScripts() is empty for customization."
|
||||
}
|
||||
|
||||
# vim:ft=sh
|
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_ERRORS__" ]; then
|
||||
__INCLUDE_ERRORS__=defined
|
||||
|
||||
#CheckErrorLog check_type
|
||||
#CheckProjectStatus check_type project_name
|
||||
CheckProjectStatus()
|
||||
{
|
||||
local chk_type="$1"
|
||||
local logFile="$LogDir/$2.$1"
|
||||
local result=
|
||||
if [ ! -r "$logFile" ]; then
|
||||
return 1
|
||||
fi
|
||||
result=`sed '/tar\ zcpvf\ .../,/\[Done\]/d' "$logFile" | grep -E "line.*syntax error|Error" | grep -v "blib/arch/auto/Encode/Detect/Detector/Detector.so" | grep -v "Net-DNS-0.73" | grep -v 'checking for GPG Error - version' | grep -v 'this file was generated for autoconf 2.60' | grep -v "his may cause compile errors" | grep -v "In case of failure it is often undecidable if the error" | grep -v "I got the following error:" | grep -v "Error.pm" | grep -v "Error::Simple.3" | grep -v "Error.3" | grep -v "CPANPLUS::Error" | grep -v "Simple.pm" | grep -v ignored | grep -v Errors.py | grep -v CdsErrors | grep -v distclean | grep -v PQresultErrorField | grep -v PQsetErrorVerbosity | grep -v hp2ps-Error | grep -v "Error Reporting support" | grep -v "Xapian::ErrorHandler" | grep -v SYNOErrorDump | grep -v GetErrorMsg | grep -v DelErrnoText | grep -v ErrorText | grep -v MVCPPrintError | grep -v ShowZError | grep -v ataPrintSmartErrorlog | grep -v SetMkdirError | grep -v SetRenameError | grep -v OutputError | grep -Ev 'Error\.(c|h|o|cpp|lo|pm|3|js|gif)' | grep -Ev '(glu|res|\.deps/|X[a-zA-Z]*)Error' | grep -v ErrorCode | grep -v TIFFSetErrorHandlerExt | grep -v SplashError | grep -v pkix_VerifyNode_FindError | grep -v PKIX_Error_Create | grep -v pkix_Error2ASCII | grep -v glib-Error-Reporting.html | grep -v savedError | grep -v ErrFHOSTGetMkfsError | grep -v "ImportError" | grep -v GenError | grep -v "tstLastError.py" | grep -v "libxml_xmlTextReaderGetErrorHandler" | grep -v "libxml_xmlParserCtxtGetErrorHandler" | grep -v "libxml_xmlErrorPtrWrap" | grep -v "ErrorFunc" | grep -v "\/Error" | grep -v "Error\/" |grep -v "Error::Simple" |grep -v "Writing Makefile for Error" | grep -v "SetValidErrors" | grep -Ev "skip client functions" | grep -v "struct cli_credentials" | grep -v "wxregex_regerror" | grep -v "wxThreadError" | grep -v "wxMutexError" | grep -v "wxCondError" | grep -v "wxSemaError" | grep -v "SYNOEAFixErrorAD" | grep -v "PyExc_AttributeError" | grep -v "MCErrorMessage" | grep -v gdSetErrorMethod | grep -v "inflated:" | grep -v "PolicyError" | grep -v "resolutionErrors" | grep -v "vmError_linux" | grep -v "error_messages.c" | grep -v "map2jdwpError" | grep -v "jvmtiError" | grep -v "socketTransport_getLastError" | grep -Ev '*.java' | grep -v "inflating:" | grep -v "OptionPaneError.wav" | grep -v "OutOfMemoryError" | grep -v "encoded value was" | grep -v "Encountered Infinity" | grep -v "libjvm.so" | grep -v "XErrorEvent" | grep -v "LEErrorCode" | grep -v "Error.gif" | grep -v "vmError" | grep -v "classFileError" | grep -v "Build project fail" | grep -v "eglGetError" | grep -v "exitErrorHandler" | grep -v "SLAP_CALLOC Error" | grep -v "Error scanning dquots" | grep -v "ErrorCategory"`
|
||||
|
||||
if [ -z "$result" ]; then
|
||||
result=`grep -is "fatal error" $logFile` | `grep -v 'configure: Automatically print stack trace on fatal errors: no'`
|
||||
fi
|
||||
if [ -z "$result" ]; then
|
||||
result=`grep -is "*** missing separator (did you mean TAB instead of 8 spaces?)." $logFile`
|
||||
fi
|
||||
if [ -z "$result" ]; then
|
||||
result=`grep -is "No rule to make target" $logFile | grep -v distclean | grep -v clean`
|
||||
fi
|
||||
if [ -z "$result" ]; then
|
||||
result=`grep -is "don't know" $logFile | grep -v "make distclean" | grep -v "make clean"`
|
||||
fi
|
||||
if [ -z "$result" ]; then
|
||||
result=`grep -is "error:" $logFile | grep -v "make distclean" | grep -v "make clean" | grep -v "echo: write error: Broken pipe" | grep -v "error: Autoconf version 2.63 or higher is required" | grep -v "Error::Simple.3" | grep -v "ImportError" | grep -v "skip client functions" | grep -v "struct cli_credentials" | grep -v "Cannot chcon libjvm.so" | grep -v "I got the following error"`
|
||||
fi
|
||||
if [ "$chk_type" = "install" -a -z "$result" ]; then
|
||||
result=`grep -is "No such file or directory" $logFile | grep -v "ImportError" `
|
||||
fi
|
||||
|
||||
if [ "$result" != "" ]; then
|
||||
echo -e "$result"
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
127
include/errors.py
Executable file
127
include/errors.py
Executable file
@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(sys.argv[0])) + '/python')
|
||||
import BuildEnv
|
||||
|
||||
LOG_DIR = '/logs'
|
||||
|
||||
# "error_pattern": skip_list
|
||||
BUILD_ERROR_CHECKLIST = {
|
||||
"line.*syntax error": [],
|
||||
"Error": ['ignored', 'Error\.[c|o|h|cc|lo|Plo|js]', 'GPG Error', 'distclean'],
|
||||
"fatal error": [],
|
||||
"missing separator": [],
|
||||
"No rule to make target": ["clean", "distclean"],
|
||||
"don't know": [],
|
||||
"error:": [],
|
||||
"was not found in the pkg-config search path": [],
|
||||
"ld: cannot find": [],
|
||||
}
|
||||
|
||||
INSTALL_ERROR_CHECKLIST = {
|
||||
"No such file or directory": []
|
||||
}
|
||||
|
||||
|
||||
def is_skipped_error(error, skip_list):
|
||||
if not skip_list:
|
||||
return False
|
||||
|
||||
for skip in skip_list:
|
||||
if skip and re.search(skip, error):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def find_errors(check_list, log):
|
||||
result = []
|
||||
|
||||
for error in check_list:
|
||||
regex = re.compile(error)
|
||||
found_error = False
|
||||
|
||||
index = 0
|
||||
for line in log:
|
||||
index += 1
|
||||
line = line.strip()
|
||||
|
||||
if regex.search(line) and not is_skipped_error(line, check_list[error]):
|
||||
if not found_error:
|
||||
result.append('====== Find pattern [%s] ======' % error)
|
||||
found_error = True
|
||||
result.append('%s: %s' % (str(index), line))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def load_project_setting(proj, check_list):
|
||||
error_script = BuildEnv.Project(proj).error_script
|
||||
if not error_script or not os.path.isfile(error_script):
|
||||
return
|
||||
|
||||
with open(error_script, 'r') as error_skip_file:
|
||||
try:
|
||||
error_skip_list = json.load(error_skip_file)
|
||||
except ValueError:
|
||||
raise RuntimeError("Can't parse error file %s." % error_script)
|
||||
|
||||
for error in error_skip_list:
|
||||
if error not in check_list:
|
||||
check_list[error] = error_skip_list[error]
|
||||
continue
|
||||
|
||||
skips = error_skip_list[error]
|
||||
if isinstance(skips, basestring):
|
||||
check_list[error].append(skips)
|
||||
elif isinstance(skips, list):
|
||||
check_list[error].extend(skips)
|
||||
else:
|
||||
raise RuntimeError("Wrong value type: %s." % skips)
|
||||
|
||||
|
||||
def find_project_log(proj, log_type):
|
||||
return os.path.join(LOG_DIR, proj + '.' + log_type)
|
||||
|
||||
|
||||
def main():
|
||||
proj = sys.argv[2]
|
||||
log_type = sys.argv[1]
|
||||
errors = None
|
||||
|
||||
check_list = BUILD_ERROR_CHECKLIST
|
||||
if log_type == 'install':
|
||||
check_list.update(INSTALL_ERROR_CHECKLIST)
|
||||
|
||||
load_project_setting(proj, check_list)
|
||||
|
||||
# If log file doesn't write back to disk, there will raise IOError because of log file not found.
|
||||
# Do `sync` and reopen file again to prevent log file not found.
|
||||
try:
|
||||
log = open(find_project_log(proj, log_type), 'r')
|
||||
except IOError:
|
||||
subprocess.check_call(['sync'])
|
||||
log = open(find_project_log(proj, log_type), 'r')
|
||||
|
||||
errors = find_errors(check_list, log.readlines())
|
||||
log.close()
|
||||
|
||||
if errors:
|
||||
print("\n".join(errors))
|
||||
sys.exit(2)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: ./error.py log_type project")
|
||||
sys.exit(1)
|
||||
|
||||
main()
|
18
include/init
18
include/init
@ -1,16 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_INIT__" ]; then
|
||||
__INCLUDE_INIT__=defined
|
||||
|
||||
CurDir=$(pwd)
|
||||
ScriptsDir=$(dirname $(readlink -f "$0"))
|
||||
ScriptsDir=$(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}")))
|
||||
ScriptsDirName=$(basename "$ScriptsDir")
|
||||
ScriptsName=$(basename "$0")
|
||||
SynoBase=$(dirname "$ScriptsDir")
|
||||
BASEDIR="$(dirname "$SynoBase")"
|
||||
SourceDir=$SynoBase/source
|
||||
|
||||
GetChroot() {
|
||||
local platform="$1"
|
||||
|
||||
echo "$BASEDIR/ds.$platform"
|
||||
}
|
||||
|
||||
GetChrootSource() {
|
||||
local platform="$1"
|
||||
|
||||
echo "$(GetChroot "$platform")/source"
|
||||
}
|
||||
|
||||
UsingPkgScripts() {
|
||||
if [ "$ScriptsDirName" = "lnxscripts" ]; then
|
||||
return 1
|
||||
|
150
include/install
Normal file → Executable file
150
include/install
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_INSTALL__" ]; then
|
||||
__INCLUDE_INSTALL__=defined
|
||||
@ -7,14 +7,18 @@ __INCLUDE_INSTALL__=defined
|
||||
Source include/config
|
||||
Source include/check
|
||||
Source include/platforms
|
||||
|
||||
Source include/virtualProject
|
||||
Source include/applyEnv
|
||||
BUILD_TARGET=""
|
||||
|
||||
PlatformOpts=`AllPlatformOptionsComma`
|
||||
DefaultLongArgs="${PlatformOpts}platform:,with-debug,help"
|
||||
DefaultArgs="dhp:"
|
||||
DefaultLongArgs="${PlatformOpts}platform:,with-debug,help,parallel:"
|
||||
DefaultArgs="dhp:T"
|
||||
IsDebugBuild="N"
|
||||
DebType="bin"
|
||||
Parallel=false
|
||||
ProcessCount=8
|
||||
|
||||
ParseDefaultInstallArgs(){
|
||||
UnHandledOpt=
|
||||
@ -33,6 +37,11 @@ while [ -n $1 ]; do
|
||||
export NOSTRIP="NOSTRIP"
|
||||
IsDebugBuild="Y"
|
||||
;;
|
||||
"--parallel")
|
||||
Parallel=true
|
||||
ProcessCount=$2
|
||||
shift
|
||||
;;
|
||||
"--help" | "-h")
|
||||
Usage
|
||||
exit 0
|
||||
@ -68,6 +77,41 @@ if [ -z "$BUILD_OPT" ]; then
|
||||
fi
|
||||
}
|
||||
|
||||
_MVDIR() {
|
||||
local SOURCE="$1"
|
||||
local DEST="$2"
|
||||
|
||||
[ ! -d "$TmpInstDir/$SOURCE" ] && return
|
||||
|
||||
if [ -n "$(ls --almost-all "$TmpInstDir/$SOURCE")" ]; then
|
||||
echo "Move files from $SOURCE to $DEST"
|
||||
mkdir --parents "$TmpInstDir/$DEST"
|
||||
mv --no-clobber "$TmpInstDir/$SOURCE"/* "$TmpInstDir/$DEST"
|
||||
rmdir "$TmpInstDir/$SOURCE" || echo "Error"
|
||||
fi
|
||||
}
|
||||
|
||||
NormailizeTarballFHS() {
|
||||
local proj=$1
|
||||
NormailizeLIB ${proj}
|
||||
NormailizeBIN ${proj}
|
||||
NormailizeSBIN ${proj}
|
||||
}
|
||||
|
||||
NormailizeLIB() {
|
||||
_MVDIR "/usr/lib64" "/usr/lib"
|
||||
_MVDIR "/lib64" "/usr/lib"
|
||||
_MVDIR "/lib" "/usr/lib"
|
||||
}
|
||||
|
||||
NormailizeBIN() {
|
||||
_MVDIR "/bin" "/usr/bin"
|
||||
}
|
||||
|
||||
NormailizeSBIN() {
|
||||
_MVDIR "/sbin" "/usr/sbin"
|
||||
}
|
||||
|
||||
SetupInstallEnv(){
|
||||
local debugBuild=$1
|
||||
|
||||
@ -83,28 +127,23 @@ SetupInstallEnv(){
|
||||
[ -d "$DebPkgDir" ] || mkdir -p $DebPkgDir
|
||||
}
|
||||
|
||||
UnifyInstallProjects() {
|
||||
NormalizeInstallProjects() {
|
||||
local projectList=
|
||||
|
||||
for proj in $@; do
|
||||
projectList="${projectList} `basename ${proj}`"
|
||||
done
|
||||
|
||||
if ! projectList=$(${ScriptsDir}/ProjectDepends.py -p "${PLATFORM_ABBR}" ${projectList}) ; then
|
||||
CheckErrorOut 1 "Failed to get dependency list !!"
|
||||
fi
|
||||
|
||||
echo $projectList
|
||||
}
|
||||
|
||||
ExcludeProjects() {
|
||||
local projList=$@
|
||||
local retProjs=
|
||||
|
||||
retProjs=$(ExcludeList "$projList" "$(getPlatformExcludeProjs)")
|
||||
BuildMachineOnly || retProjs=$(ExcludeList "$retProjs" ".*-virtual-protection dsm-Protection")
|
||||
echo $retProjs
|
||||
}
|
||||
|
||||
InstallProject() {
|
||||
local proj=$1
|
||||
local baseProj="${proj}"
|
||||
local baseProj="`GetVirInstProjectName ${proj}`"
|
||||
local installScript=
|
||||
|
||||
cd $SourceDir/$baseProj
|
||||
@ -115,25 +154,42 @@ InstallProject() {
|
||||
fi
|
||||
|
||||
INFO "Execute install script: $installScript"
|
||||
(. $installScript)
|
||||
(
|
||||
. $installScript
|
||||
)
|
||||
|
||||
CheckProjectStatus install $proj > /dev/null
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
|
||||
SetupTmpInstDir() {
|
||||
local proj=$1
|
||||
TmpInstDir="/tmp/_install_${proj}"
|
||||
rm -rf "$TmpInstDir"
|
||||
mkdir -p "$TmpInstDir"
|
||||
}
|
||||
|
||||
SetupProjInstallEnv() {
|
||||
local proj=$1
|
||||
|
||||
if Is64BitProject "${proj}"; then
|
||||
INFO "ENV" "Using 64bit environment."
|
||||
ApplyInstallEnv "64"
|
||||
ApplyInstallEnv "64" "$proj"
|
||||
else
|
||||
INFO "ENV" "Using 32bit environment."
|
||||
ApplyInstallEnv "32"
|
||||
ApplyInstallEnv "32" "$proj"
|
||||
fi
|
||||
}
|
||||
|
||||
rm -rf $TmpInstDir/*
|
||||
CheckTarballExist() {
|
||||
local proj=$1
|
||||
local tarball=${proj}.txz
|
||||
|
||||
if [ ! -f "$TarBallDir/$tarball" ] && CheckInList "$proj" "$PlatformAppList"; then
|
||||
ERROR "No such file $TarBallDir/$tarball"
|
||||
fi
|
||||
}
|
||||
|
||||
CreateTarball() {
|
||||
@ -141,10 +197,9 @@ CreateTarball() {
|
||||
local haveFile=`ls $TmpInstDir`
|
||||
|
||||
if [ ! -z "$haveFile" ]; then
|
||||
echo ""
|
||||
echo "Create ${proj}.txz ..."
|
||||
( cd "$TmpInstDir"; XZ_OPT=-3 tar cJpvf "$TarBallDir/${proj}.txz" * )
|
||||
echo "[Done]"
|
||||
( cd "$TmpInstDir"; XZ_OPT=-3 tar cJpf "$TarBallDir/${proj}.txz" * )
|
||||
echo "Done"
|
||||
else
|
||||
INFO "WARNING" "$TmpInstDir is empty!"
|
||||
fi
|
||||
@ -156,8 +211,8 @@ InstallPreparePkgDir() # $1: Target Dir $2: Dir list
|
||||
TargetDir="$1"
|
||||
for dirmode in $2
|
||||
do
|
||||
DIR=`echo ${dirmode} | cut -f1 -d':'`
|
||||
MODE=`echo ${dirmode} | cut -f2 -d':' -s`
|
||||
DIR=`echo ${dirmode} | cut -f1 -d':'`
|
||||
MODE=`echo ${dirmode} | cut -f2 -d':' -s`
|
||||
if [ -n "${MODE}" ]; then
|
||||
MODE_ARG="-m ${MODE}"
|
||||
fi
|
||||
@ -201,54 +256,5 @@ InstallPkgFiles() # $1: Target Dir $2: Path $3: Default mode $4: FileList
|
||||
done
|
||||
}
|
||||
|
||||
InstallPrepareDir() # $1: Dir list
|
||||
{
|
||||
InstallPreparePkgDir "$TmpInstDir" "$@"
|
||||
}
|
||||
|
||||
InstallFiles() # $1: Path $2: Default mode $3: FileList
|
||||
{
|
||||
InstallPkgFiles "$TmpInstDir" "$@"
|
||||
}
|
||||
|
||||
DoInstall()
|
||||
{
|
||||
InstallPrepareDir "${INSTALL_DIRS}"
|
||||
|
||||
InstallFiles $LibDir 755 "${INSTALL_LIB}"
|
||||
InstallFiles "/bin" 755 "${INSTALL_BIN}"
|
||||
InstallFiles "/sbin" 755 "${INSTALL_SBIN}"
|
||||
InstallFiles "/usr/bin" 755 "${INSTALL_USR_BIN}"
|
||||
InstallFiles "/usr/sbin" 755 "${INSTALL_USR_SBIN}"
|
||||
InstallFiles "/usr/syno/bin" 755 "${INSTALL_SYNO_BIN}"
|
||||
InstallFiles "/usr/syno/sbin" 755 "${INSTALL_SYNO_SBIN}"
|
||||
InstallFiles "/usr/syno/etc/rc.d" 755 "${INSTALL_RCD}"
|
||||
InstallFiles "/etc" 644 "${INSTALL_ETC}"
|
||||
InstallFiles "/etc/pam.d/" 644 "${INSTALL_PAM}"
|
||||
InstallFiles "/usr/syno/etc" 644 "${INSTALL_SYNO_ETC}"
|
||||
InstallFiles "/usr/local/bin" 755 "${INSTALL_LOCAL_BIN}"
|
||||
InstallFiles "/usr/local/sbin" 755 "${INSTALL_LOCAL_SBIN}"
|
||||
InstallFiles "/usr/local/etc/rc.d" 755 "${INSTALL_LOCAL_RCD}"
|
||||
InstallFiles "/usr/local/etc" 644 "${INSTALL_LOCAL_ETC}"
|
||||
}
|
||||
|
||||
is_support_apparmor() {
|
||||
SupportAppArmorPlatform
|
||||
}
|
||||
|
||||
_create_empty_tgz() {
|
||||
touch ${TarBallDir}/${ThisProj}.tar
|
||||
gzip ${TarBallDir}/${ThisProj}.tar
|
||||
mv ${TarBallDir}/${ThisProj}.tar.gz ${TarBallDir}/${ThisProj}.tgz
|
||||
}
|
||||
|
||||
_create_empty_txz() {
|
||||
tar cJf "$TarBallDir/${ThisProj}.txz" --files-from /dev/null
|
||||
}
|
||||
|
||||
SkipThisProject() {
|
||||
_create_empty_txz
|
||||
}
|
||||
|
||||
fi
|
||||
# vim: ft=sh
|
||||
|
107
include/parallel
Normal file
107
include/parallel
Normal file
@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_PARALLEL__" ]; then
|
||||
__INCLUDE_PARALLEL__=defined
|
||||
|
||||
|
||||
ParallelAvailable() {
|
||||
# only check sem existance once.
|
||||
if [ -z "$__PARALLEL_AVAILABLE" ]; then
|
||||
which sem &>/dev/null
|
||||
__PARALLEL_AVAILABLE=$?
|
||||
|
||||
if [ $__PARALLEL_AVAILABLE -eq 0 ]; then
|
||||
SEM_OPTION="--gnu"
|
||||
|
||||
if [ -z "$SEM_VERSION" ]; then
|
||||
SEM_VERSION="$(parallel --version | grep -E "parallel [0-9]+" | awk '{print $NF;}')"
|
||||
fi
|
||||
if [ "$SEM_VERSION" -ge 20131122 ]; then
|
||||
SEM_OPTION="$SEM_OPTION --no-notice"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
return $__PARALLEL_AVAILABLE
|
||||
}
|
||||
|
||||
ParallelCheckEnvironment() {
|
||||
# User has disabled parallel function.
|
||||
if [ "$__Parallel_enable" == false ]; then
|
||||
return 0
|
||||
fi
|
||||
if ! ParallelAvailable; then
|
||||
echo "******************************************************************" 1>&2
|
||||
echo "Warning: Cannot found sem command in your system." 1>&2
|
||||
echo "Please install parallel package on your build system to enable parallel function." 1>&2
|
||||
echo 1>&2
|
||||
echo "Ubuntu: apt-get install parallel" 1>&2
|
||||
echo "Arch: pacman -S parallel" 1>&2
|
||||
echo "******************************************************************" 1>&2
|
||||
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
ParallelEnable() {
|
||||
if ! ParallelAvailable; then
|
||||
__Parallel_enable=false
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
__Parallel_enable=true
|
||||
return 0
|
||||
}
|
||||
|
||||
ParallelDisable() {
|
||||
__Parallel_enable=false
|
||||
return 0
|
||||
}
|
||||
|
||||
__Parallel_id() {
|
||||
echo "$$"
|
||||
}
|
||||
|
||||
__ParallelRunCond() {
|
||||
ParallelAvailable && ${__Parallel_enable:-true}
|
||||
}
|
||||
|
||||
ParallelInit() {
|
||||
if __ParallelRunCond; then
|
||||
ParallelCleanSemaphore
|
||||
trap "NoticeGandalf update_abort && ParallelCleanSemaphore" HUP TERM
|
||||
trap "NoticeGandalf update_abort && ParallelCleanSemaphore 130" INT
|
||||
trap "ParallelCleanSemaphore" EXIT
|
||||
fi
|
||||
}
|
||||
|
||||
ParallelExecute() {
|
||||
if __ParallelRunCond; then
|
||||
sem $SEM_OPTION --id "$(__Parallel_id)" -j "${PARALLEL_JOBS:-+0}" "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
ParallelWait() {
|
||||
if __ParallelRunCond; then
|
||||
sem $SEM_OPTION --wait --id "$(__Parallel_id)"
|
||||
fi
|
||||
}
|
||||
|
||||
ParallelCleanSemaphore() {
|
||||
local return_value="$1"
|
||||
|
||||
if __ParallelRunCond; then
|
||||
rm -rf ~/.parallel/semaphores/id-$(__Parallel_id)
|
||||
fi
|
||||
|
||||
if [ -n "$return_value" ]; then
|
||||
exit "$return_value"
|
||||
fi
|
||||
}
|
||||
|
||||
fi
|
53
include/parallelbuild
Normal file
53
include/parallelbuild
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
# Check if a Project is able to be parallelized by
|
||||
# make -j
|
||||
#
|
||||
# Param $1: Prjoect name
|
||||
# Return: 0 if ok, 1 if no
|
||||
ProjectParallelizable()
|
||||
{
|
||||
# virtual project with suffix -virtual-, they will not in the list of SeqProjs
|
||||
# We need to de-virtualize those project to get the real project
|
||||
local Proj=$(GetVirtualProjectName $1)
|
||||
for checkproj in ${SeqProjs}; do
|
||||
if [ "${checkproj}" = "$Proj" ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Print projects that CANNOT build in parallel
|
||||
# $ProjectList: project list to be checked
|
||||
PrintSeqProject()
|
||||
{
|
||||
for ThisProj in ${ProjectList}; do
|
||||
for checkproj in ${SeqProjs}; do
|
||||
if [ "${checkproj}" = "${ThisProj}" ]; then
|
||||
echo -n "${ThisProj} "
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# Print projects that CAN build in parallel
|
||||
# $ProjectList: project list to be checked
|
||||
PrintParaProject()
|
||||
{
|
||||
for ThisProj in ${ProjectList}; do
|
||||
Found="No"
|
||||
for checkproj in ${SeqProjs}; do
|
||||
if [ "${checkproj}" = "${ThisProj}" ]; then
|
||||
Found="Yes"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ ${Found} != "Yes" ]; then
|
||||
echo -n "${ThisProj} "
|
||||
fi
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
pkg_warn() {
|
||||
local ret=$?
|
||||
@ -13,59 +13,24 @@ pkg_log() {
|
||||
return $ret
|
||||
}
|
||||
|
||||
get_var_from_envmak() {
|
||||
local var="$1"
|
||||
shift
|
||||
local envmaks="$@"
|
||||
local ret=
|
||||
local defaultSearchPath="/env.mak /env32.mak"
|
||||
|
||||
for f in "${envmaks[@]}" $defaultSearchPath; do
|
||||
if [ ! -r "$f" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
ret=$(grep "^$var=" "$f" | cut -d= -f2)
|
||||
|
||||
if [ -n "$ret" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$ret" ]; then
|
||||
pkg_warn "get_var_from_envmak: can not extract $var from '[$envmaks $defaultSearchPath]'"
|
||||
return 1
|
||||
else
|
||||
echo "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_get_platform() { # [path of env.mak (default: /env.mak)]
|
||||
# @see synopkg/lib/pkgtool.cpp:77: gSystemArchMapping
|
||||
pkg_get_platform() {
|
||||
local arch=
|
||||
declare -f AskPlatform &>/dev/null || . /pkgscripts/include/platforms
|
||||
declare -f AskPlatform &>/dev/null || . /pkgscripts/include/check
|
||||
declare -f AskPlatform &>/dev/null || return 1
|
||||
|
||||
local abbr=$(AskPlatform && echo $PLATFORM_ABBR)
|
||||
local buildTarget=$(AskPlatform && echo $BUILD_TARGET)
|
||||
|
||||
|
||||
local PLATFORM_ABBR=$(get_var_from_envmak PLATFORM_ABBR "$1" 2> /dev/null) || return 1
|
||||
if [ -n "$PLATFORM_ABBR" ]; then
|
||||
case "$PLATFORM_ABBR" in
|
||||
6281) arch="88f6281" ;;
|
||||
x64) arch="x86" ;;
|
||||
*) arch="$PLATFORM_ABBR" ;;
|
||||
esac
|
||||
fi
|
||||
if [ -z "$arch" ]; then
|
||||
local SYNO_PLATFORM=$(get_var_from_envmak SYNO_PLATFORM "$1") || return 1
|
||||
case "$SYNO_PLATFORM" in
|
||||
MARVELL_88F6281) arch="88f6281" ;;
|
||||
PPC_QORIQ) arch="qoriq" ;;
|
||||
X64) arch="x86" ;;
|
||||
case "$buildTarget" in
|
||||
BROMOLOW) arch="bromolow" ;;
|
||||
BROADWELLNK) arch="broadwellnk" ;;
|
||||
DENVERTON) arch="denverton" ;;
|
||||
REALTEK_RTD1296) arch="rtd1296" ;;
|
||||
APOLLOLAKE) arch="apollolake" ;;
|
||||
GRANTLEY) arch="grantley" ;;
|
||||
CEDARVIEW) arch="cedarview" ;;
|
||||
AVOTON) arch="avoton" ;;
|
||||
BRASWELL) arch="braswell" ;;
|
||||
BRASWELL) arch="braswell" ;;
|
||||
APOLLOLAKE) arch="apollolake" ;;
|
||||
MARVELL_ARMADAXP) arch="armadaxp" ;;
|
||||
MARVELL_ARMADA370) arch="armada370" ;;
|
||||
MARVELL_ARMADA375) arch="armada375" ;;
|
||||
@ -73,45 +38,30 @@ pkg_get_platform() { # [path of env.mak (default: /env.mak)]
|
||||
MINDSPEED_COMCERTO2K) arch="comcerto2k" ;;
|
||||
ALPINE) arch="alpine" ;;
|
||||
STM_MONACO) arch="monaco" ;;
|
||||
MARVELL_ARMADA38X) arch="armada38x" ;;
|
||||
MARVELL_ARMADA37XX) arch="armada37xx" ;;
|
||||
HISILICON_HI3535) arch="hi3535" ;;
|
||||
BROADWELL) arch="broadwell" ;;
|
||||
KVMX64) arch="kvmx64" ;;
|
||||
GRANTLEY) arch="grantley" ;;
|
||||
DOCKERX64) arch="dockerx64" ;;
|
||||
BROADWELLNK) arch="broadwellnk" ;;
|
||||
KVMX64) arch="kvmx64" ;;
|
||||
MARVELL_ARMADA38X) arch="armada38x" ;;
|
||||
REALTEK_RTD1296) arch="rtd1296" ;;
|
||||
DENVERTON) arch="denverton" ;;
|
||||
MARVELL_ARMADA37XX) arch="armada37xx" ;;
|
||||
PURLEY) arch="purley" ;;
|
||||
GEMINILAKE) arch="geminilake" ;;
|
||||
V1000) arch="v1000" ;;
|
||||
*) arch="" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
[ -z "$arch" ] && { echo "[ERROR] cannot get platform arch" && exit 1; }
|
||||
echo "$arch"
|
||||
}
|
||||
|
||||
plat_to_unified_plat() {
|
||||
local plat="$1"
|
||||
local unified_plat=
|
||||
|
||||
case "$plat" in
|
||||
x86 | bromolow | cedarview | avoton | braswell | broadwell | dockerx64 | kvmx64 | grantley | denverton | apollolake | broadwellnk)
|
||||
unified_plat="x86 bromolow cedarview avoton braswell broadwell dockerx64 kvmx64 grantley denverton apollolake broadwellnk"
|
||||
;;
|
||||
# alpine and alpine4k use same define.
|
||||
alpine | alpine4k )
|
||||
unified_plat="alpine alpine4k"
|
||||
;;
|
||||
*)
|
||||
unified_plat="$plat"
|
||||
;;
|
||||
esac
|
||||
echo "$unified_plat"
|
||||
}
|
||||
|
||||
plat_to_family() {
|
||||
local plat="$1"
|
||||
local family=
|
||||
|
||||
case "$plat" in
|
||||
x86 | bromolow | cedarview | avoton | braswell | broadwell | dockerx64 | kvmx64 | grantley | denverton | apollolake | broadwellnk)
|
||||
bromolow | cedarview | avoton | braswell | apollolake | grantley | broadwell | kvmx64 | denverton | broadwellnk | purley | geminilake | v1000 )
|
||||
family="x86_64"
|
||||
;;
|
||||
evansport )
|
||||
@ -120,17 +70,11 @@ plat_to_family() {
|
||||
alpine | alpine4k )
|
||||
family="armv7"
|
||||
;;
|
||||
88f6281 )
|
||||
family="armv5"
|
||||
;;
|
||||
qoriq )
|
||||
family="ppc"
|
||||
;;
|
||||
rtd1296 | armada37xx)
|
||||
rtd1296 | armada37xx )
|
||||
family="armv8"
|
||||
;;
|
||||
# armv7 not ready platforms.
|
||||
comcerto2k | armada370 | armada375 | armadaxp | monaco | armada38x | hi3535)
|
||||
comcerto2k | armada370 | armada375 | armadaxp | monaco | armada38x | rtd1296 )
|
||||
family="$plat"
|
||||
;;
|
||||
*)
|
||||
@ -142,149 +86,121 @@ plat_to_family() {
|
||||
return 0
|
||||
}
|
||||
|
||||
pkg_get_unified_platform() { # [path of env.mak (default: /env.mak)]
|
||||
# @see synopkg/lib/pkgtool.cpp:77: gSystemArchMapping
|
||||
local plat=$(pkg_get_platform "$1") || return 1
|
||||
|
||||
plat_to_unified_plat "$plat"
|
||||
}
|
||||
|
||||
pkg_get_platform_family() { # [path of env.mak (default: /env.mak)]
|
||||
# @see synopkg/lib/pkgtool.cpp:77: gSystemArchMapping
|
||||
local plat=$(pkg_get_platform "$1") || return 1
|
||||
pkg_get_platform_family() {
|
||||
local plat=$(pkg_get_platform) || return 1
|
||||
|
||||
plat_to_family "$plat"
|
||||
}
|
||||
|
||||
pkg_get_spk_platform() { # [path of env.mak (default: /env.mak)]
|
||||
# @see synopkg/lib/pkgtool.cpp:77: gSystemArchMapping
|
||||
local plat=$(pkg_get_platform "$1") || return 1
|
||||
local spk_plat=
|
||||
case "$plat" in
|
||||
88f6281)
|
||||
spk_plat="88f628x"
|
||||
;;
|
||||
*)
|
||||
spk_plat="$plat"
|
||||
;;
|
||||
esac
|
||||
echo "$spk_plat"
|
||||
pkg_get_spk_platform() {
|
||||
local plat=$(pkg_get_platform) || return 1
|
||||
echo "$plat"
|
||||
}
|
||||
|
||||
pkg_get_product_name() {
|
||||
local platform=$arch
|
||||
product_name="Synology NAS"
|
||||
echo "$product_name"
|
||||
}
|
||||
|
||||
pkg_get_os_name() {
|
||||
local platform=$arch
|
||||
case "$platform" in
|
||||
*)
|
||||
os_name="DSM"
|
||||
;;
|
||||
esac
|
||||
echo "$os_name"
|
||||
}
|
||||
|
||||
pkg_get_string() {
|
||||
local file="$1"
|
||||
local sec="$2"
|
||||
local key="$3"
|
||||
local text="$(sed -n '/^\['$sec'\]/,/^'$key'/s/'$key'.*=[^"]*"\(.*\)"/\1/p' "$file")"
|
||||
local product_name_original="_DISKSTATION_"
|
||||
local product_name=$(pkg_get_product_name)
|
||||
local os_name_original="_OSNAME_"
|
||||
local os_name=$(pkg_get_os_name)
|
||||
local idx=0
|
||||
|
||||
shift 3
|
||||
for val in "$@"; do
|
||||
text="${text/\{$idx\}/$val}"
|
||||
let idx=1+$idx
|
||||
# Run *.sh under $1 to create scripts; e.g. scripts or WIZARD_UIFILES
|
||||
pkg_create_scripts() {
|
||||
[ ! -d "$1" ] && return
|
||||
local exe= prefix= list=
|
||||
cd $1
|
||||
for exe in `ls *.sh`; do
|
||||
sh $exe
|
||||
prefix=`echo $exe | sed 's/.sh$//'`
|
||||
list="$list $1/$prefix $1/${prefix}_*"
|
||||
done
|
||||
|
||||
echo "$text" | sed -e "s/${product_name_original}/${product_name}/g" | sed -e "s/${os_name_original}/${os_name}/g"
|
||||
cd - > /dev/null
|
||||
echo "$list"
|
||||
}
|
||||
|
||||
pkg_get_spk_unified_platform() { # [path of env.mak (default: /env.mak)]
|
||||
# @see synopkg/lib/pkgtool.cpp:77: gSystemArchMapping
|
||||
local plat=$(pkg_get_platform "$1") || return 1
|
||||
local spk_unified_platform=
|
||||
check_bash_ver_ge_4() {
|
||||
if [ ${BASH_VERSION:0:1} -ge 4 ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
case "$plat" in
|
||||
88f6281)
|
||||
spk_unified_platform="88f628x"
|
||||
;;
|
||||
x86 | bromolow | cedarview | avoton | braswell | broadwell | dockerx64 | kvmx64 | grantley | denverton | apollolake | broadwellnk)
|
||||
spk_unified_platform="x64"
|
||||
;;
|
||||
alpine | alpine4k )
|
||||
spk_unified_platform="alpine"
|
||||
;;
|
||||
*)
|
||||
spk_unified_platform="$plat"
|
||||
check_deprecate() {
|
||||
declare -A key_map=(["os_min_ver"]="firmware")
|
||||
local key=$1
|
||||
# Check whether necessary have deprecated key
|
||||
case $key in
|
||||
os_min_ver)
|
||||
echo "Warning: Exist deprecated key \"${key_map[$key]}\" for \"$key\" after version 6.1-14715" >&2
|
||||
deprecate_key=${key_map[$key]}
|
||||
return 1
|
||||
;;
|
||||
*) return 0
|
||||
esac
|
||||
echo "$spk_unified_platform"
|
||||
}
|
||||
|
||||
check_necessary_field() {
|
||||
# $1: necessary keys in map structure
|
||||
# $2: retrieved keys in map structure
|
||||
local -n nec_map=$1
|
||||
local -n key_map=$2
|
||||
|
||||
for key in ${!nec_map[@]}; do
|
||||
if [ ${nec_map[$key]} -eq 0 ]; then
|
||||
if [ ! -z ${!key+x} ]; then
|
||||
# necessary fields are not defined in INFO.sh
|
||||
# e.g. maintainer in pkg_init_info
|
||||
echo "$key=\"${!key}\""
|
||||
else
|
||||
check_deprecate $key
|
||||
local ret_val=$?
|
||||
if [ $ret_val -eq 0 ]; then
|
||||
echo "Error: Found unspecified necessary field \"$key\" without deprecated key" >&2
|
||||
else
|
||||
local deprecate_is_written=false
|
||||
for key_read in ${!key_map[@]}; do
|
||||
# Check whether we have retrieved keys that are deprecated keys
|
||||
if [ $key_read == $deprecate_key ] && [ ! -z ${!key_read+x} ]; then
|
||||
deprecate_is_written=true
|
||||
echo "Warning: Found specified deprecated key for \"$key\"" >&2
|
||||
break
|
||||
fi
|
||||
done
|
||||
if ! $deprecate_is_written; then
|
||||
echo "Error: Found unspecified necessary field \"$key\" without specified deprecated key" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
pkg_dump_info() {
|
||||
local fields="package version maintainer maintainer_url distributor distributor_url arch exclude_arch model
|
||||
adminprotocol adminurl adminport firmware dsmuidir dsmappname checkport allow_altport
|
||||
startable helpurl report_url support_center
|
||||
install_reboot install_dep_packages install_conflict_packages install_dep_services
|
||||
install_break_packages instuninst_restart_services install_type install_replace_packages
|
||||
startstop_restart_services start_dep_services silent_install silent_upgrade silent_uninstall
|
||||
checksum package_icon package_icon_120 package_icon_128 package_icon_144 package_icon_256
|
||||
thirdparty support_conf_folder log_collector
|
||||
support_aaprofile auto_upgrade_from offline_install precheckstartstop description displayname
|
||||
beta ctl_stop ctl_uninstall os_max_ver os_min_ver"
|
||||
local langs="enu cht chs krn ger fre ita spn jpn dan nor sve nld rus plk ptb ptg hun trk csy"
|
||||
local f= lan= file= sec= key=
|
||||
local fields="package version maintainer maintainer_url distributor distributor_url arch exclude_arch model exclude_model
|
||||
adminprotocol adminurl adminport firmware dsmuidir dsmappname dsmapppage dsmapplaunchname checkport allow_altport
|
||||
startable helpurl report_url support_center install_reboot install_dep_packages install_conflict_packages install_dep_services
|
||||
instuninst_restart_services startstop_restart_services start_dep_services silent_install silent_upgrade silent_uninstall install_type
|
||||
checksum package_icon package_icon_120 package_icon_128 package_icon_144 package_icon_256 thirdparty support_conf_folder
|
||||
auto_upgrade_from offline_install precheckstartstop os_min_ver os_max_ver beta ctl_stop ctl_install ctl_uninstall
|
||||
install_break_packages install_replace_packages use_deprecated_replace_mechanism"
|
||||
local f=
|
||||
|
||||
for f in $fields; do
|
||||
if [ -n "${!f}" ]; then
|
||||
echo $f=\"${!f}\"
|
||||
fi
|
||||
done
|
||||
|
||||
for lang in $langs; do
|
||||
description="description_${lang}"
|
||||
if [ -n "${!description}" ]; then
|
||||
echo "${description}=\"${!description}\""
|
||||
fi
|
||||
displayname="displayname_${lang}"
|
||||
if [ -n "${!displayname}" ]; then
|
||||
echo "${displayname}=\"${!displayname}\""
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
pkg_get_tar_option() {
|
||||
local version_file="/PkgVersion"
|
||||
|
||||
echo "cJf"
|
||||
}
|
||||
|
||||
pkg_make_package() { # <source path> <dest path>
|
||||
pkg_make_inner_tarball $@
|
||||
}
|
||||
pkg_make_inner_tarball() { # <source path> <dest path>
|
||||
local source_path=$1
|
||||
local dest_path=$2
|
||||
local package_name="package.tgz"
|
||||
local temp_extractsize="extractsize_tmp"
|
||||
local pkg_size=
|
||||
local tar_option="$(pkg_get_tar_option)"
|
||||
local tar_option="cJf"
|
||||
|
||||
# check parameters
|
||||
if [ -z "$source_path" -o ! -d "$source_path" ]; then
|
||||
pkg_warn "pkg_make_inner_tarball: bad parameters, please set source dir"
|
||||
pkg_warn "pkg_make_package: bad parameters, please set source dir"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$dest_path" -o ! -d "$dest_path" ]; then
|
||||
pkg_warn "pkg_make_inner_tarball: bad parameters, please set destination dir"
|
||||
pkg_warn "pkg_make_package: bad parameters, please set destination dir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -337,10 +253,6 @@ pkg_get_spk_name() { #<info path> [package name]
|
||||
__get_spk_name pkg_get_spk_platform $@
|
||||
}
|
||||
|
||||
pkg_get_spk_unified_name() { #<info path> [package name]
|
||||
__get_spk_name pkg_get_spk_unified_platform $@
|
||||
}
|
||||
|
||||
pkg_get_spk_family_name() { #<info path> [package name]
|
||||
__get_spk_name pkg_get_platform_family $@
|
||||
}
|
||||
@ -372,10 +284,10 @@ pkg_make_spk() { # <source path> <dest path> <spk file name>
|
||||
spk_name=${3:-`pkg_get_spk_name $info_path`}
|
||||
# add extractsize to INFO
|
||||
pkg_size=`cat $source_path/$temp_extractsize`
|
||||
echo "extractsize=${pkg_size}" >> $info_path
|
||||
echo "extractsize=\"${pkg_size}\"" >> $info_path
|
||||
rm "$source_path/$temp_extractsize"
|
||||
|
||||
echo toolkit_version=$DSM_BUILD_NUM >> $info_path
|
||||
echo "toolkit_version=\"$DSM_BUILD_NUM\"" >> $info_path
|
||||
echo "create_time=\"$(date +%Y%m%d-%T)\"" >> $info_path
|
||||
|
||||
# tar .spk file
|
||||
|
@ -12,7 +12,8 @@ ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i68
|
||||
# For sdk usbcam
|
||||
HOST32=armle-unknown-linux
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_MARVELL_88F6281 -O2"
|
||||
PLAT_FLAGS="-DSYNO_MARVELL_88F6281"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2 -mcpu=marvell-f"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -27,7 +28,7 @@ StaticDir32="/usr/armle-linux-gnueabi-uclibc"
|
||||
StaticPrefix32="/usr/armle-linux-gnueabi-uclibc/bin/arm-uclibc-"
|
||||
StaticInclude32="${StaticDir32}/include"
|
||||
StaticLib32="${StaticDir32}/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY -DSYNO_MARVELL_88F6281"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY"
|
||||
STATIC_LDFLAGS32="-L${StaticLib32}"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
@ -40,3 +41,4 @@ KernelToolchain="gcc464_glibc215_88f6281"
|
||||
ToolchainTGZList="$KernelToolchain uclibc09332_88f6281"
|
||||
SynoKernelConfig="88f6281"
|
||||
SynoGNUSources="628x"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
41
include/platform.853x
Normal file
41
include/platform.853x
Normal file
@ -0,0 +1,41 @@
|
||||
ToolChainDir32="/usr/local/powerpc-none-linux-gnuspe"
|
||||
ToolChainPrefix32="/usr/local/powerpc-none-linux-gnuspe/bin/powerpc-none-linux-gnuspe-"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/powerpc-none-linux-gnuspe/libc"
|
||||
ToolChainBin32="${ToolChainSysRoot32}/usr/bin"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
ARCH="powerpc"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_PPC"
|
||||
|
||||
ConfigOpt32="--host=powerpc-unknown-linux --target=powerpc-unknown-linux --build=i686-pc-linux"
|
||||
# For sdk usbcam
|
||||
HOST32=powerpc-unknown-linux
|
||||
|
||||
CFLAGS32="-mcpu=8548 -mhard-float -mfloat-gprs=double -D$PLATFORM_FAMILY -DSYNO_PPC_853X -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
StaticDir32="/usr/ppc10xx-linux-uclibc"
|
||||
StaticPrefix32="/usr/ppc10xx-linux-uclibc/bin/powerpc-uclibc-"
|
||||
StaticInclude32="/usr/ppc10xx-linux-uclibc/include"
|
||||
StaticLib32="/usr/ppc10xx-linux-uclibc/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY -DSYNO_PPC_853X"
|
||||
STATIC_LDFLAGS32="-L/usr/ppc10xx-linux-uclibc/lib"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
STATIC_AR32=${StaticPrefix32}ar
|
||||
STATIC_STRIP32=${StaticPrefix32}strip
|
||||
STATIC_RANLIB32=${StaticPrefix32}ranlib
|
||||
STATIC_NM32=${StaticPrefix32}nm
|
||||
|
||||
KernelToolchain="gcc4374_eglibc2874_qoriq"
|
||||
ToolchainTGZList="$KernelToolchain uclibc0929_qoriq freescale-2010.09 uclibc09321_qoriq gcc452_glibc213_qoriq"
|
||||
SynoKernelConfig="ppc8533"
|
||||
SynoGNUSources="85xx"
|
37
include/platform.88f6281
Normal file
37
include/platform.88f6281
Normal file
@ -0,0 +1,37 @@
|
||||
ToolChainDir32="/usr/local/arm-marvell-linux-gnueabi/arm-marvell-linux-gnueabi"
|
||||
ToolChainPrefix32="/usr/local/arm-marvell-linux-gnueabi/bin/arm-marvell-linux-gnueabi-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/libc/include"
|
||||
ToolChainLib32="${ToolChainDir32}/libc/lib"
|
||||
ToolChainSysRoot="${ToolChainDir32}"
|
||||
ARCH="arm"
|
||||
|
||||
ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=armle-unknown-linux
|
||||
|
||||
CFLAGS32="-I${ToolChainInclude32} -DSYNO_MARVELL_88F6281 -O2"
|
||||
LDFLAGS32="-L${ToolChainLib32}"
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
StaticDir32="/usr/armle-linux-gnueabi-uclibc"
|
||||
StaticPrefix32="/usr/armle-linux-gnueabi-uclibc/bin/arm-uclibc-"
|
||||
StaticInclude32="${StaticDir32}/include"
|
||||
StaticLib32="${StaticDir32}/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -DSYNO_MARVELL_88F6281"
|
||||
STATIC_LDFLAGS32="-L${StaticLib32}"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
STATIC_AR32=${StaticPrefix32}ar
|
||||
STATIC_STRIP32=${StaticPrefix32}strip
|
||||
STATIC_RANLIB32=${StaticPrefix32}ranlib
|
||||
STATIC_NM32=${StaticPrefix32}nm
|
||||
SYNO_KERNEL_SOURCE_DIR="linux-2.6.32"
|
@ -13,7 +13,7 @@ ConfigOpt32="--host=arm-unknown-linux-gnueabi --target=arm-unknown-linux-gnueabi
|
||||
HOST32=armle-unknown-linux
|
||||
|
||||
PLAT_FLAGS="-DSYNO_ANNAPURNA_ALPINE"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY ${PLAT_FLAGS} -O2 -mfloat-abi=hard -march=armv7ve -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2 -mfloat-abi=hard -march=armv7ve -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -24,8 +24,9 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc472_glibc215_alpine"
|
||||
UBootToolchain="gcc472_glibc215_alpine"
|
||||
SynoKernelConfig="alpine"
|
||||
SynoGNUSources="alpine"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
1
include/platform.alpine310
Symbolic link
1
include/platform.alpine310
Symbolic link
@ -0,0 +1 @@
|
||||
platform.alpine
|
@ -13,7 +13,7 @@ ConfigOpt32="--host=arm-unknown-linux-gnueabi --target=arm-unknown-linux-gnueabi
|
||||
HOST32=armle-unknown-linux
|
||||
|
||||
PLAT_FLAGS="-DSYNO_ANNAPURNA_ALPINE -DSYNO_ANNAPURNA_ALPINE4K"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY ${PLAT_FLAGS} -O2 -mfloat-abi=hard -march=armv7ve -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2 -mfloat-abi=hard -march=armv7ve -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -24,8 +24,9 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc472_glibc215_alpine"
|
||||
UBootToolchain="gcc472_glibc215_alpine"
|
||||
SynoKernelConfig="alpine4k"
|
||||
SynoGNUSources="alpine4k"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
@ -24,19 +24,6 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
StaticDir32="/usr/i686-linux-uclibc"
|
||||
StaticPrefix32="/usr/i686-linux-uclibc/bin/i386-uclibc-"
|
||||
StaticInclude32="${StaticDir32}/include"
|
||||
StaticLib32="${StaticDir32}/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY"
|
||||
STATIC_LDFLAGS32="-L${StaticLib32}"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
STATIC_AR32=${StaticPrefix32}ar
|
||||
STATIC_STRIP32=${StaticPrefix32}strip
|
||||
STATIC_RANLIB32=${StaticPrefix32}ranlib
|
||||
STATIC_NM32=${StaticPrefix32}nm
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
@ -61,19 +48,6 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
StaticDir64="/usr/x86_64-linux-uclibc"
|
||||
StaticPrefix64="/usr/x86_64-linux-uclibc/bin/x86_64-uclibc-"
|
||||
StaticInclude64="${StaticDir64}/include"
|
||||
StaticLib64="${StaticDir64}/lib"
|
||||
STATIC_CFLAGS64="-I${StaticInclude64} -D$PLATFORM_FAMILY"
|
||||
STATIC_LDFLAGS64="-L${StaticLib64}"
|
||||
STATIC_CC64=${StaticPrefix64}gcc
|
||||
STATIC_LD64=${StaticPrefix64}ld
|
||||
STATIC_AR64=${StaticPrefix64}ar
|
||||
STATIC_STRIP64=${StaticPrefix64}strip
|
||||
STATIC_RANLIB64=${StaticPrefix64}ranlib
|
||||
STATIC_NM64=${StaticPrefix64}nm
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
@ -96,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64 uclibc09332_i686 uclibc09332_x86_64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="apollolake"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -12,7 +12,8 @@ ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i68
|
||||
# For sdk usbcam
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNO_MARVELL_ARMADA370 -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
PLAT_FLAGS="-DSYNO_MARVELL_ARMADA370"
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -23,8 +24,9 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc445_glibc211_softfp_armada370"
|
||||
UBootToolchain="gcc445_glibc211_softfp_armada370"
|
||||
SynoKernelConfig="armada370"
|
||||
SynoGNUSources="armada370"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
@ -13,7 +13,8 @@ ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i68
|
||||
# For sdk usbcam
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3 -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -DSYNO_MARVELL_ARMADA375 -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
PLAT_FLAGS="-DSYNO_MARVELL_ARMADA375"
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3 -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -24,8 +25,9 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc464_glibc215_softfp_armada375"
|
||||
UBootToolchain="gcc464_glibc215_softfp_armada375"
|
||||
SynoKernelConfig="armada375"
|
||||
SynoGNUSources="armada375"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
@ -1,17 +1,17 @@
|
||||
ToolChainDir32="/usr/local/aarch64-unknown-linux-gnueabi"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/aarch64-unknown-linux-gnueabi-"
|
||||
ToolChainDir32="/usr/local/aarch64-unknown-linux-gnu"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/aarch64-unknown-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/aarch64-unknown-linux-gnueabi/sysroot"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/aarch64-unknown-linux-gnu/sysroot"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
|
||||
ARCH="arm64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV8"
|
||||
|
||||
ConfigOpt32="--host=aarch64-unknown-linux-gnueabi --target=aarch64-unknown-linux-gnueabi --build=x86_64-build_pc-linux-gnu"
|
||||
ConfigOpt32="--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-build_pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=aarch64-unknown-linux-gnueabi/
|
||||
HOST32=aarch64-unknown-linux-gnu/
|
||||
|
||||
PLAT_FLAGS="-DSYNO_MARVELL_ARMADA37XX"
|
||||
CFLAGS32="-I${ToolChainInclude32} -D$PLATFORM_FAMILY -O2 -mcpu=cortex-a53 -march=armv8-a -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
@ -26,18 +26,18 @@ NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
|
||||
ToolChainDir64="/usr/local/aarch64-unknown-linux-gnueabi"
|
||||
ToolChainPrefix64="${ToolChainDir64}/bin/aarch64-unknown-linux-gnueabi-"
|
||||
ToolChainDir64="/usr/local/aarch64-unknown-linux-gnu"
|
||||
ToolChainPrefix64="${ToolChainDir64}/bin/aarch64-unknown-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/aarch64-unknown-linux-gnueabi/sys-root/usr/include/"
|
||||
ToolChainInclude64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/aarch64-unknown-linux-gnueabi/sysroot/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/aarch64-unknown-linux-gnueabi/sysroot/"
|
||||
ToolChainLib64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sysroot/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sysroot/"
|
||||
|
||||
ConfigOpt64="--host=aarch64-unknown-linux-gnueabi --target=aarch64-unknown-linux-gnueabi --build=x86_64-build_pc-linux-gnu"
|
||||
ConfigOpt64="--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-build_pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=aarch64-unknown-linux-gnueabi
|
||||
HOST64=aarch64-unknown-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
@ -50,8 +50,9 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
KernelToolchain="gcc494_glibc220_armv8"
|
||||
KernelToolchain="gcc730_glibc226_armv8"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hard"
|
||||
SynoKernelConfig="armada37xx"
|
||||
SynoGNUSources="armada37xx"
|
||||
QemuStatic="qemu-aarch64-static"
|
||||
|
@ -10,7 +10,8 @@ PLATFORM_FAMILY="SYNOPLAT_F_ARMV7"
|
||||
ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i686-pc-linux"
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3 -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -DSYNO_MARVELL_ARMADA38X -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
PLAT_FLAGS="-DSYNO_MARVELL_ARMADA38X"
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3 -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -21,9 +22,10 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
SynoKernelConfig="armada38x"
|
||||
SynoGNUSources="armada38x"
|
||||
|
||||
BRINGUP_VERSION=5.2
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
@ -12,7 +12,8 @@ ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i68
|
||||
# For sdk usbcam
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3-d16 -DSYNO_MARVELL_ARMADAXP -D$PLATFORM_FAMILY -O2 -mhard-float -mfpu=vfpv3 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
PLAT_FLAGS="-DSYNO_MARVELL_ARMADAXP"
|
||||
CFLAGS32="-mhard-float -mfpu=vfpv3-d16 -D$PLATFORM_FAMILY -O2 -mhard-float -mfpu=vfpv3 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -23,8 +24,9 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc445_glibc211_softfp_armada370"
|
||||
UBootToolchain="gcc445_glibc211_softfp_armada370"
|
||||
SynoKernelConfig="armadaxp"
|
||||
SynoGNUSources="armadaxp"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
11
include/platform.avoton
Executable file → Normal file
11
include/platform.avoton
Executable file → Normal file
@ -12,7 +12,8 @@ ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_AVOTON -O2"
|
||||
PLAT_FLAGS="-DSYNO_AVOTON"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -36,7 +37,7 @@ ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i68
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_AVOTON -O2"
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
@ -59,7 +60,7 @@ GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY -DSYNO_AVOTON"
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY "
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
@ -69,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="avoton"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -12,7 +12,8 @@ ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_BRASWELL -O2"
|
||||
PLAT_FLAGS="-DSYNO_BRASWELL"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -23,19 +24,6 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
StaticDir32="/usr/i686-linux-uclibc"
|
||||
StaticPrefix32="/usr/i686-linux-uclibc/bin/i386-uclibc-"
|
||||
StaticInclude32="${StaticDir32}/include"
|
||||
StaticLib32="${StaticDir32}/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY -DSYNO_BRASWELL"
|
||||
STATIC_LDFLAGS32="-L${StaticLib32}"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
STATIC_AR32=${StaticPrefix32}ar
|
||||
STATIC_STRIP32=${StaticPrefix32}strip
|
||||
STATIC_RANLIB32=${StaticPrefix32}ranlib
|
||||
STATIC_NM32=${StaticPrefix32}nm
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
@ -49,7 +37,7 @@ ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i68
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_BRASWELL -O2"
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
@ -60,19 +48,6 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
StaticDir64="/usr/x86_64-linux-uclibc"
|
||||
StaticPrefix64="/usr/x86_64-linux-uclibc/bin/x86_64-uclibc-"
|
||||
StaticInclude64="${StaticDir64}/include"
|
||||
StaticLib64="${StaticDir64}/lib"
|
||||
STATIC_CFLAGS64="-I${StaticInclude64} -D$PLATFORM_FAMILY -DSYNO_BRASWELL"
|
||||
STATIC_LDFLAGS64="-L${StaticLib64}"
|
||||
STATIC_CC64=${StaticPrefix64}gcc
|
||||
STATIC_LD64=${StaticPrefix64}ld
|
||||
STATIC_AR64=${StaticPrefix64}ar
|
||||
STATIC_STRIP64=${StaticPrefix64}strip
|
||||
STATIC_RANLIB64=${StaticPrefix64}ranlib
|
||||
STATIC_NM64=${StaticPrefix64}nm
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
@ -85,7 +60,7 @@ GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY -DSYNO_BRASWELL"
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
@ -95,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64 uclibc09332_i686 uclibc09332_x86_64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="braswell"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -24,19 +24,6 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
StaticDir32="/usr/i686-linux-uclibc"
|
||||
StaticPrefix32="/usr/i686-linux-uclibc/bin/i386-uclibc-"
|
||||
StaticInclude32="${StaticDir32}/include"
|
||||
StaticLib32="${StaticDir32}/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY -DSYNO_SAS"
|
||||
STATIC_LDFLAGS32="-L${StaticLib32}"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
STATIC_AR32=${StaticPrefix32}ar
|
||||
STATIC_STRIP32=${StaticPrefix32}strip
|
||||
STATIC_RANLIB32=${StaticPrefix32}ranlib
|
||||
STATIC_NM32=${StaticPrefix32}nm
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
@ -61,19 +48,6 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
StaticDir64="/usr/x86_64-linux-uclibc"
|
||||
StaticPrefix64="/usr/x86_64-linux-uclibc/bin/x86_64-uclibc-"
|
||||
StaticInclude64="${StaticDir64}/include"
|
||||
StaticLib64="${StaticDir64}/lib"
|
||||
STATIC_CFLAGS64="-I${StaticInclude64} -D$PLATFORM_FAMILY -DSYNO_SAS"
|
||||
STATIC_LDFLAGS64="-L${StaticLib64}"
|
||||
STATIC_CC64=${StaticPrefix64}gcc
|
||||
STATIC_LD64=${StaticPrefix64}ld
|
||||
STATIC_AR64=${StaticPrefix64}ar
|
||||
STATIC_STRIP64=${StaticPrefix64}strip
|
||||
STATIC_RANLIB64=${StaticPrefix64}ranlib
|
||||
STATIC_NM64=${StaticPrefix64}nm
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
@ -96,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64 uclibc09332_i686 uclibc09332_x86_64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="broadwell"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -24,19 +24,6 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
StaticDir32="/usr/i686-linux-uclibc"
|
||||
StaticPrefix32="/usr/i686-linux-uclibc/bin/i386-uclibc-"
|
||||
StaticInclude32="${StaticDir32}/include"
|
||||
StaticLib32="${StaticDir32}/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY -DSYNO_SAS"
|
||||
STATIC_LDFLAGS32="-L${StaticLib32}"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
STATIC_AR32=${StaticPrefix32}ar
|
||||
STATIC_STRIP32=${StaticPrefix32}strip
|
||||
STATIC_RANLIB32=${StaticPrefix32}ranlib
|
||||
STATIC_NM32=${StaticPrefix32}nm
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
@ -61,19 +48,6 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
StaticDir64="/usr/x86_64-linux-uclibc"
|
||||
StaticPrefix64="/usr/x86_64-linux-uclibc/bin/x86_64-uclibc-"
|
||||
StaticInclude64="${StaticDir64}/include"
|
||||
StaticLib64="${StaticDir64}/lib"
|
||||
STATIC_CFLAGS64="-I${StaticInclude64} -D$PLATFORM_FAMILY -DSYNO_SAS"
|
||||
STATIC_LDFLAGS64="-L${StaticLib64}"
|
||||
STATIC_CC64=${StaticPrefix64}gcc
|
||||
STATIC_LD64=${StaticPrefix64}ld
|
||||
STATIC_AR64=${StaticPrefix64}ar
|
||||
STATIC_STRIP64=${StaticPrefix64}strip
|
||||
STATIC_RANLIB64=${StaticPrefix64}ranlib
|
||||
STATIC_NM64=${StaticPrefix64}nm
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
@ -96,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64 uclibc09332_i686 uclibc09332_x86_64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="broadwellnk"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
76
include/platform.broadwellntb
Normal file
76
include/platform.broadwellntb
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_BROADWELLNTB"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="broadwellntb"
|
||||
SynoGNUSources="x86 x64"
|
76
include/platform.broadwellntbap
Normal file
76
include/platform.broadwellntbap
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_BROADWELLNTBAP"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="broadwellntbap"
|
||||
SynoGNUSources="x86 x64"
|
11
include/platform.bromolow
Executable file → Normal file
11
include/platform.bromolow
Executable file → Normal file
@ -12,7 +12,8 @@ ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_BROMOLOW -DSYNO_SAS -O2"
|
||||
PLAT_FLAGS="-DSYNO_BROMOLOW"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -35,7 +36,7 @@ ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i68
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_BROMOLOW -DSYNO_SAS -O2"
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
@ -58,7 +59,7 @@ GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY -DSYNO_BROMOLOW"
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
@ -68,7 +69,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="bromolow"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
74
include/platform.bromolowESM
Normal file
74
include/platform.bromolowESM
Normal file
@ -0,0 +1,74 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_BROMOLOW -DSYNO_SAS -DSYNO_ESM -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_BROMOLOW -DSYNO_SAS -DSYNO_ESM -O2 -fPIC"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY -DSYNO_BROMOLOW -fPIC"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc473_glibc217_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc463_glibc213_i686"
|
||||
SynoKernelConfig="bromolow"
|
||||
SynoGNUSources="x86 x64"
|
11
include/platform.cedarview
Executable file → Normal file
11
include/platform.cedarview
Executable file → Normal file
@ -12,7 +12,8 @@ ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_CEDARVIEW -O2"
|
||||
PLAT_FLAGS="-DSYNO_CEDARVIEW"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -36,7 +37,7 @@ ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i68
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_CEDARVIEW -O2"
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
@ -59,7 +60,7 @@ GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY -DSYNO_CEDARVIEW"
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
@ -69,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="cedarview"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
76
include/platform.coffeelake
Normal file
76
include/platform.coffeelake
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_COFFEELAKE"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="coffeelake"
|
||||
SynoGNUSources="x86 x64"
|
7
include/platform.comcerto2k
Normal file → Executable file
7
include/platform.comcerto2k
Normal file → Executable file
@ -12,12 +12,12 @@ ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i68
|
||||
# For sdk usbcam
|
||||
HOST32=armle-unknown-linux
|
||||
|
||||
|
||||
PLAT_FLAGS="-DSYNO_MINDSPEED_COMCERTO2K"
|
||||
CFLAGS32="${PLAT_FLAGS} -D$PLATFORM_FAMILY -O2 -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2 -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
CXXSTANDARD="-std=c++11"
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
@ -26,7 +26,8 @@ NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc464_glibc217_soft_comcerto gcc454_glibc214_soft_comcerto uclibc09332_comcerto2k"
|
||||
ToolchainTGZList="$KernelToolchain gcc464_glibc217_soft_comcerto gcc454_glibc214_soft_comcerto"
|
||||
UBootToolchain="gcc454_glibc214_soft_comcerto"
|
||||
SynoKernelConfig="comcerto2k"
|
||||
SynoGNUSources="comcerto2k"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
@ -70,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="denverton"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -70,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="dockerx64"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
6
include/platform.evansport
Executable file → Normal file
6
include/platform.evansport
Executable file → Normal file
@ -12,7 +12,8 @@ ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_EVANSPORT -DSYNO_X86 -O2"
|
||||
PLAT_FLAGS="-DSYNO_EVANSPORT"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_X86 -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -23,7 +24,8 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_i686"
|
||||
KernelToolchain="gcc730_glibc226_i686"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
SynoKernelConfig="evansport"
|
||||
SynoGNUSources="x86"
|
||||
QemuStatic="qemu-i386-static"
|
||||
|
76
include/platform.geminilake
Normal file
76
include/platform.geminilake
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_GEMINILAKE"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="geminilake"
|
||||
SynoGNUSources="x86 x64"
|
@ -70,7 +70,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="grantley"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -29,5 +29,6 @@ ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hi3535"
|
||||
SynoKernelConfig="hi3535"
|
||||
SynoGNUSources="hi3535"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
||||
BRINGUP_VERSION=5.2
|
||||
|
31
include/platform.hi3536
Normal file
31
include/platform.hi3536
Normal file
@ -0,0 +1,31 @@
|
||||
ToolChainDir32="/usr/local/arm-unknown-linux-gnueabi"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/arm-unknown-linux-gnueabi-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/arm-unknown-linux-gnueabi/sysroot"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
ARCH="arm"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV7"
|
||||
|
||||
ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i686-pc-linux"
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
PLAT_FLAGS="-DSYNO_HISILICON_HI3536"
|
||||
CFLAGS32="-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -DSYNO_HISILICON_HI3536 -D$PLATFORM_FAMILY -O2 -mno-unaligned-access -fno-aggressive-loop-optimizations"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_softfp"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
SynoKernelConfig="hi3536"
|
||||
SynoGNUSources="hi3536"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
||||
BRINGUP_VERSION=6.1
|
31
include/platform.hi3536nvr
Normal file
31
include/platform.hi3536nvr
Normal file
@ -0,0 +1,31 @@
|
||||
ToolChainDir32="/usr/local/arm-unknown-linux-gnueabi"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/arm-unknown-linux-gnueabi-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/arm-unknown-linux-gnueabi/sysroot"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
ARCH="arm"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV7"
|
||||
|
||||
ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i686-pc-linux"
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
PLAT_FLAGS="-DSYNO_HISILICON_HI3536"
|
||||
CFLAGS32="-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 -DSYNO_HISILICON_HI3536 -DSYNO_HISILICON_HI3536NVR -D$PLATFORM_FAMILY -O2 -mno-unaligned-access -fno-aggressive-loop-optimizations"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_softfp"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
SynoKernelConfig="hi3536nvr"
|
||||
SynoGNUSources="hi3536nvr"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
||||
BRINGUP_VERSION=6.1
|
75
include/platform.kvmcloud
Normal file
75
include/platform.kvmcloud
Normal file
@ -0,0 +1,75 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_KVMCLOUD"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="kvmcloud"
|
||||
SynoGNUSources="x86 x64"
|
@ -69,7 +69,7 @@ GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="kvmx64"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -14,7 +14,7 @@ ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i68
|
||||
HOST32=arm-unknown-linux-gnueabi
|
||||
|
||||
PLAT_FLAGS="-DSYNO_STM_MONACO"
|
||||
CFLAGS32="-I${ToolChainInclude32} ${PLAT_FLAGS} -D$PLATFORM_FAMILY -O2 -mcpu=cortex-a9 -march=armv7-a -mfpu=neon -mfloat-abi=hard -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
CFLAGS32="-I${ToolChainInclude32} -D$PLATFORM_FAMILY -O2 -mcpu=cortex-a9 -march=armv7-a -mfpu=neon -mfloat-abi=hard -mthumb -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32="-L${ToolChainLib32}"
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -25,8 +25,9 @@ RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
KernelToolchain="gcc730_glibc226_hard"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hard"
|
||||
SynoKernelConfig="monaco"
|
||||
SynoGNUSources="monaco"
|
||||
QemuStatic="qemu-arm-static"
|
||||
|
75
include/platform.nextkvmx64
Normal file
75
include/platform.nextkvmx64
Normal file
@ -0,0 +1,75 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_NEXTKVMX64"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="nextkvmx64"
|
||||
SynoGNUSources="x86 x64"
|
33
include/platform.northstarplus
Normal file
33
include/platform.northstarplus
Normal file
@ -0,0 +1,33 @@
|
||||
ToolChainDir32="/usr/local/arm-cortexa9hf-linux-gnueabi"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/arm-cortexa9hf-linux-gnueabi-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/arm-cortexa9hf-linux-gnueabi/sysroot/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/arm-cortexa9hf-linux-gnueabi/sysroot/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/arm-cortexa9hf-linux-gnueabi/sysroot"
|
||||
ARCH="arm"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV7"
|
||||
|
||||
ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=arm-cortexa9hf-linux-gnueabi
|
||||
|
||||
#CFLAGS32="-I${ToolChainInclude32} -mhard-float -mfpu=vfpv3 -DSYNO_BROADCOM_NORTHSTARPLUS -O2"
|
||||
CFLAGS32="-DSYNO_BROADCOM_NORTHSTARPLUS -D$PLATFORM_FAMILY -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
KernelToolchain="gcc483_glibc219_hard"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hard"
|
||||
SynoKernelConfig="northstarplus"
|
||||
SynoGNUSources="northstarplus"
|
||||
|
||||
BRINGUP_VERSION=5.2
|
1
include/platform.ppc853x
Symbolic link
1
include/platform.ppc853x
Symbolic link
@ -0,0 +1 @@
|
||||
platform.853x
|
76
include/platform.purley
Normal file
76
include/platform.purley
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_PURLEY"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
ToolChainInclude64="${ToolChainSysRoot64}/usr/include"
|
||||
ToolChainLib64="${ToolChainSysRoot64}/lib"
|
||||
ToolChainSysInclude64=""
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_SAS -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="purley"
|
||||
SynoGNUSources="x86 x64"
|
@ -11,7 +11,8 @@ ConfigOpt32="--host=powerpc-unknown-linux --target=powerpc-unknown-linux --build
|
||||
# For sdk usbcam
|
||||
HOST32=powerpc-unknown-linux
|
||||
|
||||
CFLAGS32="-mcpu=8548 -mhard-float -mfloat-gprs=double -D$PLATFORM_FAMILY -DSYNO_PPC_QORIQ -O2"
|
||||
PLAT_FLAGS="-DSYNO_PPC_QORIQ"
|
||||
CFLAGS32="-mcpu=8548 -mhard-float -mfloat-gprs=double -D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -26,7 +27,7 @@ StaticDir32="/usr/ppc10xx-linux-uclibc"
|
||||
StaticPrefix32="/usr/ppc10xx-linux-uclibc/bin/powerpc-uclibc-"
|
||||
StaticInclude32="/usr/ppc10xx-linux-uclibc/include"
|
||||
StaticLib32="/usr/ppc10xx-linux-uclibc/lib"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY -DSYNO_PPC_QORIQ"
|
||||
STATIC_CFLAGS32="-I${StaticInclude32} -D$PLATFORM_FAMILY"
|
||||
STATIC_LDFLAGS32="-L/usr/ppc10xx-linux-uclibc/lib"
|
||||
STATIC_CC32=${StaticPrefix32}gcc
|
||||
STATIC_LD32=${StaticPrefix32}ld
|
||||
|
@ -1,17 +1,17 @@
|
||||
ToolChainDir32="/usr/local/aarch64-unknown-linux-gnueabi"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/aarch64-unknown-linux-gnueabi-"
|
||||
ToolChainDir32="/usr/local/aarch64-unknown-linux-gnu"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/aarch64-unknown-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/aarch64-unknown-linux-gnueabi/sysroot"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/aarch64-unknown-linux-gnu/sysroot"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
|
||||
ARCH="arm64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV8"
|
||||
|
||||
ConfigOpt32="--host=aarch64-unknown-linux-gnueabi --target=aarch64-unknown-linux-gnueabi --build=x86_64-build_pc-linux-gnu"
|
||||
ConfigOpt32="--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-build_pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=aarch64-unknown-linux-gnueabi/
|
||||
HOST32=aarch64-unknown-linux-gnu/
|
||||
|
||||
PLAT_FLAGS="-DSYNO_REALTEK_RTD1296"
|
||||
CFLAGS32="-I${ToolChainInclude32} -D$PLATFORM_FAMILY -O2 -mcpu=cortex-a53 -march=armv8-a -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
@ -26,18 +26,18 @@ NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
|
||||
ToolChainDir64="/usr/local/aarch64-unknown-linux-gnueabi"
|
||||
ToolChainPrefix64="${ToolChainDir64}/bin/aarch64-unknown-linux-gnueabi-"
|
||||
ToolChainDir64="/usr/local/aarch64-unknown-linux-gnu"
|
||||
ToolChainPrefix64="${ToolChainDir64}/bin/aarch64-unknown-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/aarch64-unknown-linux-gnueabi/sysroot/usr/include/"
|
||||
ToolChainInclude64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/aarch64-unknown-linux-gnueabi/sysroot/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/aarch64-unknown-linux-gnueabi/sysroot/"
|
||||
ToolChainLib64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sysroot/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sysroot/"
|
||||
|
||||
ConfigOpt64="--host=aarch64-unknown-linux-gnueabi --target=aarch64-unknown-linux-gnueabi --build=x86_64-build_pc-linux-gnu"
|
||||
ConfigOpt64="--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-build_pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=aarch64-unknown-linux-gnueabi
|
||||
HOST64=aarch64-unknown-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
@ -50,8 +50,9 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
KernelToolchain="gcc494_glibc220_armv8"
|
||||
KernelToolchain="gcc730_glibc226_armv8"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hard"
|
||||
SynoKernelConfig="rtd1296"
|
||||
SynoGNUSources="rtd1296"
|
||||
QemuStatic="qemu-aarch64-static"
|
||||
|
58
include/platform.rtd1619
Normal file
58
include/platform.rtd1619
Normal file
@ -0,0 +1,58 @@
|
||||
ToolChainDir32="/usr/local/aarch64-unknown-linux-gnu"
|
||||
ToolChainPrefix32="${ToolChainDir32}/bin/aarch64-unknown-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/aarch64-unknown-linux-gnu/sysroot"
|
||||
ToolChainInclude32="${ToolChainSysRoot32}/usr/include"
|
||||
ToolChainLib32="${ToolChainSysRoot32}/lib"
|
||||
|
||||
ARCH="arm64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV8"
|
||||
|
||||
ConfigOpt32="--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-build_pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=aarch64-unknown-linux-gnu/
|
||||
|
||||
PLAT_FLAGS="-DSYNO_REALTEK_RTD1619"
|
||||
CFLAGS32="-I${ToolChainInclude32} -D$PLATFORM_FAMILY -O2 -mcpu=cortex-a53 -march=armv8-a -fno-diagnostics-show-caret -Wno-unused-local-typedefs"
|
||||
LDFLAGS32="-L${ToolChainLib32}"
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
|
||||
ToolChainDir64="/usr/local/aarch64-unknown-linux-gnu"
|
||||
ToolChainPrefix64="${ToolChainDir64}/bin/aarch64-unknown-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sysroot/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/aarch64-unknown-linux-gnu/sysroot/"
|
||||
|
||||
ConfigOpt64="--host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu --build=x86_64-build_pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=aarch64-unknown-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
KernelToolchain="gcc730_glibc226_armv8"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hard"
|
||||
SynoKernelConfig="rtd1619"
|
||||
SynoGNUSources="rtd1619"
|
||||
QemuStatic="qemu-aarch64-static"
|
76
include/platform.skylaked
Normal file
76
include/platform.skylaked
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_SKYLAKED"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="skylaked"
|
||||
SynoGNUSources="x86 x64"
|
76
include/platform.v1000
Normal file
76
include/platform.v1000
Normal file
@ -0,0 +1,76 @@
|
||||
ToolChainDir32="/usr/local/i686-pc-linux-gnu"
|
||||
ToolChainPrefix32="/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainInclude32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/i686-pc-linux-gnu/sys-root"
|
||||
ARCH="x86_64"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_X86_64"
|
||||
|
||||
ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
PLAT_FLAGS="-DSYNO_V1000"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
LD32=${ToolChainPrefix32}ld
|
||||
AR32=${ToolChainPrefix32}ar
|
||||
STRIP32=${ToolChainPrefix32}strip
|
||||
RANLIB32=${ToolChainPrefix32}ranlib
|
||||
NM32=${ToolChainPrefix32}nm
|
||||
READELF32=${ToolChainPrefix32}readelf
|
||||
|
||||
ToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
ToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
ToolChainBin64="${ToolChainDir64}/bin"
|
||||
ToolChainInclude64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/usr/include/"
|
||||
ToolChainSysInclude64=""
|
||||
ToolChainLib64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root/lib"
|
||||
ToolChainSysRoot64="${ToolChainDir64}/x86_64-pc-linux-gnu/sys-root"
|
||||
|
||||
ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=""
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
LD64=${ToolChainPrefix64}ld
|
||||
AR64=${ToolChainPrefix64}ar
|
||||
STRIP64=${ToolChainPrefix64}strip
|
||||
RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
#For Grub in EFI framework
|
||||
GrubHOST64=x86_64-pc-linux-gnu
|
||||
|
||||
GrubToolChainDir64="/usr/local/x86_64-pc-linux-gnu"
|
||||
GrubToolChainPrefix64="/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-"
|
||||
GrubToolChainBin64="${GrubToolChainDir64}/bin"
|
||||
GrubToolChainInclude64="${GrubToolChainDir64}/include"
|
||||
GrubToolChainSysInclude64=""
|
||||
GrubToolChainLib64="${GrubToolChainDir64}/lib"
|
||||
|
||||
GrubConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i686-pc-linux-gnu"
|
||||
|
||||
GrubCFLAGS64="-I${GrubToolChainInclude64} -D$PLATFORM_FAMILY"
|
||||
GrubLDFLAGS64="-L${GrubToolChainLib64}"
|
||||
GrubCC64=${GrubToolChainPrefix64}gcc
|
||||
GrubCXX64=${GrubToolChainPrefix64}g++
|
||||
GrubLD64=${GrubToolChainPrefix64}ld
|
||||
GrubAR64=${GrubToolChainPrefix64}ar
|
||||
GrubSTRIP64=${GrubToolChainPrefix64}strip
|
||||
GrubRANLIB64=${GrubToolChainPrefix64}ranlib
|
||||
GrubNM64=${GrubToolChainPrefix64}nm
|
||||
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="v1000"
|
||||
SynoGNUSources="x86 x64"
|
9
include/platform.x64
Executable file → Normal file
9
include/platform.x64
Executable file → Normal file
@ -12,7 +12,8 @@ ConfigOpt32="--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --build=i686-pc
|
||||
# For sdk usbcam
|
||||
HOST32=i686-pc-linux-gnu
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_X64 -O2"
|
||||
PLAT_FLAGS="-DSYNO_X64"
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS32=""
|
||||
CC32=${ToolChainPrefix32}gcc
|
||||
CXX32=${ToolChainPrefix32}g++
|
||||
@ -36,7 +37,7 @@ ConfigOpt64="--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --build=i68
|
||||
# For sdk usbcam
|
||||
HOST64=x86_64-pc-linux-gnu
|
||||
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -DSYNO_X64 -O2"
|
||||
CFLAGS64="-D$PLATFORM_FAMILY -O2"
|
||||
LDFLAGS64=
|
||||
CC64=${ToolChainPrefix64}gcc
|
||||
CXX64=${ToolChainPrefix64}g++
|
||||
@ -47,7 +48,7 @@ RANLIB64=${ToolChainPrefix64}ranlib
|
||||
NM64=${ToolChainPrefix64}nm
|
||||
READELF64=${ToolChainPrefix64}readelf
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
KernelToolchain="gcc730_glibc226_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc730_glibc226_i686on64"
|
||||
SynoKernelConfig="x86_64"
|
||||
SynoGNUSources="x86 x64"
|
||||
|
@ -1,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_PLATFORMS__" ]; then
|
||||
__INCLUDE_PLATFORMS__=defined
|
||||
|
||||
Source "include/variable"
|
||||
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/init
|
||||
Source include/variable
|
||||
Source include/check
|
||||
|
||||
AllPlatformOptionNames="6281 alpine alpine4k apollolake armada370 armada375 armada37xx armada38x armadaxp avoton braswell broadwellnk broadwell bromolow cedarview comcerto2k denverton evansport hi3535 monaco qoriq x64 dockerx64 grantley kvmx64 rtd1296"
|
||||
AllPlatformOptionNames="bromolow cedarview armadaxp armada370 armada375 evansport comcerto2k avoton alpine braswell apollolake grantley alpine4k monaco broadwell kvmx64 armada38x denverton rtd1296 broadwellnk armada37xx purley geminilake v1000"
|
||||
|
||||
AllPlatforms=" bromolow BROMOLOW linux-3.10.x Intel Bromolow
|
||||
6281 MARVELL_88F6281 linux-2.6.32 Marvell 88F6281
|
||||
x64 X64 linux-3.10.x X64
|
||||
cedarview CEDARVIEW linux-3.10.x Intel Cedarview
|
||||
qoriq PPC_QORIQ linux-2.6.32 POWER PC QorIQ
|
||||
armadaxp MARVELL_ARMADAXP linux-3.x Marvell armadaxp
|
||||
armada370 MARVELL_ARMADA370 linux-3.x Marvell armada370
|
||||
armada375 MARVELL_ARMADA375 linux-3.x Marvell armada375
|
||||
@ -22,18 +21,19 @@ AllPlatforms=" bromolow BROMOLOW linux-3.10.x Intel Bromolow
|
||||
alpine ALPINE linux-3.10.x-bsp AnnapurnaLabs Alpine
|
||||
alpine4k ALPINE linux-3.10.x-bsp AnnapurnaLabs Alpine
|
||||
braswell BRASWELL linux-3.10.x Intel Braswell
|
||||
monaco STM_MONACO linux-3.10.x-bsp STM Monaco H412
|
||||
armada38x MARVELL_ARMADA38X linux-3.10.x-bsp Marvell armada38x
|
||||
hi3535 HISILICON_HI3535 linux-3.4.x Hisilicon Hi3535
|
||||
broadwell BROADWELL linux-3.10.x Intel Broadwell
|
||||
dockerx64 DOCKERX64 linux-3.10.x Synology Docker X64
|
||||
kvmx64 KVMX64 linux-3.10.x Virtual Machine
|
||||
apollolake APOLLOLAKE linux-4.4.x Intel Apollo Lake
|
||||
grantley GRANTLEY linux-3.10.x Intel Grantley
|
||||
apollolake APOLLOLAKE linux-4.4.x Intel Apollo Lake
|
||||
broadwell BROADWELL linux-4.4.x Intel Broadwell
|
||||
broadwellnk BROADWELLNK linux-4.4.x Intel Broadwell with new kernel
|
||||
monaco STM_MONACO linux-3.10.x-bsp STM Monaco H412
|
||||
kvmx64 KVMX64 linux-4.4.x Virtual Machine
|
||||
armada38x MARVELL_ARMADA38X linux-3.10.x-bsp Marvell armada38x
|
||||
rtd1296 REALTEK_RTD1296 linux-4.4.x Realtek rtd1296
|
||||
denverton DENVERTON linux-4.4.x Intel Denverton
|
||||
purley PURLEY linux-4.4.x Intel Purley
|
||||
armada37xx MARVELL_ARMADA37XX linux-4.4.x Marvell armada37xx
|
||||
broadwellnk BROADWELLNK linux-4.4.x Intel Broadwell with new kernel
|
||||
geminilake GEMINILAKE linux-4.4.x Intel Gemini Lake
|
||||
v1000 V1000 linux-4.4.x AMD Ryzen Embedded V1000
|
||||
"
|
||||
|
||||
#
|
||||
@ -44,8 +44,7 @@ AllPlatformOptions () {
|
||||
}
|
||||
|
||||
Is64BitPlatform() {
|
||||
local all64BitPlatforms="X64 BROMOLOW CEDARVIEW AVOTON BRASWELL BROADWELL DOCKERX64 KVMX64 GRANTLEY DENVERTON REALTEK_RTD1296 APOLLOLAKE BROADWELLNK"
|
||||
CheckInList $BUILD_TARGET $all64BitPlatforms && return 0 || return 1
|
||||
[ "$PLATFORM_FAMILY" = "SYNOPLAT_F_X86_64" ] || [ "$PLATFORM_FAMILY" = "SYNOPLAT_F_ARMV8" ]
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +52,7 @@ Is64BitPlatform() {
|
||||
# PLATFORM_ABBR, BUILD_TARGET, BUILD_OPT
|
||||
#
|
||||
# Usage
|
||||
# AskPlatfrom $@
|
||||
# AskPlatform $@
|
||||
AskPlatform()
|
||||
{
|
||||
# PLATFORM_ABBR BUILD_TARGET kernel_version Comment
|
||||
@ -81,16 +80,14 @@ AskPlatform()
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ -z "${!INDEX}" -a -f /env32.mak ]; then
|
||||
# Auto Detect the platform in env32.mak (genreated by SynoBuild & SynoGPLBuild)
|
||||
declare `grep ^SYNO_PLATFORM= /env32.mak`
|
||||
INDEX=TargetHash_${SYNO_PLATFORM}
|
||||
if [ -z "${!INDEX}" -a -f /root/.bashrc -a -f /root/.chroot ]; then
|
||||
PLATFORM_ABBR=$(grep "CCACHE_DIR=" /root/.bashrc | cut -d'"' -f2 | cut -d'/' -f3)
|
||||
INDEX=AbbrHash_${PLATFORM_ABBR}
|
||||
if [ -n "${!INDEX}" ]; then
|
||||
PLATFORM_ABBR="${AbbrArray[${!INDEX}]}"
|
||||
BUILD_TARGET=$SYNO_PLATFORM
|
||||
BUILD_TARGET=${TargetArray[${!INDEX}]}
|
||||
BUILD_OPT="--${PLATFORM_ABBR}"
|
||||
else
|
||||
echo "Failed to detect platform ($SYNO_PLATFORM) in env32.mak"
|
||||
echo "Failed to detect platform (\$platform) in /root/.bashrc"
|
||||
fi
|
||||
# Since alpine family share the same SYNO_PLATFORM, the above table scanning
|
||||
# falls back to the latest ALPINE entry (alpine4k), we have to use another
|
||||
@ -167,27 +164,18 @@ IsPlatformOption ()
|
||||
#
|
||||
LoadPlatformRelated()
|
||||
{
|
||||
[ "$BUILD_TARGET" = "CHROOT" ] && return 0
|
||||
|
||||
SYNO_KERNEL_SOURCE_DIR="`${ScriptsDir}/ProjectDepends.py -dp ${PLATFORM_ABBR}`"
|
||||
if [ -z "${SYNO_KERNEL_SOURCE_DIR}" ]; then
|
||||
echo "Error: Failed to match kernel dir ?!"
|
||||
echo "ScriptsDir=${ScriptsDir}, PLATFORM_ABBR=${PLATFORM_ABBR}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! source ${ScriptsDir}/include/platform.${PLATFORM_ABBR}; then
|
||||
echo "Failed to include ${ScriptsDir}/include/platform.${PLATFORM_ABBR}"
|
||||
return 1
|
||||
fi
|
||||
KernelDir="/source/${SYNO_KERNEL_SOURCE_DIR}"
|
||||
|
||||
export SYNO_PLATFORM="${BUILD_TARGET}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
PrepareKernelEnv()
|
||||
{
|
||||
cp -vf "$SynobiosDir/include/synobios.h" include/linux/synobios.h
|
||||
checkPlatformFunction() {
|
||||
CheckInList "$1" $PLAT_SPEC_VAR
|
||||
}
|
||||
|
||||
fi
|
||||
|
37
include/project.depends
Normal file → Executable file
37
include/project.depends
Normal file → Executable file
@ -1,43 +1,28 @@
|
||||
# first part, for project dependency
|
||||
[dynamic variable list]
|
||||
list="${Kernel} ${Desktop}"
|
||||
list="${Kernel}"
|
||||
|
||||
[variables]
|
||||
${KernelPacks}="synobios"
|
||||
|
||||
[project dependency]
|
||||
${KernelPacks}="${Kernel}" # must set here, to connect KernelPacks to KernelProjects
|
||||
|
||||
[64bit project dependency]
|
||||
|
||||
[${Desktop}]
|
||||
default="dsm"
|
||||
|
||||
#second part, kernel project for each platform
|
||||
[${Kernel}]
|
||||
x64="linux-3.10.x"
|
||||
bromolow="linux-3.10.x"
|
||||
cedarview="linux-3.10.x"
|
||||
grantley="linux-3.10.x"
|
||||
evansport="linux-3.x"
|
||||
avoton="linux-3.10.x"
|
||||
braswell="linux-3.10.x"
|
||||
6281="linux-2.6.32"
|
||||
qoriq="linux-2.6.32"
|
||||
apollolake="linux-4.4.x"
|
||||
broadwell="linux-4.4.x"
|
||||
broadwellnk="linux-4.4.x"
|
||||
armadaxp="linux-3.x"
|
||||
armada370="linux-3.x"
|
||||
armada375="linux-3.x"
|
||||
comcerto2k="linux-3.x"
|
||||
alpine="linux-3.10.x-bsp"
|
||||
alpine4k="linux-3.10.x-bsp"
|
||||
monaco="linux-3.10.x-bsp"
|
||||
armada38x="linux-3.10.x-bsp"
|
||||
hi3535="linux-3.4.x"
|
||||
broadwell="linux-3.10.x"
|
||||
dockerx64="linux-3.10.x"
|
||||
kvmx64="linux-4.4.x"
|
||||
grantley="linux-3.10.x"
|
||||
denverton="linux-4.4.x"
|
||||
apollolake="linux-4.4.x"
|
||||
monaco="linux-3.10.x-bsp"
|
||||
rtd1296="linux-4.4.x"
|
||||
armada38x="linux-3.10.x-bsp"
|
||||
denverton="linux-4.4.x"
|
||||
purley="linux-4.4.x"
|
||||
armada37xx="linux-4.4.x"
|
||||
broadwellnk="linux-4.4.x"
|
||||
geminilake="linux-4.4.x"
|
||||
v1000="linux-4.4.x"
|
||||
|
@ -1,57 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_PROJECTS__" ]; then
|
||||
__INCLUDE_PROJECTS__=defined
|
||||
|
||||
PreBuildProjects=""
|
||||
# Built-in projects in environment
|
||||
# Built-in but will not build, because PreBuildProject may compatible with it.
|
||||
BuiltinProjects="
|
||||
"
|
||||
|
||||
# Projects that fail to build in parallel
|
||||
SeqProjs="
|
||||
nettle-2.x
|
||||
sqlite-3.8.x
|
||||
e2fsprogs-1.42
|
||||
dbus-1.6.x
|
||||
p7zip-4.58
|
||||
ncurses-5.5
|
||||
libnet-1.x
|
||||
busybox-1.16.1
|
||||
openssl-1.0.0a
|
||||
openssl-1.0.x
|
||||
openssl-fips-2.0.x
|
||||
libfindhost
|
||||
gnu-efi-3.x
|
||||
grub-0.97-efi
|
||||
e2fsprogs-1.41.10
|
||||
e2fsprogs-1.41.12
|
||||
krb5-1.12.x
|
||||
cyrus-sasl-2.1.22
|
||||
net-snmp-5.4.2.1
|
||||
net-snmp-5.x
|
||||
bind-9.6.1-P1
|
||||
parted
|
||||
sds_sii
|
||||
perl-5.8.6
|
||||
synocksum
|
||||
memtester
|
||||
nss-3.12.4-with-nspr-4.8
|
||||
libsynoacl
|
||||
libhwcontrol
|
||||
openldap-2.3.11
|
||||
libgpg-error-1.7
|
||||
ipsec-tools-0.7.2
|
||||
freeradius-server-2.1.10
|
||||
freeradius-server-synovpn
|
||||
curlftpfs-0.9.2
|
||||
libnl-2.x
|
||||
compat-wireless
|
||||
ethtool-6
|
||||
synosyncfolder
|
||||
uClibc-0.9.33
|
||||
bash-4.x
|
||||
sysstat-10.x
|
||||
ctdb-2.5.x
|
||||
libplist-1.x
|
||||
"
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
||||
|
@ -1,23 +1,30 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import glob
|
||||
import subprocess
|
||||
import tempfile
|
||||
import shutil
|
||||
import re
|
||||
from subprocess import CalledProcessError
|
||||
|
||||
ScriptDir = os.path.realpath(os.path.dirname(__file__) + '/../../')
|
||||
ScriptDirName = os.path.basename(ScriptDir)
|
||||
SynoBase = os.path.dirname(ScriptDir)
|
||||
Prefix = os.path.dirname(SynoBase)
|
||||
SourceDir = SynoBase + "/source"
|
||||
|
||||
if 'lnxscripts' in os.path.basename(ScriptDir):
|
||||
__IsPkgEnv = False
|
||||
else:
|
||||
__IsPkgEnv = True
|
||||
__IsPkgEnv = True
|
||||
|
||||
VIRTUAL_PROJECT_SEPARATOR = "-virtual-"
|
||||
VIRINST_PROJECT_SEPARATOR = "-virinst-"
|
||||
ConfDir = 'SynoBuildConf'
|
||||
ProjectDependsName = "ProjectDepends.py"
|
||||
|
||||
__PkgEnvVersion = None
|
||||
|
||||
Prefix = SynoBase
|
||||
|
||||
|
||||
def setEnvironmentVersion(version):
|
||||
global __PkgEnvVersion
|
||||
@ -33,8 +40,10 @@ class Project:
|
||||
self.proj = proj
|
||||
self.allow_missing = allow_missing
|
||||
|
||||
if not inChroot():
|
||||
project_src = deVirtual(self.proj)
|
||||
if inChroot():
|
||||
project_src = deVirInst(self.proj)
|
||||
else:
|
||||
project_src = deVirtual(deVirInst(self.proj))
|
||||
|
||||
self.__project_dir = os.path.join(SourceDir, project_src)
|
||||
|
||||
@ -61,11 +70,6 @@ class Project:
|
||||
def settings(self, chroot=None):
|
||||
return self.__find_script('settings', chroot)
|
||||
|
||||
def collect(self, chroot=None):
|
||||
return self.__find_script('collect', chroot)
|
||||
|
||||
def selfcheck(self, chroot=None):
|
||||
return self.__find_script('selfcheck', chroot)
|
||||
|
||||
def info(self, chroot=None):
|
||||
return os.path.join(self.project_dir(chroot), 'INFO')
|
||||
@ -90,14 +94,59 @@ class Project:
|
||||
return ""
|
||||
|
||||
|
||||
class DpkgNotFoundError(RuntimeError):
|
||||
def __init__(self, deb_name):
|
||||
print("Deb %s not found" % deb_name)
|
||||
class Chroot():
|
||||
__platform = None
|
||||
__version = None
|
||||
|
||||
def __init__(self, platform, version=None):
|
||||
self.__platform = platform
|
||||
self.__version = version
|
||||
|
||||
def MountProc(self):
|
||||
return MountProc(self.__platform, self.__version)
|
||||
|
||||
def SynoBuild(self, args, **kwargs):
|
||||
return executeChrootScript(self.__platform, "SynoBuild", ["--" + self.__platform] + args, self.__version, **kwargs)
|
||||
|
||||
def SynoInstall(self, args, **kwargs):
|
||||
return executeChrootScript(self.__platform, "SynoInstall", ["--" + self.__platform] + args, self.__version, **kwargs)
|
||||
|
||||
def GetSynoBase(self):
|
||||
return getChrootSynoBase(self.__platform, self.__version)
|
||||
|
||||
def GetSourceDir(self):
|
||||
return getChrootSourceDir(self.__platform, self.__version)
|
||||
|
||||
def GetScriptDir(self):
|
||||
return self.GetSynoBase() + "/" + ScriptDirName
|
||||
|
||||
def ExecuteCommand(self, cmd):
|
||||
return executeChrootCommand(self.__platform, cmd, self.__version)
|
||||
|
||||
def ExecuteScript(self, script, args, **kwargs):
|
||||
return executeChrootScript(self.__platform, script, args, self.__version, **kwargs)
|
||||
|
||||
def LinkProject(self, proj):
|
||||
return LinkProject(proj, self.__platform, self.__version)
|
||||
|
||||
def LinkScript(self):
|
||||
return LinkScript(self.__platform, self.__version)
|
||||
|
||||
|
||||
class PlatformNotFoundException(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
class BuildFailedError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
def getIncludeVariable(include_file, variable):
|
||||
return subprocess.check_output('source %s/include/%s; echo $%s' % (ScriptDir, include_file, variable),
|
||||
shell=True, executable='/bin/bash').decode().strip()
|
||||
return subprocess.check_output(
|
||||
'source %s/include/init; source %s/include/%s; echo $%s' % (ScriptDir, ScriptDir, include_file, variable),
|
||||
shell=True,
|
||||
executable='/bin/bash'
|
||||
).decode().strip()
|
||||
|
||||
|
||||
def getChrootSynoBase(platform, version=None, suffix=None):
|
||||
@ -111,6 +160,47 @@ def getChrootSynoBase(platform, version=None, suffix=None):
|
||||
return Prefix + '/ds.' + platform
|
||||
|
||||
|
||||
def getChrootSourceDir(platform, version=None):
|
||||
return getChrootSynoBase(platform, version) + "/source"
|
||||
|
||||
|
||||
def executeChrootScript(platform, script, args, version=None, **kwargs):
|
||||
envOpt = []
|
||||
if 'env' in kwargs:
|
||||
envOpt = ['env']
|
||||
for k in kwargs['env']:
|
||||
envOpt.append("%s=%s" % (k, kwargs['env'][k]))
|
||||
|
||||
return subprocess.check_call(
|
||||
["chroot", getChrootSynoBase(platform, version)] + envOpt + ["/" + ScriptDirName + "/" + script] + args)
|
||||
|
||||
|
||||
def executeChrootCommand(platform, cmd, version=None):
|
||||
return subprocess.check_output(
|
||||
["chroot", getChrootSynoBase(platform, version)] + cmd).decode()
|
||||
|
||||
|
||||
def executeScript(script, args, **kwargs):
|
||||
if "suppressOutput" in kwargs and kwargs["suppressOutput"]:
|
||||
kwargs.pop("suppressOutput")
|
||||
with open(os.devnull, "w") as null:
|
||||
return subprocess.check_call([ScriptDir + "/" + script] + args, stdout=null, stderr=null, **kwargs)
|
||||
else:
|
||||
return subprocess.check_call([ScriptDir + "/" + script] + args, **kwargs)
|
||||
|
||||
|
||||
def ProjectDepends(args):
|
||||
return subprocess.check_output([ScriptDir + "/" + ProjectDependsName] + args).decode().rstrip().split()
|
||||
|
||||
|
||||
|
||||
def SynoBuild(platform, args, version=None):
|
||||
try:
|
||||
return executeChrootScript(platform, "SynoBuild", args, version)
|
||||
except CalledProcessError:
|
||||
raise BuildFailedError("Failed to SynoBuild(%s) on platform %s" % (str(args), platform))
|
||||
|
||||
|
||||
def getList(listName):
|
||||
ret = []
|
||||
for config in ["projects", "config"]:
|
||||
@ -122,15 +212,30 @@ def getList(listName):
|
||||
|
||||
return None
|
||||
|
||||
def getPlatformVariable(platform, var):
|
||||
return getIncludeVariable('platform.' + platform, var)
|
||||
|
||||
|
||||
def isVirtualProject(proj):
|
||||
return VIRTUAL_PROJECT_SEPARATOR in proj
|
||||
|
||||
|
||||
def isVirInstProject(proj):
|
||||
return VIRINST_PROJECT_SEPARATOR in proj
|
||||
|
||||
|
||||
def deVirtual(proj):
|
||||
return proj.split(VIRTUAL_PROJECT_SEPARATOR)[0]
|
||||
|
||||
|
||||
def deVirInst(proj):
|
||||
return proj.split(VIRINST_PROJECT_SEPARATOR)[0]
|
||||
|
||||
|
||||
def getBasedProject(proj):
|
||||
return deVirtual(deVirInst(proj))
|
||||
|
||||
|
||||
def getVirtualName(proj):
|
||||
if isVirtualProject(proj):
|
||||
return proj.split(VIRTUAL_PROJECT_SEPARATOR)[1]
|
||||
@ -138,12 +243,56 @@ def getVirtualName(proj):
|
||||
return ""
|
||||
|
||||
|
||||
def getVirInstName(proj):
|
||||
if isVirInstProject(proj):
|
||||
return proj.split(VIRINST_PROJECT_SEPARATOR)[1]
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def getVirtualProjectExtension(proj):
|
||||
if isVirtualProject(proj):
|
||||
return VIRTUAL_PROJECT_SEPARATOR + getVirtualName(proj)
|
||||
if isVirInstProject(proj):
|
||||
return VIRINST_PROJECT_SEPARATOR + getVirInstName(proj)
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
def IsPackageEnvironment():
|
||||
return __IsPkgEnv
|
||||
def EnvDeploy(args, **kwargs):
|
||||
try:
|
||||
return executeScript("EnvDeploy", args, **kwargs)
|
||||
except CalledProcessError:
|
||||
raise RuntimeError("Failed to EnvDeploy(%s) on " % str(args))
|
||||
|
||||
|
||||
def PkgCreate(args, **kwargs):
|
||||
try:
|
||||
return executeScript("PkgCreate.py", args, **kwargs)
|
||||
except CalledProcessError:
|
||||
raise BuildFailedError("Failed to PkgCreate(%s) on " % str(args))
|
||||
|
||||
def __linkFolder(src, tgt):
|
||||
if os.path.exists(tgt):
|
||||
shutil.rmtree(tgt)
|
||||
|
||||
print("Link " + src + " -> " + tgt)
|
||||
return subprocess.check_call(["cp", "-al", src, tgt])
|
||||
|
||||
|
||||
def LinkProject(proj, platform, version=None):
|
||||
return __linkFolder(SourceDir + "/" + deVirtual(proj), getChrootSourceDir(platform, version) + "/" + proj)
|
||||
|
||||
|
||||
def LinkScript(platform, version=None):
|
||||
return __linkFolder(ScriptDir, getChrootSynoBase(platform, version) + "/" + ScriptDirName)
|
||||
|
||||
|
||||
def MountProc(platform, version=None):
|
||||
mountpoint = getChrootSynoBase(platform, version) + "/proc"
|
||||
if not os.path.ismount(mountpoint):
|
||||
subprocess.check_call("mount -t proc none " + getChrootSynoBase(platform, version) + "/proc",
|
||||
shell=True)
|
||||
|
||||
def get_namespace():
|
||||
return os.path.basename(Prefix)
|
||||
|
0
include/python/__init__.py
Normal file
0
include/python/__init__.py
Normal file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
class cache(dict):
|
||||
def __init__(self, func):
|
||||
|
@ -1,42 +0,0 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
class Chroot:
|
||||
def umount(self):
|
||||
try:
|
||||
subprocess.check_call(['umount', os.path.join(self.chroot, 'proc')])
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
def mount(self):
|
||||
try:
|
||||
mount_point = os.path.join(self.chroot, 'proc')
|
||||
if not os.path.ismount(mount_point):
|
||||
subprocess.check_call(['mount', '-t', 'proc', 'none', mount_point])
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
def __init__(self, path):
|
||||
self.chroot = path
|
||||
self.orig_fd = os.open("/", os.O_RDONLY)
|
||||
self.chroot_fd = os.open(self.chroot, os.O_RDONLY)
|
||||
|
||||
def __enter__(self):
|
||||
self.mount()
|
||||
os.chroot(self.chroot)
|
||||
os.fchdir(self.chroot_fd)
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
os.fchdir(self.orig_fd)
|
||||
os.chroot(".")
|
||||
os.close(self.orig_fd)
|
||||
os.close(self.chroot_fd)
|
||||
self.umount()
|
||||
|
||||
def get_outside_path(self, path):
|
||||
return self.chroot + "/" + path
|
||||
|
||||
def get_inside_path(self, path):
|
||||
return path.replace(self.chroot, "")
|
41
include/python/commandrunner.py
Normal file
41
include/python/commandrunner.py
Normal file
@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
class RunShellFailed(Exception):
|
||||
def __init__(self, retcode, command, output=""):
|
||||
self.retcode = retcode
|
||||
self.command = command
|
||||
self.output = output
|
||||
super().__init__()
|
||||
|
||||
|
||||
def run(cmd, display=False, **kwargs):
|
||||
try:
|
||||
p = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
**kwargs
|
||||
)
|
||||
output = b""
|
||||
if display:
|
||||
for line in p.stdout:
|
||||
print(line.decode().rstrip())
|
||||
output += line
|
||||
p.wait()
|
||||
else:
|
||||
output, _ = p.communicate()
|
||||
except KeyboardInterrupt:
|
||||
p.kill()
|
||||
p.wait()
|
||||
raise
|
||||
|
||||
output = output.decode().rstrip()
|
||||
if p.returncode != 0:
|
||||
if output and not display:
|
||||
print(output)
|
||||
raise RunShellFailed(p.returncode, cmd, output)
|
||||
|
||||
return output
|
@ -1,7 +1,7 @@
|
||||
import os
|
||||
import configparser
|
||||
from collections import defaultdict
|
||||
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
class ConfigNotFoundError(RuntimeError):
|
||||
pass
|
||||
@ -51,7 +51,6 @@ class DependsParser(ConfigParser):
|
||||
sec_ref_tag = 'ReferenceOnly-Tag'
|
||||
sec_pack = 'PackagePacking'
|
||||
sec_pack_tag = 'PackagePacking-Tag'
|
||||
sec_unittest = 'Unittest'
|
||||
sec_default = 'default'
|
||||
|
||||
def convert_value_str(self, d):
|
||||
@ -85,9 +84,6 @@ class DependsParser(ConfigParser):
|
||||
def pack_tag(self):
|
||||
return self._get_section_keys(self.sec_ref_tag)
|
||||
|
||||
@property
|
||||
def unittest(self):
|
||||
return self._get_section_keys(self.sec_unittest)
|
||||
|
||||
def get_env_section(self, section):
|
||||
return self.convert_value_str(self.get_section_dict(section))
|
||||
@ -130,7 +126,7 @@ class ProjectDependsParser(ConfigParser):
|
||||
|
||||
def get_dyn_sec_value(self, dyn_var, platform):
|
||||
if dyn_var not in self.config:
|
||||
raise RuntimeError("[%s] not in project.depends." % dyn_var)
|
||||
raise RuntimeError("[{}] not in project.depends.".format(dyn_var))
|
||||
|
||||
if platform in self.get_section_dict(dyn_var):
|
||||
return self.get_section_dict(dyn_var)[platform][0]
|
||||
@ -138,6 +134,15 @@ class ProjectDependsParser(ConfigParser):
|
||||
return self.get_section_dict(dyn_var)['default'][0]
|
||||
|
||||
def get_dyn_sec_values(self, dyn_var, platforms):
|
||||
if dyn_var not in self.config:
|
||||
raise RuntimeError("[{}] not in project.depends.".format(dyn_var))
|
||||
|
||||
if not platforms:
|
||||
result = []
|
||||
for value in self.get_section_dict(dyn_var).values():
|
||||
result += value
|
||||
return list(set(result))
|
||||
|
||||
return [self.get_dyn_sec_value(dyn_var, _) for _ in platforms]
|
||||
|
||||
|
||||
|
109
include/python/exec_env.py
Normal file
109
include/python/exec_env.py
Normal file
@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import commandrunner
|
||||
|
||||
|
||||
class EnvError(RuntimeError):
|
||||
def __init__(self, title, stderr="", retcode=1):
|
||||
self.output = stderr
|
||||
self.retcode = retcode
|
||||
super().__init__(title, stderr)
|
||||
|
||||
|
||||
class ExecuteEnv(object):
|
||||
def __init__(self, chroot_dir):
|
||||
self.chroot_dir = chroot_dir
|
||||
|
||||
@property
|
||||
def platform(self):
|
||||
return os.path.basename(self.chroot_dir.split('-')[0].split("ds.")[1])
|
||||
|
||||
def execute(self, cmd, display=False, logfile="", **kwargs):
|
||||
raise NotImplementedError("execute not implemented")
|
||||
|
||||
def __enter__(self):
|
||||
raise NotImplementedError("__enter__ not implemented")
|
||||
|
||||
def __exit__(self, *args):
|
||||
raise NotImplementedError("__exit__ not implemented")
|
||||
|
||||
def get_file(self, filepath):
|
||||
raise NotImplementedError("get_file not implemented")
|
||||
|
||||
def get_path(self, path):
|
||||
return os.path.join(self.chroot_dir, path.lstrip("/"))
|
||||
|
||||
def remove(self, f):
|
||||
self.execute(['rm', '-rf', f], display=False)
|
||||
|
||||
def rename(self, old, new):
|
||||
self.execute(['mv', old, new], display=False)
|
||||
|
||||
def file_exists(self, f):
|
||||
raise NotImplementedError("file_exists not implemented")
|
||||
|
||||
def isfile(self, f):
|
||||
raise NotImplementedError("isfile not implemented")
|
||||
|
||||
def mkdtemp(self, dir="/tmp"):
|
||||
raise NotImplementedError("mkdtemp not implemented")
|
||||
|
||||
def makedirs(self, dir):
|
||||
raise NotImplementedError("makedirs not implemented")
|
||||
|
||||
def link(self, src, dest):
|
||||
self.execute(['ln', '-sf', src, dest])
|
||||
|
||||
|
||||
class ChrootEnv(ExecuteEnv):
|
||||
def execute(self, cmd, display=False, logfile="", **kwargs):
|
||||
mount_point = os.path.join(self.chroot_dir, 'proc')
|
||||
if not os.path.ismount(mount_point):
|
||||
subprocess.check_call(['mount', '-t', 'proc', 'none', mount_point])
|
||||
|
||||
if isinstance(cmd, list):
|
||||
cmd = ['chroot', self.chroot_dir] + cmd
|
||||
else:
|
||||
cmd = 'chroot {} '.format(self.chroot_dir) + cmd
|
||||
|
||||
try:
|
||||
output = commandrunner.run(cmd, display=display, **kwargs)
|
||||
except commandrunner.RunShellFailed as e:
|
||||
output = e.output
|
||||
raise EnvError(
|
||||
"Execute {} failed".format(cmd if isinstance(cmd, str) else " ".join(cmd)),
|
||||
stderr=output,
|
||||
retcode=e.retcode
|
||||
)
|
||||
finally:
|
||||
if logfile:
|
||||
with open(self.get_path(logfile), 'w') as fd:
|
||||
fd.write(output)
|
||||
return output
|
||||
|
||||
def get_file(self, filepath):
|
||||
ret = self.get_path(filepath)
|
||||
if not os.path.exists(ret):
|
||||
raise EnvError("{} not exists".format(ret))
|
||||
return ret
|
||||
|
||||
def file_exists(self, f):
|
||||
return os.path.exists(self.get_path(f))
|
||||
|
||||
def isfile(self, f):
|
||||
return os.path.isfile(self.get_path(f))
|
||||
|
||||
def mkdtemp(self, dir="/tmp"):
|
||||
return tempfile.mkdtemp(dir=self.get_path(dir))
|
||||
|
||||
def makedirs(self, dir):
|
||||
os.makedirs(self.get_path(dir))
|
||||
|
||||
def islink(self, f):
|
||||
return os.path.islink(self.get_path(f))
|
@ -1,3 +1,5 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
@ -21,10 +23,7 @@ def link(source, dest, verbase=False):
|
||||
raise LinkProjectError("%s not exist." % source)
|
||||
|
||||
print("Link %s -> %s" % (source, dest))
|
||||
if os.path.islink(source):
|
||||
subprocess.check_call(['cp', '-aH', source, dest])
|
||||
else:
|
||||
subprocess.check_call(['cp', '-al', source, dest])
|
||||
subprocess.check_call(['cp', '-al', source, dest])
|
||||
|
||||
|
||||
def link_scripts(chroot):
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import multiprocessing
|
||||
import traceback
|
||||
|
||||
PROCESSES = None
|
||||
|
||||
class LogExceptions(object):
|
||||
def __init__(self, callable):
|
||||
@ -19,7 +22,7 @@ class LogExceptions(object):
|
||||
|
||||
|
||||
def doParallel(func, items, *args, **kwargs):
|
||||
pool = multiprocessing.Pool(processes=None)
|
||||
pool = multiprocessing.Pool(processes=PROCESSES)
|
||||
results = []
|
||||
|
||||
try:
|
||||
@ -42,7 +45,7 @@ def doParallel(func, items, *args, **kwargs):
|
||||
|
||||
|
||||
def doPlatformParallel(func, platforms, *args, **kwargs):
|
||||
pool = multiprocessing.Pool(processes=None)
|
||||
pool = multiprocessing.Pool(processes=PROCESSES)
|
||||
results = dict()
|
||||
output = dict()
|
||||
|
||||
@ -65,7 +68,7 @@ def doPlatformParallel(func, platforms, *args, **kwargs):
|
||||
|
||||
|
||||
def parallelDict(dict):
|
||||
pool = multiprocessing.Pool(processes=multiprocessing.cpu_count())
|
||||
pool = multiprocessing.Pool(processes=PROCESSES)
|
||||
results = []
|
||||
output = []
|
||||
|
||||
|
216
include/python/pkgcommon.py
Normal file
216
include/python/pkgcommon.py
Normal file
@ -0,0 +1,216 @@
|
||||
#! /usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import sys
|
||||
from time import strftime, gmtime, time
|
||||
from subprocess import check_output, check_call, CalledProcessError, STDOUT
|
||||
import logging
|
||||
from include.python.exec_env import EnvError
|
||||
from pkgerror import PkgCreateError
|
||||
import BuildEnv
|
||||
|
||||
ScriptDir = os.path.dirname(os.path.dirname(
|
||||
os.path.dirname(os.path.abspath(__file__))))
|
||||
BaseDir = os.path.dirname(ScriptDir)
|
||||
ScriptName = os.path.basename(__file__)
|
||||
PkgScripts = '/pkgscripts-ng'
|
||||
sys.path.append(ScriptDir + '/include')
|
||||
|
||||
from parallel import doPlatformParallel
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
sh = logging.StreamHandler()
|
||||
sh.setLevel(logging.INFO)
|
||||
sh.setFormatter(logging.Formatter('%(message)s'))
|
||||
logger.addHandler(sh)
|
||||
|
||||
|
||||
def check_stage(package, stage):
|
||||
pkg_name = BuildEnv.deVirtual(package)
|
||||
customized = 'source/{}/SynoBuildConf/customized'.format(pkg_name)
|
||||
if '-virtual-' in package:
|
||||
customized = '{}-virtual-{}'.format(customized,
|
||||
package.split('-virtual-')[1])
|
||||
try:
|
||||
script = os.path.join(ScriptDir, 'SynoCustomize')
|
||||
# find SynoBuildConf
|
||||
customize_file = '{}/{}'.format(os.path.dirname(ScriptDir), customized)
|
||||
cmd = '{} -c {} {} 2>&1'.format(script, customize_file, stage)
|
||||
check_call(cmd, shell=True, stderr=STDOUT, executable="/bin/bash")
|
||||
except CalledProcessError:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def show_msg_block(msg, title=None, level=logging.INFO):
|
||||
if not msg:
|
||||
return
|
||||
|
||||
if level > logging.INFO:
|
||||
tok_s = "#"
|
||||
tok_e = "#"
|
||||
else:
|
||||
tok_s = "="
|
||||
tok_e = "-"
|
||||
|
||||
if title:
|
||||
logging.log(level, tok_s * 60)
|
||||
logging.log(level, "{:^60s}".format(title))
|
||||
logging.log(level, tok_e * 60)
|
||||
|
||||
if isinstance(msg, list):
|
||||
for line in msg:
|
||||
logging.log(level, line)
|
||||
else:
|
||||
logging.log(level, msg)
|
||||
logging.log(level, "")
|
||||
|
||||
|
||||
class Worker:
|
||||
def __init__(self, package, env_config):
|
||||
self.package = package
|
||||
self.env_config = env_config
|
||||
self.__time_log = None
|
||||
|
||||
def execute(self, *argv):
|
||||
if not self._check_executable():
|
||||
return
|
||||
|
||||
init_time = time()
|
||||
if hasattr(self, 'title'):
|
||||
logger.info("=" * 60)
|
||||
logger.info("{:^60s}".format('Start to run "%s"' % self.title))
|
||||
logger.info("-" * 60)
|
||||
self._process_output(self._run(*argv))
|
||||
logger.info("")
|
||||
self.__time_log = strftime('%H:%M:%S', gmtime(time() - init_time))
|
||||
|
||||
def _run(self):
|
||||
pass
|
||||
|
||||
def _check_executable(self):
|
||||
return True
|
||||
|
||||
def _process_output(self, output):
|
||||
pass
|
||||
|
||||
def get_time_cost(self):
|
||||
time_cost = []
|
||||
if hasattr(self, 'title') and self.__time_log:
|
||||
time_cost.append("%s: %s" % (self.__time_log, self.title))
|
||||
|
||||
return time_cost
|
||||
|
||||
|
||||
class CommandRunner(Worker):
|
||||
__log__ = None
|
||||
__error_msg__ = None
|
||||
__failed_exception__ = None
|
||||
|
||||
def _rename_log(self, suffix='.old'):
|
||||
if os.path.isfile(self.log):
|
||||
os.rename(self.log, self.log + suffix)
|
||||
|
||||
def _run(self, *argv):
|
||||
self._rename_log()
|
||||
cmd = self._wrap_cmd(self._get_command(*argv))
|
||||
|
||||
try:
|
||||
logger.info(" ".join(cmd))
|
||||
output = check_output(
|
||||
" ".join(cmd), stderr=STDOUT, shell=True, executable="/bin/bash").decode()
|
||||
self._post_hook()
|
||||
except CalledProcessError as e:
|
||||
output = e.output.decode()
|
||||
logger.error(output)
|
||||
raise self.__failed_exception__(self.__error_msg__)
|
||||
|
||||
return output
|
||||
|
||||
def _get_command(self):
|
||||
raise PkgCreateError("Not implement")
|
||||
|
||||
def _post_hook(self):
|
||||
pass
|
||||
|
||||
def _process_output(self, output):
|
||||
pass
|
||||
|
||||
def _wrap_cmd(self, cmd):
|
||||
return ["set -o pipefail;"] + cmd + ["2>&1", '|', 'tee', self.log]
|
||||
|
||||
@property
|
||||
def log(self):
|
||||
return os.path.join(BaseDir, self.__log__)
|
||||
|
||||
|
||||
# Run SynoBuild/SynoInstall in chroot
|
||||
class ChrootRunner(CommandRunner):
|
||||
def __init__(self, package, env_config, print_log=False):
|
||||
CommandRunner.__init__(self, package, env_config)
|
||||
self.print_log = print_log
|
||||
self.__log__ = None
|
||||
|
||||
def _process_output(self, output):
|
||||
msg = []
|
||||
log_file = []
|
||||
|
||||
for platform, failed_projs in output.items():
|
||||
if self.print_log:
|
||||
self._dump_log(platform)
|
||||
|
||||
if not failed_projs:
|
||||
continue
|
||||
|
||||
msg.append(self.__error_msg__ +
|
||||
' [%s] : %s' % (platform, " ".join(failed_projs)))
|
||||
log_file.append("Error log: " + self.get_platform_log(platform))
|
||||
|
||||
if msg:
|
||||
show_msg_block(
|
||||
msg + log_file, title=self.__error_msg__, level=logging.ERROR)
|
||||
raise self.__failed_exception__(self.__error_msg__)
|
||||
|
||||
def _dump_log(self, platform):
|
||||
log = self.get_platform_log(platform)
|
||||
with open(log, 'r') as fd:
|
||||
show_msg_block(fd.read().split("\n"),
|
||||
title=log, level=logging.ERROR)
|
||||
|
||||
def get_platform_log(self, platform):
|
||||
return os.path.join(self.env_config.get_chroot(platform), self.log)
|
||||
|
||||
def run_command(self, platform, *argv):
|
||||
cmd = self._get_command(platform, *argv)
|
||||
|
||||
try:
|
||||
logger.info("[%s] " % platform + " ".join(cmd))
|
||||
env = self.env_config.get_env(platform)
|
||||
env.execute(cmd, display=len(self.env_config.platforms)
|
||||
== 1, logfile=self.log)
|
||||
except EnvError:
|
||||
log = self.get_platform_log(platform)
|
||||
failed_projs = self.__parse_failed_projects(log)
|
||||
if not failed_projs:
|
||||
raise self.__failed_exception__(
|
||||
"%s failed." % (" ".join(cmd)), log)
|
||||
return failed_projs
|
||||
|
||||
def __parse_failed_projects(self, log):
|
||||
projects = []
|
||||
with open(log, 'r') as fd:
|
||||
for line in fd:
|
||||
if 'Error(s) occurred on project' not in line:
|
||||
continue
|
||||
projects.append(line.split('"')[1])
|
||||
|
||||
return projects
|
||||
|
||||
def _run(self):
|
||||
return doPlatformParallel(self.run_command, self.env_config.platforms)
|
||||
|
||||
@property
|
||||
def log(self):
|
||||
raise PkgCreateError("Not implemented")
|
98
include/python/pkgcustomize.py
Normal file
98
include/python/pkgcustomize.py
Normal file
@ -0,0 +1,98 @@
|
||||
#! /usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
from subprocess import check_call, STDOUT
|
||||
from pkgcommon import PkgScripts, ScriptDir, logger
|
||||
from pkgerror import BuildPackageError, InstallPacageError, LinkPackageError
|
||||
from pkguniform import ProjectLinker, PackageBuilder, PackageInstaller, PackageCollecter
|
||||
from parallel import doParallel
|
||||
from link_project import link_projects, LinkProjectError
|
||||
import BuildEnv
|
||||
|
||||
|
||||
def get_customized_file(package, need_de_virtual_pkg=False):
|
||||
if need_de_virtual_pkg:
|
||||
pkg_name = BuildEnv.deVirtual(package)
|
||||
else:
|
||||
pkg_name = package
|
||||
customized = "source/{}/SynoBuildConf/customized".format(pkg_name)
|
||||
if '-virtual-' in package:
|
||||
customized = "{}-virtual-{}".format(customized,
|
||||
package.split('-virtual-')[1])
|
||||
return customized
|
||||
|
||||
|
||||
def get_customize_cmd(script_dir, package, title):
|
||||
script = os.path.join(script_dir, 'SynoCustomize')
|
||||
need_de_virtual_pkg = False
|
||||
source_dirname = ""
|
||||
|
||||
if script_dir == ScriptDir:
|
||||
source_dirname = os.path.dirname(ScriptDir)
|
||||
need_de_virtual_pkg = True
|
||||
|
||||
customize_file = "{}/{}".format(source_dirname,
|
||||
get_customized_file(package, need_de_virtual_pkg))
|
||||
return ['env'] + [script, '-e', customize_file, title]
|
||||
|
||||
class PreBuilder(PackageBuilder):
|
||||
title = "PreBuilder"
|
||||
log = "logs.prebuild"
|
||||
__error_msg__ = "Failed to prebuild package."
|
||||
__failed_exception__ = BuildPackageError
|
||||
|
||||
def _get_command(self, platform):
|
||||
return get_customize_cmd(PkgScripts, self.package.name, self.title)
|
||||
|
||||
|
||||
class PostBuilder(PackageBuilder):
|
||||
title = "PostBuilder"
|
||||
log = "logs.postbuild"
|
||||
__error_msg__ = "Failed to postbuild package."
|
||||
__failed_exception__ = BuildPackageError
|
||||
|
||||
def _get_command(self, platform):
|
||||
return get_customize_cmd(PkgScripts, self.package.name, self.title)
|
||||
|
||||
|
||||
class PreInstaller(PackageInstaller):
|
||||
title = "PreInstaller"
|
||||
log = "logs.preinstall"
|
||||
__error_msg__ = "Failed to preinstall package."
|
||||
__failed_exception__ = InstallPacageError
|
||||
|
||||
def _get_command(self, platform):
|
||||
return get_customize_cmd(PkgScripts, self.package.name, self.title)
|
||||
|
||||
|
||||
class PostInstaller(PackageInstaller):
|
||||
title = "PostInstaller"
|
||||
log = "logs.postinstall"
|
||||
__error_msg__ = "Failed to postinstall package."
|
||||
__failed_exception__ = InstallPacageError
|
||||
|
||||
def _get_command(self, platform):
|
||||
return get_customize_cmd(PkgScripts, self.package.name, self.title)
|
||||
|
||||
|
||||
class PreCollecter(PackageCollecter):
|
||||
title = "PreCollecter"
|
||||
log = "logs.precollecter"
|
||||
|
||||
def _run(self):
|
||||
cmd = ' '.join(get_customize_cmd(
|
||||
ScriptDir, self.package.name, self.title))
|
||||
logger.info(cmd)
|
||||
return check_call(cmd, shell=True, stderr=STDOUT, executable="/bin/bash")
|
||||
|
||||
|
||||
class PostCollecter(PackageCollecter):
|
||||
title = "PostCollecter"
|
||||
log = "logs.postcollecter"
|
||||
|
||||
def _run(self):
|
||||
cmd = ' '.join(get_customize_cmd(
|
||||
ScriptDir, self.package.name, self.title))
|
||||
logger.info(cmd)
|
||||
return check_call(cmd, shell=True, stderr=STDOUT, executable="/bin/bash")
|
319
include/python/pkgdeploy.py
Normal file
319
include/python/pkgdeploy.py
Normal file
@ -0,0 +1,319 @@
|
||||
#! /usr/bin/env python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import logging
|
||||
import urllib.request
|
||||
import sys
|
||||
import shutil
|
||||
import json
|
||||
import hashlib
|
||||
from glob import glob
|
||||
from cache import cache
|
||||
import BuildEnv
|
||||
from toolkit import TarballManager
|
||||
from exec_env import ChrootEnv, EnvError
|
||||
from parallel import doPlatformParallel, doParallel
|
||||
from utils import move_old
|
||||
from version_file import VersionFile
|
||||
VersionMap = 'version_map'
|
||||
DownloadDir = os.path.join(BuildEnv.SynoBase, 'toolkit_tarballs')
|
||||
ToolkitServer = 'https://sourceforge.net/projects/dsgpl/files/toolkit'
|
||||
|
||||
|
||||
class EnvDeployError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
class TarballNotFoundError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
class PlatformNotAvailableError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
class DownloadToolkitError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
class EnvHookError(EnvDeployError):
|
||||
pass
|
||||
|
||||
|
||||
def set_log(log_name):
|
||||
log = os.path.join(BuildEnv.SynoBase, 'envdeploy.log')
|
||||
move_old(log)
|
||||
logfmt = '[%(asctime)s] %(levelname)s: %(message)s'
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format=logfmt,
|
||||
filename=log
|
||||
)
|
||||
|
||||
console = logging.StreamHandler()
|
||||
console.setLevel(logging.INFO)
|
||||
formatter = logging.Formatter(logfmt)
|
||||
console.setFormatter(formatter)
|
||||
logging.getLogger().addHandler(console)
|
||||
|
||||
|
||||
def link_project(projects, platforms, version):
|
||||
if type(projects) is str:
|
||||
projects = [projects]
|
||||
|
||||
for proj in projects:
|
||||
for platform in platforms:
|
||||
BuildEnv.LinkProject(proj, platform, version)
|
||||
|
||||
|
||||
@cache
|
||||
def split_version(version):
|
||||
if '-' in version:
|
||||
return version.split('-')
|
||||
else:
|
||||
return version, None
|
||||
|
||||
|
||||
class ToolkitDownloader:
|
||||
def __init__(self, version, tarball_manager):
|
||||
self.dsm_ver, self.build_num = split_version(version)
|
||||
self.tarball_manager = tarball_manager
|
||||
|
||||
if not os.path.isdir(DownloadDir):
|
||||
os.makedirs(DownloadDir)
|
||||
|
||||
def download_base_tarball(self, quiet):
|
||||
self._download(
|
||||
self._join_download_url(self.tarball_manager.base_tarball_name),
|
||||
quiet
|
||||
)
|
||||
|
||||
def download_platform_tarball(self, platform, quiet):
|
||||
self._download(self._join_download_url(
|
||||
self.tarball_manager.get_env_tarball_name(platform)), quiet)
|
||||
self._download(self._join_download_url(
|
||||
self.tarball_manager.get_dev_tarball_name(platform)), quiet)
|
||||
|
||||
def _join_download_url(self, *patterns):
|
||||
url = ToolkitServer
|
||||
for pattern in ['DSM' + self.dsm_ver, self.build_num] + list(patterns):
|
||||
if not pattern:
|
||||
continue
|
||||
url += '/%s' % pattern
|
||||
return url
|
||||
|
||||
def _download(self, url, quiet):
|
||||
logging.info("Download... " + url)
|
||||
if quiet or not sys.stdout.isatty():
|
||||
reporthook = None
|
||||
else:
|
||||
reporthook = self.dl_progress
|
||||
|
||||
try:
|
||||
urllib.request.urlretrieve(url, os.path.join(
|
||||
DownloadDir, url.split("/")[-1]), reporthook=reporthook)
|
||||
except urllib.error.HTTPError as e:
|
||||
raise DownloadToolkitError("Failed to download toolkit: " + url + ", reason: " + str(e))
|
||||
|
||||
def dl_progress(self, count, dl_size, total_size):
|
||||
percent = int(count * dl_size * 50 / total_size)
|
||||
sys.stdout.write("[%-50s] %d%%" %
|
||||
('=' * (percent - 1) + ">", 2 * percent))
|
||||
sys.stdout.write("\b" * 102)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
class ToolkitEnv(object):
|
||||
def __init__(self, version, platforms, suffix=""):
|
||||
self.version = version
|
||||
self.platforms = platforms
|
||||
self.dsm_ver, self.build_num = split_version(version)
|
||||
self.suffix = suffix
|
||||
|
||||
def download(self, quiet=False):
|
||||
raise NotImplementedError("download() not implemented")
|
||||
|
||||
def deploy(self):
|
||||
raise NotImplementedError("deploy() not implemented")
|
||||
|
||||
def clean(self):
|
||||
raise NotImplementedError("clean() not implemented")
|
||||
|
||||
def get_chroot(self, platform):
|
||||
return BuildEnv.getChrootSynoBase(platform, self.dsm_ver, self.suffix)
|
||||
|
||||
def __remove_chroot(self, chroot):
|
||||
for f in os.listdir(chroot):
|
||||
if 'ccaches' in f:
|
||||
continue
|
||||
file_path = os.path.join(chroot, f)
|
||||
subprocess.check_call(['rm', '-rf', file_path])
|
||||
|
||||
def __umount_proc(self, chroot):
|
||||
proc = os.path.join(chroot, 'proc')
|
||||
if os.path.ismount(proc):
|
||||
subprocess.check_call(['umount', proc])
|
||||
|
||||
# clear and mkdir chroot
|
||||
def clear_chroot(self, platform):
|
||||
chroot = self.get_chroot(platform)
|
||||
if not os.path.isdir(chroot):
|
||||
return
|
||||
|
||||
logging.info("Clear %s..." % chroot)
|
||||
self.__umount_proc(chroot)
|
||||
self.__remove_chroot(chroot)
|
||||
|
||||
def link_pkgscripts(self, env):
|
||||
if not env.islink('pkgscripts'):
|
||||
env.link('pkgscripts-ng', 'pkgscripts')
|
||||
|
||||
def get_sysroot_include(self, platform):
|
||||
all_sysroot = list()
|
||||
for arch in [32, 64]:
|
||||
variable = "ToolChainInclude" + str(arch)
|
||||
sysroot = BuildEnv.getPlatformVariable(platform, variable)
|
||||
if sysroot:
|
||||
all_sysroot.append(sysroot)
|
||||
return all_sysroot
|
||||
|
||||
def get_env_build_num(self, platform):
|
||||
raise NotImplementedError("get_env_build_num() not implemented")
|
||||
|
||||
def create_chroot(self, platform):
|
||||
os.makedirs(self.get_chroot(platform), exist_ok=True)
|
||||
|
||||
|
||||
class ChrootToolkit(ToolkitEnv):
|
||||
def __init__(self, version, platforms, suffix="", tarball_root=DownloadDir):
|
||||
super().__init__(version, platforms, suffix)
|
||||
self.tarball_manager = TarballManager(self.dsm_ver, tarball_root)
|
||||
self.__downloader = ToolkitDownloader(
|
||||
self.version, self.tarball_manager)
|
||||
|
||||
def download(self, quiet):
|
||||
self.__downloader.download_base_tarball(quiet)
|
||||
for platform in self.platforms:
|
||||
self.__downloader.download_platform_tarball(platform, quiet)
|
||||
|
||||
def deploy(self):
|
||||
envs = {}
|
||||
self.__check_tarball_exists()
|
||||
for platform in self.platforms:
|
||||
self.create_chroot(platform)
|
||||
self.deploy_base_env(platform)
|
||||
self.deploy_env(platform)
|
||||
self.deploy_dev(platform)
|
||||
self.adjust_chroot(platform)
|
||||
|
||||
envs[platform] = ChrootEnv(self.get_chroot(platform))
|
||||
self.link_pkgscripts(envs[platform])
|
||||
return envs
|
||||
|
||||
def clean(self):
|
||||
doPlatformParallel(self.clear_chroot, self.platforms)
|
||||
|
||||
def __check_tarball_exists(self):
|
||||
files = [self.tarball_manager.base_tarball_path]
|
||||
for platform in self.platforms:
|
||||
files.append(self.tarball_manager.get_dev_tarball_path(platform))
|
||||
files.append(self.tarball_manager.get_env_tarball_path(platform))
|
||||
|
||||
for f in files:
|
||||
if not os.path.isfile(f):
|
||||
raise TarballNotFoundError("Needed file not found! " + f)
|
||||
|
||||
@property
|
||||
def has_pixz(self):
|
||||
try:
|
||||
with open(os.devnull, 'wb') as null:
|
||||
subprocess.check_call(
|
||||
['which', 'pixz'], stdout=null, stderr=null)
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return True
|
||||
|
||||
def __extract__(self, tarball, dest_dir):
|
||||
cmd = ['tar']
|
||||
if self.has_pixz:
|
||||
cmd.append('-Ipixz')
|
||||
cmd += ['-xhf', tarball, '-C', dest_dir]
|
||||
logging.info(" ".join(cmd))
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
def deploy_base_env(self, platform):
|
||||
self.__extract__(
|
||||
self.tarball_manager.base_tarball_path,
|
||||
self.get_chroot(platform)
|
||||
)
|
||||
|
||||
def deploy_env(self, platform):
|
||||
self.__extract__(
|
||||
self.tarball_manager.get_env_tarball_path(platform),
|
||||
self.get_chroot(platform)
|
||||
)
|
||||
|
||||
def deploy_dev(self, platform):
|
||||
self.__extract__(
|
||||
self.tarball_manager.get_dev_tarball_path(platform),
|
||||
self.get_chroot(platform)
|
||||
)
|
||||
|
||||
def mkdir_source(self, chroot):
|
||||
source_dir = os.path.join(chroot, 'source')
|
||||
if not os.path.isdir(source_dir):
|
||||
os.makedirs(source_dir)
|
||||
|
||||
def copy_user_env_config(self, chroot):
|
||||
configs = ['/etc/hosts', '/root/.gitconfig',
|
||||
'/root/.ssh', '/etc/resolv.conf']
|
||||
|
||||
for config in configs:
|
||||
dest = chroot + config
|
||||
if os.path.isdir(config):
|
||||
if os.path.isdir(dest):
|
||||
shutil.rmtree(dest)
|
||||
shutil.copytree(config, dest)
|
||||
elif os.path.isfile(config):
|
||||
shutil.copy(config, dest)
|
||||
|
||||
def adjust_chroot(self, platform):
|
||||
chroot = self.get_chroot(platform)
|
||||
self.mkdir_source(chroot)
|
||||
self.copy_user_env_config(chroot)
|
||||
|
||||
def get_env_build_num(self, platform):
|
||||
version = VersionFile(os.path.join(
|
||||
self.get_chroot(platform), 'PkgVersion'))
|
||||
return version.buildnumber
|
||||
|
||||
def get_all_platforms(dsm_ver, build_num):
|
||||
pattern = 'AvailablePlatform_%s_%s' % (
|
||||
dsm_ver.split('.')[0], dsm_ver.split('.')[1])
|
||||
|
||||
if build_num:
|
||||
for line in config:
|
||||
if pattern in line:
|
||||
platforms = line.split('=')[1].strip('"').split()
|
||||
else:
|
||||
platforms = BuildEnv.getIncludeVariable(
|
||||
'toolkit.config', pattern).split()
|
||||
|
||||
return platforms
|
||||
|
||||
|
||||
def filter_platforms(version, platforms):
|
||||
dsm_ver, build_num = split_version(version)
|
||||
all_platforms = get_all_platforms(dsm_ver, build_num)
|
||||
|
||||
if not platforms:
|
||||
return all_platforms
|
||||
|
||||
redundant_platforms = set(platforms) - set(all_platforms)
|
||||
if redundant_platforms:
|
||||
raise PlatformNotAvailableError(
|
||||
"[%s] is not available platform." % " ".join(redundant_platforms))
|
||||
|
||||
return platforms
|
34
include/python/pkgerror.py
Normal file
34
include/python/pkgerror.py
Normal file
@ -0,0 +1,34 @@
|
||||
#! /usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
class PkgCreateError(RuntimeError):
|
||||
def __init__(self, title, msg=[]):
|
||||
logging.error('[ERROR] ' + title)
|
||||
if isinstance(msg, list):
|
||||
for line in msg:
|
||||
logging.error(line)
|
||||
else:
|
||||
logging.error(msg)
|
||||
|
||||
|
||||
|
||||
class CollectPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class LinkPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
class BuildPackageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class InstallPacageError(PkgCreateError):
|
||||
pass
|
||||
|
||||
|
||||
class TraverseProjectError(PkgCreateError):
|
||||
pass
|
444
include/python/pkguniform.py
Normal file
444
include/python/pkguniform.py
Normal file
@ -0,0 +1,444 @@
|
||||
#! /usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import sys
|
||||
import os
|
||||
from subprocess import check_call, check_output, CalledProcessError, STDOUT, Popen
|
||||
import glob
|
||||
import tempfile
|
||||
import shutil
|
||||
from time import localtime, strftime
|
||||
from collections import defaultdict
|
||||
import logging
|
||||
import re
|
||||
from version_file import VersionFile
|
||||
|
||||
from pkgcommon import Worker, CommandRunner, ChrootRunner, show_msg_block, BaseDir, ScriptName, PkgScripts, logger, check_stage
|
||||
from pkgerror import PkgCreateError, CollectPackageError, LinkPackageError, BuildPackageError, InstallPacageError, TraverseProjectError
|
||||
from parallel import doPlatformParallel, doParallel
|
||||
from link_project import link_projects, link_scripts, LinkProjectError
|
||||
from include.pythonutils import getBaseEnvironment
|
||||
import BuildEnv
|
||||
from project_visitor import ProjectVisitor, ConflictError
|
||||
from exec_env import ChrootEnv, EnvError
|
||||
import config_parser
|
||||
|
||||
ScriptDir = os.path.dirname(os.path.dirname(
|
||||
os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
TimeLogger = []
|
||||
UpdateSource = []
|
||||
|
||||
|
||||
class StreamToLogging(object):
|
||||
def __init__(self, logger, level=logging.INFO):
|
||||
self.logger = logger
|
||||
self.level = level
|
||||
|
||||
def write(self, buf):
|
||||
for line in buf.rstrip().splitlines():
|
||||
self.logger.log(self.level, line.rstrip())
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
|
||||
sys.stdout = StreamToLogging(logging)
|
||||
sys.error = StreamToLogging(logging, logging.ERROR)
|
||||
|
||||
|
||||
class WorkerFactory:
|
||||
def __init__(self, args):
|
||||
self.package = Package(args.package)
|
||||
self.env_config = EnvConfig(args.package, args.env_section, args.env_version, args.platforms, args.dep_level,
|
||||
args.branch, args.suffix, None)
|
||||
self.package.chroot = self.env_config.get_chroot()
|
||||
|
||||
def new(self, worker_class, *args, **kwargs):
|
||||
return worker_class(self.package, self.env_config, *args, **kwargs)
|
||||
|
||||
|
||||
class EnvPrepareWorker(Worker):
|
||||
def __init__(self, package, env_config, update, _):
|
||||
Worker.__init__(self, package, env_config)
|
||||
self.update = update
|
||||
self.sub_workers = []
|
||||
|
||||
def _run(self, *argv):
|
||||
depends_cache = None
|
||||
updater = None
|
||||
for version, platforms in self.env_config.toolkit_versions.items():
|
||||
logger.info("Processing [%s]: " % version + " ".join(platforms))
|
||||
dsm_ver, build_num = version.split('-')
|
||||
|
||||
for worker in self.sub_workers:
|
||||
worker.execute(version, updater, depends_cache)
|
||||
|
||||
def add_subworker(self, sub_worker, force_register=False):
|
||||
if force_register or check_stage(self.package.name, sub_worker.__class__.__name__):
|
||||
self.sub_workers.append(sub_worker)
|
||||
|
||||
def get_time_cost(self):
|
||||
time_cost = []
|
||||
if self.sub_workers:
|
||||
for sub_worker in self.sub_workers:
|
||||
time_cost += sub_worker.get_time_cost()
|
||||
|
||||
return time_cost
|
||||
|
||||
|
||||
class ProjectTraverser(Worker):
|
||||
title = "Traverse project"
|
||||
|
||||
def _run(self, version, updater, cache):
|
||||
try:
|
||||
visitor = ProjectVisitor(updater,
|
||||
self.env_config.dep_level,
|
||||
self.env_config.toolkit_versions[version],
|
||||
depends_cache=cache,
|
||||
version=version)
|
||||
dict_projects = visitor.traverse(self.package.name)
|
||||
visitor.show_proj_info()
|
||||
except ConflictError as e:
|
||||
raise TraverseProjectError(str(e))
|
||||
|
||||
self.package.dict_projects = dict_projects
|
||||
|
||||
|
||||
class ProjectLinker(Worker):
|
||||
title = "Link Project"
|
||||
|
||||
def _run(self, version, *argv):
|
||||
tasks = []
|
||||
for platform in self.env_config.toolkit_versions[version]:
|
||||
chroot = self.env_config.get_chroot(platform)
|
||||
if not os.path.isdir(os.path.join(chroot, 'source')):
|
||||
os.makedirs(os.path.join(chroot, 'source'))
|
||||
link_scripts(chroot)
|
||||
tasks.append((self.package.get_build_projects(platform) |
|
||||
self.package.ref_projs | set(UpdateSource), chroot))
|
||||
|
||||
try:
|
||||
doParallel(link_projects, tasks)
|
||||
for platform in self.env_config.toolkit_versions[version]:
|
||||
env = self.env_config.get_env(platform)
|
||||
except LinkProjectError as e:
|
||||
raise LinkPackageError(str(e))
|
||||
|
||||
|
||||
class PackageCollecter(Worker):
|
||||
title = "Collect package"
|
||||
|
||||
def _move_to_dest(self, source, source_list, dest_dir):
|
||||
logger.info("%s -> %s" % (source_list[0], dest_dir))
|
||||
try:
|
||||
shutil.copy(source_list[0], dest_dir)
|
||||
except Exception:
|
||||
raise CollectPackageError("Collect package failed")
|
||||
|
||||
if len(source_list) > 1:
|
||||
raise CollectPackageError(
|
||||
"Found duplicate %s" % (source), source_list)
|
||||
|
||||
def _run(self):
|
||||
spks = defaultdict(list)
|
||||
|
||||
dest_dir = self.package.spk_config.spk_result_dir(
|
||||
self.env_config.suffix)
|
||||
if os.path.exists(dest_dir):
|
||||
old_dir = dest_dir + '.bad.' + strftime('%Y%m%d-%H%M', localtime())
|
||||
if os.path.isdir(old_dir):
|
||||
shutil.rmtree(old_dir)
|
||||
os.rename(dest_dir, old_dir)
|
||||
os.makedirs(dest_dir)
|
||||
|
||||
for platform in self.env_config.platforms:
|
||||
for spk in self.package.spk_config.chroot_spks(self.env_config.get_chroot(platform)):
|
||||
spks[os.path.basename(spk)].append(spk)
|
||||
|
||||
for spk, source_list in spks.items():
|
||||
self._move_to_dest(spk, source_list, dest_dir)
|
||||
|
||||
|
||||
class PackageBuilder(ChrootRunner):
|
||||
title = "Build Package"
|
||||
log = "logs.build"
|
||||
__error_msg__ = "Failed to build package."
|
||||
__failed_exception__ = BuildPackageError
|
||||
|
||||
def __init__(self, package, env_config, _, sdk_ver, build_opt, *argv, **kwargs):
|
||||
ChrootRunner.__init__(self, package, env_config, *argv, **kwargs)
|
||||
self.build_opt = build_opt.split()
|
||||
self.sdk_ver = sdk_ver
|
||||
|
||||
def _get_command(self, platform):
|
||||
build_script = os.path.join(PkgScripts, 'SynoBuild')
|
||||
projects = self.package.get_build_projects(platform)
|
||||
|
||||
build_cmd = ['env'] + ['PackageName=' + self.package.name, build_script, '--' + platform,
|
||||
'-c', '--min-sdk', self.sdk_ver]
|
||||
if self.build_opt:
|
||||
build_cmd += self.build_opt
|
||||
|
||||
return build_cmd + list(projects)
|
||||
|
||||
|
||||
class PackageInstaller(ChrootRunner):
|
||||
title = "Install Package"
|
||||
log = "logs.install"
|
||||
__error_msg__ = "Failed to install package."
|
||||
__failed_exception__ = InstallPacageError
|
||||
|
||||
def __init__(self, package, env_config, install_opt, print_log):
|
||||
ChrootRunner.__init__(self, package, env_config, print_log)
|
||||
debug_opt = '--with-debug'
|
||||
if debug_opt in install_opt:
|
||||
self.title += '[{}]'.format(debug_opt)
|
||||
self.install_opt = list(install_opt)
|
||||
|
||||
def _get_command(self, platform):
|
||||
cmd = ['env'] + ['PackageName=' + self.package.name,
|
||||
os.path.join(PkgScripts, 'SynoInstall')]
|
||||
if self.install_opt:
|
||||
cmd += self.install_opt
|
||||
|
||||
return cmd + [self.package.name]
|
||||
|
||||
class Package():
|
||||
def __init__(self, package):
|
||||
self.name = package
|
||||
self.package_proj = BuildEnv.Project(self.name)
|
||||
self.dict_projects = dict()
|
||||
self.__additional_build = defaultdict(list)
|
||||
self.__spk_config = None
|
||||
self.__chroot = None
|
||||
|
||||
def get_additional_build_projs(self, platform):
|
||||
if platform in self.__additional_build:
|
||||
return set(self.__additional_build[platform])
|
||||
return set()
|
||||
|
||||
def add_additional_build_projs(self, platform, projs):
|
||||
self.__additional_build[platform] += projs
|
||||
|
||||
@property
|
||||
def ref_projs(self):
|
||||
return self.dict_projects['refs'] | self.dict_projects['refTags']
|
||||
|
||||
def get_build_projects(self, platform):
|
||||
return self.dict_projects['branches'] | self.get_additional_build_projs(platform)
|
||||
|
||||
@property
|
||||
def spk_config(self):
|
||||
if not self.__spk_config:
|
||||
self.__spk_config = SpkConfig(self.name, self.info, self.settings)
|
||||
|
||||
return self.__spk_config
|
||||
|
||||
@property
|
||||
def info(self):
|
||||
return self.package_proj.info(self.chroot)
|
||||
|
||||
@property
|
||||
def settings(self):
|
||||
return self.package_proj.settings(self.chroot)
|
||||
|
||||
@property
|
||||
def chroot(self):
|
||||
return self.__chroot
|
||||
|
||||
@chroot.setter
|
||||
def chroot(self, chroot):
|
||||
self.__chroot = chroot
|
||||
|
||||
|
||||
class SpkConfig:
|
||||
def __init__(self, name, info, settings):
|
||||
self.info = config_parser.KeyValueParser(info)
|
||||
try:
|
||||
self.settings = config_parser.PackageSettingParser(
|
||||
settings).get_section(name)
|
||||
except config_parser.ConfigNotFoundError:
|
||||
self.settings = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self.settings and "pkg_name" in self.settings:
|
||||
return self.settings["pkg_name"][0]
|
||||
|
||||
return self.info['package']
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
return self.info['version']
|
||||
|
||||
def is_beta(self):
|
||||
return ('beta' in self.info.keys() and self.info['beta'] == "yes") or 'report_url' in self.info.keys()
|
||||
|
||||
@property
|
||||
def build_num(self):
|
||||
try:
|
||||
return self.version.split("-")[-1]
|
||||
except IndexError:
|
||||
return self.version
|
||||
|
||||
def get_pattern_file(self, pattern):
|
||||
return "{}*{}*{}".format(self.name, self.version, pattern)
|
||||
|
||||
@property
|
||||
def spk_pattern(self):
|
||||
return self.get_pattern_file('spk')
|
||||
|
||||
@property
|
||||
def tar_pattern(self):
|
||||
return self.get_pattern_file('tar')
|
||||
|
||||
def chroot_packages_dir(self, chroot):
|
||||
return os.path.join(chroot, 'image', 'packages')
|
||||
|
||||
def get_chroot_file(self, chroot, pattern):
|
||||
return glob.glob(os.path.join(self.chroot_packages_dir(chroot), pattern))
|
||||
|
||||
def chroot_tars(self, chroot):
|
||||
return self.get_chroot_file(chroot, self.tar_pattern)
|
||||
|
||||
def chroot_spks(self, chroot):
|
||||
return self.get_chroot_file(chroot, self.spk_pattern)
|
||||
|
||||
def spk_result_dir(self, suffix=""):
|
||||
if suffix:
|
||||
suffix = '-' + suffix
|
||||
|
||||
return os.path.join(BaseDir, 'result_spk' + suffix, self.name + '-' + self.version)
|
||||
|
||||
|
||||
class EnvConfig():
|
||||
def __init__(self, package, env_section, version, platforms, dep_level, branch, suffix, _):
|
||||
self.dict_env = getBaseEnvironment(package, env_section, version)
|
||||
self.suffix = suffix
|
||||
self.env_section = env_section
|
||||
self.env_version = version
|
||||
self.dep_level = dep_level
|
||||
self.branch = branch
|
||||
|
||||
self.platforms = set(self.__get_package_platforms(platforms))
|
||||
|
||||
self.__envs = {}
|
||||
for platform in self.platforms:
|
||||
self.__envs[platform] = ChrootEnv(self.get_chroot(platform))
|
||||
|
||||
self.toolkit_versions = self.__resolve_toolkit_versions()
|
||||
|
||||
def get_env(self, platform):
|
||||
return self.__envs[platform]
|
||||
|
||||
def __get_package_platforms(self, platforms):
|
||||
def __get_toolkit_available_platforms(version):
|
||||
toolkit_config = os.path.join(
|
||||
ScriptDir, 'include', 'toolkit.config')
|
||||
major, minor = version.split('.')
|
||||
pattern = '$AvailablePlatform_%s_%s' % (major, minor)
|
||||
return check_output('source %s && echo %s' % (toolkit_config, pattern),
|
||||
shell=True, executable='/bin/bash').decode().split()
|
||||
|
||||
package_platforms = set()
|
||||
for platform in self.dict_env:
|
||||
if platform == 'all':
|
||||
package_platforms |= set(
|
||||
__get_toolkit_available_platforms(self.dict_env['all']))
|
||||
else:
|
||||
package_platforms.add(platform)
|
||||
|
||||
if platforms:
|
||||
package_platforms = set(package_platforms) & set(platforms)
|
||||
|
||||
found_env, not_found_env = [], []
|
||||
for platform in package_platforms:
|
||||
if os.path.isdir(self.get_chroot(platform)):
|
||||
found_env.append(platform)
|
||||
else:
|
||||
not_found_env.append(platform)
|
||||
|
||||
msgs = []
|
||||
for env in not_found_env:
|
||||
msgs.append("Chroot `{}' not found.".format(
|
||||
os.path.basename(self.get_chroot(env))))
|
||||
|
||||
if not found_env:
|
||||
raise PkgCreateError("All platform chroot not exists.", msgs)
|
||||
else:
|
||||
for msg in msgs:
|
||||
logger.warning('[WARNING] ' + msg)
|
||||
|
||||
return found_env
|
||||
|
||||
def __get_version(self, platform):
|
||||
if platform in self.dict_env:
|
||||
version = self.dict_env[platform]
|
||||
elif 'all' in self.dict_env:
|
||||
version = self.dict_env['all']
|
||||
else:
|
||||
raise PkgCreateError("Package version not found")
|
||||
|
||||
return version
|
||||
|
||||
def get_chroot(self, platform=None):
|
||||
if not platform:
|
||||
platform = list(self.platforms)[0]
|
||||
|
||||
return BuildEnv.getChrootSynoBase(platform, self.__get_version(platform), self.suffix)
|
||||
|
||||
def __resolve_toolkit_versions(self):
|
||||
def __get_toolkit_version(version_file):
|
||||
version = VersionFile(version_file)
|
||||
return "%s-%s" % (version.dsm_version, version.buildnumber)
|
||||
|
||||
versions = defaultdict(list)
|
||||
for platform in self.platforms:
|
||||
toolkit_version = __get_toolkit_version(
|
||||
self.__get_version_file(platform))
|
||||
versions[toolkit_version].append(platform)
|
||||
|
||||
if len(versions) > 1:
|
||||
msg = []
|
||||
for version, platforms in versions.items():
|
||||
msg.append("[%s]: %s" % (version, " ".join(platforms)))
|
||||
show_msg_block(
|
||||
msg, title="[WARNING] Multiple toolkit version found", level=logging.WARNING)
|
||||
|
||||
return versions
|
||||
|
||||
def __get_version_file(self, platform):
|
||||
return self.get_env(platform).get_file('PkgVersion')
|
||||
|
||||
def get_chroot_synodebug(self, platform):
|
||||
return self.get_env(platform).get_file(os.path.join('image', 'synodebug'))
|
||||
|
||||
@property
|
||||
def prebuild_projects(self):
|
||||
return BuildEnv.getList('PreBuildProjects') or []
|
||||
|
||||
|
||||
class PackagePacker:
|
||||
def __init__(self, pkg_name):
|
||||
self.__workers = []
|
||||
self.pkg_name = pkg_name
|
||||
|
||||
@property
|
||||
def workers(self):
|
||||
return self.__workers
|
||||
|
||||
def register_worker(self, worker, force_register=False):
|
||||
if force_register or check_stage(self.pkg_name, worker.__class__.__name__):
|
||||
self.__workers.append(worker)
|
||||
|
||||
def pack_package(self):
|
||||
for worker in self.__workers:
|
||||
worker.execute()
|
||||
|
||||
def show_time_cost(self):
|
||||
time_cost = []
|
||||
for worker in self.__workers:
|
||||
time_cost += worker.get_time_cost()
|
||||
|
||||
show_msg_block(time_cost, title="Time Cost Statistic")
|
@ -1,38 +1,30 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import json
|
||||
from collections import defaultdict
|
||||
|
||||
from config_parser import ProjectDependsParser, DependsParser
|
||||
from config_parser import ProjectDependsParser, DependsParser, KeyValueParser
|
||||
import BuildEnv
|
||||
|
||||
|
||||
class UpdateFailedError(RuntimeError):
|
||||
pass
|
||||
ScriptDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
|
||||
class ConflictError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateHook:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def update_tag(self, projects):
|
||||
pass
|
||||
|
||||
def update_branch(self, projects):
|
||||
pass
|
||||
|
||||
|
||||
class ProjectVisitor:
|
||||
def __init__(self, update_hook, dep_level, platforms, depends_cache=None, check_conflict=False):
|
||||
self.dict_projects = None
|
||||
self.update_hook = update_hook
|
||||
def __init__(self, updater, dep_level, platforms=[], depends_cache=None, check_conflict=True, dep_update_projs={}, version=None):
|
||||
self.dict_projects = defaultdict(set)
|
||||
self.updater = updater
|
||||
self.dep_level = dep_level
|
||||
self.proj_depends = ProjectDependsParser(os.path.join(BuildEnv.ScriptDir, 'include', 'project.depends'))
|
||||
self.platforms = platforms
|
||||
self.depends_cache = depends_cache
|
||||
self.check_conflict = check_conflict
|
||||
self.dep_update_projs = dep_update_projs
|
||||
self.version = version
|
||||
|
||||
def devirtual_all(self, projs):
|
||||
return set(map(BuildEnv.deVirtual, projs))
|
||||
@ -41,30 +33,16 @@ class ProjectVisitor:
|
||||
if not isinstance(root_proj, list):
|
||||
root_proj = [root_proj]
|
||||
|
||||
self.dict_projects = defaultdict(set)
|
||||
self._traverse_projects(root_proj, 1)
|
||||
return self.dict_projects
|
||||
|
||||
def checkout_git_refs(self):
|
||||
if self.update_hook:
|
||||
self.update_hook.update_tag(self.dict_projects['refTags'])
|
||||
self.update_hook.update_branch(self.dict_projects['refs'])
|
||||
intersect_projs = self.devirtual_all(self.dict_projects['tags']) & self.devirtual_all(self.dict_projects['branches'])
|
||||
if intersect_projs:
|
||||
self.update_hook.update_branch(intersect_projs)
|
||||
|
||||
def show_proj_info(self):
|
||||
print("[INFO] Branch projects: " + " ".join(self.dict_projects['branches']))
|
||||
print("[INFO] Tag projects: " + " ".join(self.dict_projects['tags']))
|
||||
print("[INFO] Reference projects: " + " ".join(self.dict_projects['refs']))
|
||||
print("[INFO] Reference tag projects: " + " ".join(self.dict_projects['refTags']))
|
||||
print("Projects: " + " ".join(self.dict_projects['branches']))
|
||||
|
||||
def _traverse_projects(self, projects, level):
|
||||
if not projects:
|
||||
return
|
||||
|
||||
if self.update_hook:
|
||||
self.update_hook.update_branch(projects)
|
||||
self.dict_projects['branches'].update(projects)
|
||||
|
||||
self._check_confict()
|
||||
@ -86,8 +64,8 @@ class ProjectVisitor:
|
||||
if not projects:
|
||||
return
|
||||
|
||||
if self.update_hook and not self.depends_cache:
|
||||
self.update_hook.update_tag(projects)
|
||||
if self.updater and not self.depends_cache:
|
||||
self.updater.update_tag(projects)
|
||||
self.dict_projects['tags'].update(projects)
|
||||
|
||||
self._check_confict()
|
||||
@ -142,4 +120,12 @@ class ProjectVisitor:
|
||||
return branches, tags, refs, refTags
|
||||
|
||||
def _check_confict(self):
|
||||
pass
|
||||
if not self.check_conflict:
|
||||
return
|
||||
|
||||
conflict = self.dict_projects['branches'] & self.dict_projects['tags']
|
||||
if conflict:
|
||||
raise ConflictError(("`%s' both in [BuildDependent] and [BuildDependent-Tag] catagory!" % " ".join(conflict)))
|
||||
conflict = self.dict_projects['branches'] & self.dict_projects['refTags']
|
||||
if conflict:
|
||||
raise ConflictError(("`%s' both in [BuildDependent] and [ReferenceOnly-Tag] catagory!" % " ".join(conflict)))
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class Tee:
|
||||
def __init__(self, stream, log_file, buffer=1, move=True):
|
||||
if move:
|
||||
@ -9,6 +12,7 @@ class Tee:
|
||||
|
||||
def write(self, msg):
|
||||
self.stream.write(msg)
|
||||
self.stream.flush()
|
||||
self.log.write(msg)
|
||||
|
||||
def flush(self):
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
|
||||
|
||||
|
15
include/python/utils.py
Normal file
15
include/python/utils.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
|
||||
|
||||
def move_old(file):
|
||||
if os.path.isfile(file):
|
||||
old = file + ".old"
|
||||
if os.path.isfile(old):
|
||||
os.remove(old)
|
||||
os.rename(file, old)
|
@ -1,3 +1,5 @@
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -9,8 +11,16 @@ import config_parser
|
||||
class VersionFile(config_parser.KeyValueParser):
|
||||
@property
|
||||
def dsm_version(self):
|
||||
return self['majorversion'] + "." + self['minorversion']
|
||||
return self.major + "." + self.minor
|
||||
|
||||
@property
|
||||
def buildnumber(self):
|
||||
return self['buildnumber']
|
||||
|
||||
@property
|
||||
def major(self):
|
||||
return self['majorversion']
|
||||
|
||||
@property
|
||||
def minor(self):
|
||||
return self['minorversion']
|
||||
|
22
include/pythonutils.py
Executable file
22
include/pythonutils.py
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/python3
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'python'))
|
||||
import BuildEnv
|
||||
from config_parser import DependsParser
|
||||
|
||||
def getBaseEnvironment(proj, env, ver=None):
|
||||
dict_env = {}
|
||||
if ver:
|
||||
dict_env['all'] = ver
|
||||
return dict_env
|
||||
|
||||
if not env:
|
||||
env = 'default'
|
||||
|
||||
depends = DependsParser(BuildEnv.Project(proj).depends_script)
|
||||
dict_env = depends.get_env_section(env)
|
||||
return dict_env
|
@ -1,5 +1,4 @@
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
AvailablePlatform_6_0="6281 alpine alpine4k armada370 armada375 armada38x armadaxp avoton braswell bromolow cedarview comcerto2k evansport monaco qoriq x64 broadwell grantley"
|
||||
AvailablePlatform_6_1="6281 alpine alpine4k armada370 armada375 armada38x armadaxp avoton braswell broadwell bromolow cedarview comcerto2k dockerx64 evansport grantley hi3535 kvmx64 monaco qoriq x64 rtd1296 denverton apollolake"
|
||||
AvailablePlatform_6_2="6281 alpine alpine4k apollolake armada370 armada375 armada37xx armada38x armadaxp avoton braswell broadwell broadwellnk bromolow cedarview comcerto2k denverton dockerx64 evansport grantley hi3535 kvmx64 monaco qoriq rtd1296 x64"
|
||||
LatestVersion="7.0"
|
||||
AvailablePlatform_7_0="bromolow cedarview armadaxp armada370 armada375 evansport comcerto2k avoton alpine braswell apollolake grantley alpine4k monaco broadwell kvmx64 armada38x denverton rtd1296 broadwellnk purley armada37xx geminilake v1000"
|
||||
|
32
include/util
Normal file
32
include/util
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_UTIL__" ]; then
|
||||
__INCLUDE_UTIL__=defined
|
||||
|
||||
Source include/init
|
||||
Source include/check
|
||||
|
||||
# Show time cost information by simple api
|
||||
# TimeCost command [command_option ...]
|
||||
TimeCost() {
|
||||
local ret
|
||||
local start=$(date +%s)
|
||||
"$@"
|
||||
ret="$?"
|
||||
local end=$(date +%s)
|
||||
ShowTimeCost "$start" "$end" "$*"
|
||||
return "$ret"
|
||||
}
|
||||
|
||||
# Auto detect CPU count
|
||||
DetectCPUCount() {
|
||||
local JOBS="$(grep -c ^processor /proc/cpuinfo)"
|
||||
if [ "$JOBS" -lt 2 ]; then
|
||||
JOBS=2
|
||||
fi
|
||||
echo $JOBS
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
@ -1,9 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
# The variable in this file will be shared between lnxscripts and pkgscripts
|
||||
# If you variable only use for lnxscripts, please add it to include/variable.lnx
|
||||
# If you variable only use for pkgscripts, please add it to include/variable.pkg
|
||||
|
||||
if [ -z "$__INCLUDE_VARIABLE__" ]; then
|
||||
__INCLUDE_VARIABLE__=defined
|
||||
|
||||
# Directory for scripts
|
||||
ConfDir="SynoBuildConf"
|
||||
|
||||
# Directory for all compile logs
|
||||
@ -19,10 +24,8 @@ DebDir="/deb"
|
||||
DebDevBuild="${DebDir}/build"
|
||||
DebDevDir="${DebDir}/tmpInstallDir"
|
||||
DebPkgDir="${DebDir}/result"
|
||||
GlobalDependConf="include/project.depends"
|
||||
|
||||
DEFAULT_CCACHE_SIZE="3G"
|
||||
PRODUCT="DSM"
|
||||
DEFAULT_CCACHE_SIZE="8G"
|
||||
|
||||
fi # header guard
|
||||
# vim:ft=sh
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_VARIABLE_PKG__" ]; then
|
||||
__INCLUDE_VARIABLE_PKG__=defined
|
||||
|
||||
VERSION_FILE=/PkgVersion
|
||||
DownloadServer="sourceforge.net/projects/dsgpl/files"
|
||||
|
||||
SpkResultDir="result_spk"
|
||||
BuildEnvDir="$ScriptsDir/../build_env"
|
||||
fi
|
||||
# vim:ft=sh
|
||||
|
155
include/virtualProject
Normal file
155
include/virtualProject
Normal file
@ -0,0 +1,155 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_VIRTUAL_PROJECT__" ]; then
|
||||
__INCLUDE_VIRTUAL_PROJECT__=defined
|
||||
|
||||
# Virtual Project = use the same git repo as source folder
|
||||
# but use another build & install script
|
||||
#
|
||||
# Virtual Install Project = use the same git repo & build script
|
||||
# but use another install script
|
||||
#
|
||||
# priority: virtual proj > virtual inst
|
||||
# e.g. allow foo-virtual-junior-abc-virinst-bar1
|
||||
# foo-virtual-junior-abc-virinst-bar2
|
||||
VIR_PROJ_SEP="-virtual-"
|
||||
VIR_INST_SEP="-virinst-"
|
||||
|
||||
HasSubStr() { # {{{
|
||||
if echo $1 | grep -q -- "$2"; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
} # }}}
|
||||
|
||||
IsVirInstProject() { # {{{
|
||||
HasSubStr "$1" "$VIR_INST_SEP"
|
||||
} # }}}
|
||||
|
||||
IsVirtualProject() { # {{{
|
||||
HasSubStr "$1" "$VIR_PROJ_SEP"
|
||||
} # }}}
|
||||
|
||||
#$1: project name (include VIR_PROJ_SEP or VIR_INST_SEP)
|
||||
#return: project name(exclude VIR_PROJ_SEP and VIR_INST_SEP)
|
||||
GetBasedProjectName() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: need argument in GetBasedProjectName"
|
||||
fi
|
||||
|
||||
GetVirtualProjectName "$(GetVirInstProjectName "$1")"
|
||||
}
|
||||
|
||||
#$@: list of project names (include VIR_PROJ_SEP or VIR_INST_SEP)
|
||||
#return: list of project names(exclude VIR_PROJ_SEP and VIR_INST_SEP)
|
||||
GetBasedProjectNames() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Error: need argument in GetBasedProjectNames"
|
||||
fi
|
||||
|
||||
echo "$@" | sed "s/\([^ ]*\)\(${VIR_PROJ_SEP}\|${VIR_INST_SEP}\)\([^ ]*\)/\1/g"
|
||||
}
|
||||
|
||||
#$1: project name(include VIR_PROJ_SEP)
|
||||
#return: project name(exclude VIR_PROJ_SEP)
|
||||
GetVirtualProjectName() { # {{{ Get virutal project "project" part
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: need argument in GetVirtualProjectName"
|
||||
fi
|
||||
|
||||
local dir=`echo $1 | sed "s/\(.*\)${VIR_PROJ_SEP}\(.*\)/\1/"`
|
||||
echo $dir
|
||||
} # }}}
|
||||
|
||||
#$1: project name(include VIR_INST_SEP)
|
||||
#return: project name(exclude VIR_INST_SEP)
|
||||
GetVirInstProjectName() { # {{{ Get virutal project "project" part
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: need argument in GetVirInstProjectName"
|
||||
fi
|
||||
|
||||
local dir=`echo $1 | sed "s/\(.*\)${VIR_INST_SEP}\(.*\)/\1/"`
|
||||
echo $dir
|
||||
} # }}}
|
||||
|
||||
#$1: project name(include virtual ext)
|
||||
#return: project extension(include seperator)
|
||||
GetVirtualProjectExtension() { # {{{ Get virutal project "project" part
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: need argument in GetVirtualProjectExtension"
|
||||
fi
|
||||
|
||||
local ext=""
|
||||
if IsVirtualProject $1; then
|
||||
ext=`echo $1 | sed "s/\(.*\)${VIR_PROJ_SEP}\(.*\)/${VIR_PROJ_SEP}\2/"`
|
||||
elif IsVirInstProject $1; then
|
||||
ext=`echo $1 | sed "s/\(.*\)${VIR_INST_SEP}\(.*\)/${VIR_INST_SEP}\2/"`
|
||||
fi
|
||||
|
||||
echo $ext
|
||||
} # }}}
|
||||
|
||||
#$1: project name(include virtual ext or not)
|
||||
#$2, $3, ...: all project name
|
||||
#return: project in same virtual project family, for example:
|
||||
# GetVirtualProjectFamily(busybox, $BuildList, $InstallList) = "busybox busybox-virtual-junior busybox-virtual-junior.wins"
|
||||
# GetVirtualProjectFamily(busybox-virtual-junior, $BuildList, $InstallList) = "busybox busybox-virtual-junior busybox-virtual-junior.wins"
|
||||
GetVirtualProjectFamily() {
|
||||
if [ -z $1 ]; then
|
||||
echo "Error: need argument in GetVirtualProjectFamily"
|
||||
fi
|
||||
|
||||
local all_project=
|
||||
local return_list=
|
||||
local name="$(GetVirtualProjectName $1)"
|
||||
local p= x= repeat=
|
||||
#local project_list="$(grep '$VIR_PROJ_SEP' include/config
|
||||
shift
|
||||
|
||||
for p in $@; do
|
||||
if echo $p | grep $name > /dev/null 2>&1; then
|
||||
repeat="N"
|
||||
for x in $return_list; do
|
||||
if [ "$x" = "$p" ]; then
|
||||
repeat="Y"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ $repeat = "N" ]; then
|
||||
return_list="$return_list $p"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo $return_list
|
||||
}
|
||||
|
||||
#$1: project name(include virtual ext or not)
|
||||
#$2, $3, ...: all project name
|
||||
#return: project in same virtual project family, for example:
|
||||
# InVirtualProjectFamily(busybox, $BuildList, $InstallList) = "Y"
|
||||
# InVirtualProjectFamily(busybox-virtual-junior, $BuildList, $InstallList) = "Y"
|
||||
# InVirtualProjectFamily(php-5.3.x, $BuildList, $InstallList) = "N"
|
||||
InVirtualProejctFamily() {
|
||||
if [ -z $1 ]; then
|
||||
echo "Error: need argument in InVirtualProejctFamily"
|
||||
fi
|
||||
local name=$1
|
||||
local p=$1
|
||||
if echo $name | grep "\\$VIR_PROJ_SEP"; then
|
||||
true
|
||||
return
|
||||
fi
|
||||
shift
|
||||
for p in $@; do
|
||||
if echo $p | grep $name | grep "\\$VIR_PROJ_SEP" > /dev/null 2>&1; then
|
||||
true
|
||||
return
|
||||
fi
|
||||
done
|
||||
false
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
Reference in New Issue
Block a user