mirror of
https://github.com/SynologyOpenSource/pkgscripts-ng.git
synced 2025-07-25 17:10:06 +00:00
DSM6.0 toolkit framework
This commit is contained in:
BIN
CodeSign.php
Executable file
BIN
CodeSign.php
Executable file
Binary file not shown.
340
EnvDeploy
Executable file
340
EnvDeploy
Executable file
@ -0,0 +1,340 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
LANG=""
|
||||
LC_ALL=""
|
||||
. "$(dirname "$(readlink -f "$0")")/include/init"
|
||||
|
||||
Usage() {
|
||||
cat << EOF
|
||||
|
||||
Usage
|
||||
`basename $0` [OPTIONS] -v version
|
||||
|
||||
Synopsis
|
||||
Deploy build environment for platform(s) of specified version.
|
||||
|
||||
Options
|
||||
-v, --version {version}
|
||||
Specify target DSM version of enviroment.
|
||||
-p, --platform {platform}
|
||||
Specify target platforms. Default deploy all available platforms for specified version.
|
||||
-i, --info platform|project
|
||||
Display list of platforms or pre-built projects. Use it with -v to specify version.
|
||||
-l, --list
|
||||
List available platforms, the same as "--info platform". Use it with -v to specify version.
|
||||
-s, --suffix {suffix}
|
||||
Specify suffix for destination folder. For example, $SynoBase/build_env-{suffix}
|
||||
Default destination folder is $SynoBase/build_env.
|
||||
-t, --tarball {dir}
|
||||
Extract local {dir}/tarballs rather than download them.
|
||||
Names of tarballs should be something like ds.x64-4.2.env.txz or ds.x64-4.2.dev.txz
|
||||
-d, --demo
|
||||
Default destination folder is $SynoBase/build_env-demo if no suffix is given.
|
||||
--preview
|
||||
Download preview environment of version specified by -v option.
|
||||
--us3
|
||||
Download US3 environment of version specified by -v option.
|
||||
-c, --clean
|
||||
Clean first if destination folder already exists.
|
||||
-y, --yes
|
||||
Assume "yes" on all questions.
|
||||
-h, --help
|
||||
This help message.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
PromptConfirm() {
|
||||
[ $# -ne 1 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
local confirm= message="$1"
|
||||
|
||||
echo -e "\n$message"
|
||||
read -p "Continue? (y/n)[n]: " confirm
|
||||
if [ "$confirm" != "y" -a "$confirm" != "Y" ]; then
|
||||
echo -e "Canceled.\n"
|
||||
exit 0
|
||||
else
|
||||
echo -e "Continue ...\n"
|
||||
fi
|
||||
}
|
||||
|
||||
SetupEnvironment() {
|
||||
[ $# -ne 2 -a $# -ne 3 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
local arch="$1" version="$2" build_version="$3" cur_dir="`pwd`" tarball= ret= sub_dir=
|
||||
local arch_dir="ds.$arch-$version"
|
||||
|
||||
# Clear
|
||||
if grep -q "\s$EnvDir/$arch_dir/proc" /proc/mounts; then
|
||||
umount $arch_dir/proc
|
||||
CheckErrorOut $? "Fail to unmount $EnvDir/$arch_dir/proc"
|
||||
fi
|
||||
[ "$DoClean" = "Yes" ] && rm -rf $arch_dir
|
||||
mkdir $arch_dir
|
||||
cd $arch_dir
|
||||
|
||||
# Download & extract
|
||||
[ "$SYNO_DEMO_MODE" = "Yes" ] && version="$version-demo"
|
||||
if [ "$SYNO_PREVIEW" = "Yes" ]; then
|
||||
sub_dir="$version-preview"
|
||||
elif [ "$SYNO_US3" = "Yes" ]; then
|
||||
sub_dir="$version-us3"
|
||||
elif [ -n "$build_version" ]; then
|
||||
sub_dir="$build_version"
|
||||
fi
|
||||
|
||||
for tarball_name in ds.$arch-$version.{env,dev}; do
|
||||
tarball=
|
||||
if [ -n "$SrcTarballDir" ]; then
|
||||
for suffix in tgz txz; do
|
||||
if [ -f $SrcTarballDir/${tarball_name}.${suffix} ]; then
|
||||
tarball=$SrcTarballDir/${tarball_name}.${suffix}
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
for suffix in tgz txz; do
|
||||
check_tarball=${tarball_name}.${suffix}
|
||||
wget_target=http://$DownloadServer/toolkit/$arch/$sub_dir/${check_tarball}
|
||||
if wget -S --spider $wget_target 2>&1 | grep -q 'HTTP/1.1 200 OK'; then
|
||||
tarball=${check_tarball}
|
||||
break
|
||||
fi
|
||||
done
|
||||
wget -O $tarball $wget_target
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ] && wget -O notification.txt http://$DownloadServer/toolkit/notification.txt; then
|
||||
cat notification.txt
|
||||
rm -f notification.txt
|
||||
exit 2
|
||||
fi
|
||||
CheckErrorOut $ret "Fail to download $tarball!!"
|
||||
fi
|
||||
|
||||
tar_opt=
|
||||
echo "Extract $tarball ..."
|
||||
if file -b $tarball | grep -q "XZ compressed"; then
|
||||
which pixz &>/dev/null && tar_opt=-Ipixz
|
||||
fi
|
||||
tar $tar_opt -xhf $tarball
|
||||
CheckErrorOut $? "Fail to extract $tarball!!"
|
||||
[ -z "$SrcTarballDir" ] && rm -f $tarball
|
||||
done
|
||||
|
||||
# TODO Setup $EnvDir/$arch_dir/etc/apt/sources.list and get metapackage
|
||||
cd $cur_dir
|
||||
}
|
||||
|
||||
ResolveVersion() {
|
||||
[ $# -ne 1 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
|
||||
if [[ $1 =~ ^[0-9]+\.[0-9]+$ ]]; then
|
||||
Version="$1"
|
||||
BuildVersion=
|
||||
elif [[ $1 =~ ^[0-9]+\.[0-9]+-[0-9]+$ ]]; then
|
||||
Version="`echo $1 | cut -d'-' -f1`"
|
||||
BuildVersion="`echo $1 | cut -d'-' -f2`"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
GetAvailableVersions() {
|
||||
local prefix="AvailablePlatform_" line= index= versions=
|
||||
while read line; do
|
||||
[[ $line =~ ^$prefix[0-9]+_[0-9]+= ]] || continue
|
||||
index="`echo $line | cut -d'=' -f1`"
|
||||
versions="$versions `echo $index | awk -F'_' '{print $2"."$3}'`"
|
||||
done < <(set | grep $prefix)
|
||||
echo "$versions"
|
||||
}
|
||||
|
||||
ListAvailablePlatforms() {
|
||||
local version="$1" prefix= index= item=
|
||||
if [ "$SYNO_DEMO_MODE" = "Yes" ]; then
|
||||
prefix="AvailableDemoPlatform_"
|
||||
echo -e "\n======== Available Platforms (Demo) ========"
|
||||
else
|
||||
prefix="AvailablePlatform_"
|
||||
echo -e "\n======== Available Platforms ========"
|
||||
fi
|
||||
if [ -n "$version" ]; then
|
||||
index="${prefix}`echo $version | sed 's/\./_/g'`"
|
||||
echo "$version: ${!index}"
|
||||
else
|
||||
for item in `GetAvailableVersions`; do
|
||||
index="${prefix}`echo $item | sed 's/\./_/g'`"
|
||||
echo "$item: ${!index}"
|
||||
done
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
|
||||
ListBuiltinProjects() {
|
||||
local version= config=
|
||||
if [ -f "$ScriptsDir/include/gitutils" ]; then
|
||||
config="include/config"
|
||||
for version in ${1:-`GetAvailableVersions`}; do
|
||||
echo -e "\n======== $version Built-in Projects ========"
|
||||
( cd $ScriptsDir; . include/gitutils; GitCheckoutFiles $version $config > /dev/null; . $config; echo $PreBuildProjects; )
|
||||
done
|
||||
else
|
||||
for config in `ls $ScriptsDir/include/projects-${1:-*} | sort`; do
|
||||
version="`echo $config | cut -d'-' -f2`"
|
||||
echo -e "\n======== $version Built-in Projects ========"
|
||||
( . $config; echo $PreBuildProjects; )
|
||||
done
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
|
||||
ListRequestedInfo() {
|
||||
[ $# -lt 1 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
case "$1" in
|
||||
"platform")
|
||||
ListAvailablePlatforms $2
|
||||
;;
|
||||
"project")
|
||||
ListBuiltinProjects $2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown target \"$1\" to list!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
Args=`getopt -u -l 'version:,platform:,tarball:,suffix:,info:,list,demo,preview,us3,clean,yes,help' v:p:t:s:i:ldcyh $@`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "You gave me option(s) that I do not know."
|
||||
Usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DoClean="No"
|
||||
DontAsk="No"
|
||||
|
||||
Source include/check
|
||||
Source include/config
|
||||
Source include/platforms
|
||||
Source include/toolkit.config
|
||||
|
||||
# Parse options
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
"-p" | "--platform")
|
||||
Platforms="$2"
|
||||
shift
|
||||
;;
|
||||
"-v" | "--version")
|
||||
ResolveVersion $2
|
||||
CheckErrorOut $? "$2 is not a valid version/build-number."
|
||||
RawVersion="$2"
|
||||
shift
|
||||
;;
|
||||
"-i" | "--info")
|
||||
ListOnly="Yes"
|
||||
ListTarget="$2"
|
||||
shift
|
||||
;;
|
||||
"-l" | "--list")
|
||||
ListOnly="Yes"
|
||||
ListTarget="platform"
|
||||
;;
|
||||
"-s" | "--suffix")
|
||||
Suffix="$2"
|
||||
shift
|
||||
;;
|
||||
"-t" | "--tarball")
|
||||
[ "${2:0:1}" = "/" ] && SrcTarballDir="$2" || SrcTarballDir="$CurDir/$2"
|
||||
shift
|
||||
;;
|
||||
"-d" | "--demo")
|
||||
SYNO_DEMO_MODE="Yes"
|
||||
;;
|
||||
"--preview")
|
||||
SYNO_PREVIEW="Yes"
|
||||
;;
|
||||
"--us3")
|
||||
SYNO_US3="Yes"
|
||||
;;
|
||||
"-y" | "--yes")
|
||||
DontAsk="Yes"
|
||||
;;
|
||||
"-c" | "--clean")
|
||||
DoClean="Yes"
|
||||
;;
|
||||
"-h" | "--help")
|
||||
Usage
|
||||
exit 0
|
||||
;;
|
||||
"--")
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Unhandled option '$1'"
|
||||
echo "Something wrong in $0. Please contact maintainer."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ "$ListOnly" = "Yes" ]; then
|
||||
ListRequestedInfo $ListTarget $Version
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ProjectList="$@" # TODO support to update/upgrade project individually
|
||||
|
||||
if [ -z "$Version" ]; then
|
||||
read -p "What base version do you want? " RawVersion
|
||||
ResolveVersion $RawVersion
|
||||
CheckErrorOut $? "$RawVersion is not a valid DSM version."
|
||||
fi
|
||||
if [ "$SYNO_DEMO_MODE" = "Yes" ]; then
|
||||
PlatformIndex="AvailableDemoPlatform_`echo $Version | sed 's/\./_/g'`"
|
||||
else
|
||||
PlatformIndex="AvailablePlatform_`echo $Version | sed 's/\./_/g'`"
|
||||
fi
|
||||
if [ -z "$Platforms" ]; then
|
||||
Platforms="${!PlatformIndex}"
|
||||
else
|
||||
for Arch in $Platforms; do
|
||||
CheckInList $Arch ${!PlatformIndex}
|
||||
CheckErrorOut $? "Environment for $Arch ($Version) is not available."
|
||||
done
|
||||
fi
|
||||
|
||||
# Destination folder
|
||||
if [ -n "$Suffix" ]; then
|
||||
EnvDir="$SynoBase/build_env-$Suffix"
|
||||
elif [ "$SYNO_DEMO_MODE" = "Yes" ]; then
|
||||
EnvDir="$SynoBase/build_env-demo"
|
||||
else
|
||||
EnvDir="$SynoBase/build_env"
|
||||
fi
|
||||
|
||||
# Confirm
|
||||
echo ""
|
||||
echo "Desired platform: $Platforms"
|
||||
echo "Desired version: $Version ($RawVersion)"
|
||||
echo "Destination folder: $EnvDir"
|
||||
echo "Clean if target exists: $DoClean"
|
||||
if [ "$DontAsk" != "Yes" ]; then
|
||||
PromptConfirm "Continue if above settings are OK."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Deploy
|
||||
mkdir -p $EnvDir
|
||||
cd $EnvDir
|
||||
for Arch in $Platforms; do
|
||||
SetupEnvironment $Arch $Version $BuildVersion
|
||||
ln -sf `basename ds.$Arch-$Version/usr/bin/python2.[0-9]` ds.$Arch-$Version/usr/bin/python2
|
||||
ln -sf pkgscripts-ng ds.$Arch-$Version/pkgscripts
|
||||
done
|
||||
cd $CurDir
|
||||
exit 0
|
606
PkgCreate.py
Executable file
606
PkgCreate.py
Executable file
@ -0,0 +1,606 @@
|
||||
#!/usr/bin/python2
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
|
||||
import sys, os
|
||||
from getopt import *
|
||||
from time import localtime, strftime
|
||||
from shutil import rmtree
|
||||
|
||||
# Paths
|
||||
ScriptDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
BaseDir = os.path.dirname(ScriptDir)
|
||||
ScriptName = os.path.basename(sys.argv[0])
|
||||
PkgScripts = '/pkgscripts-ng'
|
||||
|
||||
sys.path.append(ScriptDir+'/include')
|
||||
import pythonutils
|
||||
from pythonutils import *
|
||||
|
||||
|
||||
def displayUsage(code):
|
||||
message = '\nUsage\n\t'+ScriptName
|
||||
message += ' [-p platforms] [-x level] [OPTIONS] pkg_project'
|
||||
message += """
|
||||
|
||||
Synopsis
|
||||
Build and/or create .spk for packages.
|
||||
|
||||
Options
|
||||
-e {build_env}
|
||||
Specify environment section in SynoBuildConf/depends. Default is [default].
|
||||
-v {env version}
|
||||
Specify target DSM version manually.
|
||||
-p {platforms}
|
||||
Specify target platforms. Default to detect available platforms under build_env/.
|
||||
-P {platforms}
|
||||
Specify platforms to be excluded.
|
||||
-b {package_branch}
|
||||
Specify branch of package.
|
||||
-x {level}
|
||||
Build dependant projects (to specified dependency level).
|
||||
-s {suffix}
|
||||
Specify suffix of folder of build environment (build_env/).
|
||||
-m {milestone}
|
||||
For release candidate when uploading. Specify which setting defined in SynoBuildConf/milestone to use.
|
||||
-c: Build, install, upload (if build machine) package.
|
||||
-u: Perform check for SynoUpdate and stop when update failed.
|
||||
-U: No update. Do link and do clean, then run SynoBuild only.
|
||||
-L: No update. No link and no clean, then run SynoBuild only.
|
||||
-l: No update. No build and no clean, then link projects only.
|
||||
-B: No Build. Do update only.
|
||||
-I: Run install script to create spk.
|
||||
-i: Run install script to create spk and upload results.
|
||||
-z: Run for all platforms concurrently.
|
||||
-J: Do SynoBuild with -J.
|
||||
-j: Do SynoBuild with --jobs.
|
||||
-S: Disable silent make.
|
||||
--ccache-size {size}
|
||||
Set size of ccache to reduce compiler activities. Default is 1G.
|
||||
--ccache-clean
|
||||
Build with a cleared ccache.
|
||||
--no-builtin
|
||||
Do not skip built-in projects.
|
||||
--no-sign
|
||||
Do not make code sign
|
||||
--demo: Build demo package. Default environment folder is build_env-demo if no suffix is given.
|
||||
--base: Build all projects (by default, only projects not on tag are built).
|
||||
-h, --help
|
||||
Show this help.
|
||||
|
||||
Task Control
|
||||
(default) -U -L -I -i -c -Uc
|
||||
Update source code o x x x x o x
|
||||
Link platform o o x x x o o
|
||||
Build package o o o x x o o
|
||||
Install package x x x o o o o
|
||||
Upload spk files x x x x o o o (build machine only)
|
||||
Tag and send mail x x x x x o o (build machine only)
|
||||
|
||||
Please use ONLY ONE of these options.
|
||||
"""
|
||||
print >> sys.stderr, message
|
||||
sys.exit(code)
|
||||
|
||||
|
||||
def updatePkgScripts():
|
||||
curr_dir = os.getcwd()
|
||||
os.chdir(ScriptDir)
|
||||
if os.path.isfile('include/gitutils'):
|
||||
try: check_call('. include/gitutils; GitUpdatePkgScripts', shell=True)
|
||||
except CalledProcessError: pass
|
||||
else:
|
||||
try: check_call('. include/envutils; UpdatePkgScripts', shell=True)
|
||||
except CalledProcessError: pass
|
||||
os.chdir(curr_dir)
|
||||
|
||||
def resolveBuildEnvPre(arch):
|
||||
curr_dir = os.getcwd()
|
||||
os.chdir(ScriptDir)
|
||||
if os.path.isfile('include/gitutils'):
|
||||
try: check_call('. include/gitutils; GitSetBuildEnvPre '+resolveBaseTarget(arch, DictEnv)+' '+arch, shell=True)
|
||||
except CalledProcessError: pass
|
||||
else:
|
||||
try: check_call('. include/envutils; SetBuildEnvPre '+resolveBaseTarget(arch, DictEnv)+' '+arch, shell=True)
|
||||
except CalledProcessError: reportMessage(ERROR_OTHER, "Please contact maintainer");
|
||||
os.chdir(curr_dir)
|
||||
|
||||
def resolveBuildEnvPost(arch, seen, ref_only):
|
||||
param = arch
|
||||
curr_dir = os.getcwd()
|
||||
os.chdir(ScriptDir)
|
||||
if os.path.isfile('include/gitutils'):
|
||||
if DoBase:
|
||||
for proj in seen | ref_only:
|
||||
param += ' '+proj
|
||||
try: check_call('. include/gitutils; GitSetBuildEnvPost '+resolveBaseTarget(arch, DictEnv)+' '+arch+' '+param, shell=True)
|
||||
except CalledProcessError: pass
|
||||
else:
|
||||
reportMessage(ERROR_LOG, 'No post-action to be done')
|
||||
os.chdir(curr_dir)
|
||||
|
||||
def resolveDirSuffix():
|
||||
if EnvSuffix != '': return '-'+EnvSuffix
|
||||
elif DemoMode: return '-demo'
|
||||
else: return ''
|
||||
|
||||
def updateProject(projects, target, dictVar=None):
|
||||
proj_list = ''
|
||||
for proj in projects:
|
||||
if proj == 'uistring' and os.path.isdir(BaseDir+'/source/'+proj+'/.git'):
|
||||
try: check_call('cd '+BaseDir+'/source/'+proj+'; git reset --hard; git pull --rebase=preserve', shell=True)
|
||||
except CalledProcessError: pass
|
||||
continue
|
||||
if proj == VAR_KERNEL_PROJ:
|
||||
continue
|
||||
elif re.match(r'^\$', proj):
|
||||
# is variable
|
||||
if dictVar.has_key(proj):
|
||||
proj_list += ' '+dictVar[proj]
|
||||
else:
|
||||
reportMessage(ERROR_DEP, 'Variable '+proj+' undefined')
|
||||
else:
|
||||
# is normal project
|
||||
proj_list += ' '+proj
|
||||
proj_list = proj_list.strip()
|
||||
if proj_list == '': return
|
||||
update_opt = SynoUpdateOpt+' --env '+target
|
||||
reportMessage(ERROR_LOG, 'env RenameLog=no '+ScriptDir+'/SynoUpdate '+update_opt+' '+proj_list)
|
||||
try:
|
||||
check_call('env RenameLog=no '+ScriptDir+'/SynoUpdate '+update_opt+' '+proj_list, shell=True)
|
||||
except CalledProcessError:
|
||||
if DoUpdateCheck:
|
||||
reportMessage(ERROR_OTHER, 'SynoUpdate error, please check '+BaseDir+'/'+UpdateLog);
|
||||
|
||||
class UpdateHook(TraverseHook):
|
||||
def perform(self, config, info):
|
||||
updateProject(config['proj']['curr'], self.branch, info['var'])
|
||||
if self.do_base: updateProject(config['proj']['base'], self.arch+':'+config['base'], info['var'])
|
||||
|
||||
def writeUpdateLog(msg):
|
||||
if not os.path.isdir(BaseDir+'/logs'): os.mkdir(BaseDir+'/logs')
|
||||
try:
|
||||
log = open(BaseDir+'/'+UpdateLog, 'a')
|
||||
except IOError:
|
||||
reportMessage(ERROR_IO, 'Fail to open '+BaseDir+'/'+UpdateLog)
|
||||
else:
|
||||
log.write(msg)
|
||||
log.close()
|
||||
|
||||
|
||||
def prepareProjects(arch):
|
||||
cmd = ScriptDir+'/ProjectDepends.py -p '+arch+' '+ProjDependsOpt+' '+string.join(InputProjects, ' ')
|
||||
cmd += ' '+string.join(ForPack['curr'], ' ')
|
||||
if DoBase: cmd += ' '+string.join(ForPack['base'], ' ')
|
||||
reportMessage(ERROR_LOG, cmd)
|
||||
pipe = Popen(cmd, stdout=PIPE, shell=True)
|
||||
seq = pipe.stdout.read().strip().split(' ')
|
||||
|
||||
if not DoBase:
|
||||
projects = Seen['curr'].intersection(seq)
|
||||
extra = RefOnly['curr']
|
||||
elif IgnoreBuiltin:
|
||||
builtin = getBuiltinProjects(ScriptDir)
|
||||
projects = (Seen['curr'] | (Seen['base'] - builtin)).intersection(seq)
|
||||
extra = RefOnly['curr'] | (RefOnly['base'] - builtin)
|
||||
else:
|
||||
projects = (Seen['curr'] | Seen['base']).intersection(seq)
|
||||
extra = RefOnly['curr'] | RefOnly['base']
|
||||
if UpdateScriptExist: extra |= BasicProjects
|
||||
|
||||
dst_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
if DoLink:
|
||||
for proj in ['/source/'+p for p in (projects | extra)]+['/pkgscripts-ng']:
|
||||
idx = string.find(proj, VIRTUAL_PROJ_SEP)
|
||||
real_proj = proj if idx == -1 else proj[:idx]
|
||||
try: check_call('rm -rf '+dst_dir+proj, shell=True)
|
||||
except CalledProcessError: pass
|
||||
reportMessage(ERROR_LOG, 'Link '+BaseDir+real_proj+' to '+dst_dir+proj)
|
||||
try: check_call('cp -al '+BaseDir+real_proj+' '+dst_dir+proj, shell=True)
|
||||
except CalledProcessError: pass
|
||||
if DoBuild:
|
||||
f = open(dst_dir+'/seen_curr.list', 'w')
|
||||
f.write(string.join(Seen['curr'].intersection(seq), ' '))
|
||||
f.close()
|
||||
return projects
|
||||
|
||||
|
||||
def waitBackgroundProcess(plist):
|
||||
global PkgError
|
||||
print >> sys.stderr, '\tBackground pids: '+string.join([str(p.pid) for p in plist], ' ')
|
||||
sys.stderr.write('Wait for:')
|
||||
for p in plist:
|
||||
sys.stderr.write(' '+str(p.pid))
|
||||
p.communicate()
|
||||
if p.returncode != 0: PkgError = True
|
||||
print >> sys.stderr, ''
|
||||
|
||||
def popenPipe(cmd):
|
||||
p = Popen('set -o pipefail;'+cmd+';r=$?;set +o pipefail;exit $r', stdout=None, stderr=None, shell=True, executable='/bin/bash')
|
||||
return p
|
||||
|
||||
|
||||
def buildPackage(package, projects, build_opt):
|
||||
global PkgError
|
||||
print(os.getcwd())
|
||||
build_cmd = 'chroot . env PackageName=' + package + ' '+ PkgScripts + '/SynoBuild '
|
||||
plist = []
|
||||
curr_dir = os.getcwd()
|
||||
for arch in Platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
if os.path.isdir(arch_dir): os.chdir(arch_dir)
|
||||
else: continue
|
||||
sdk_version = ".".join([str(i) for i in getEnvVer(arch, DictEnv)])
|
||||
build_opt += ' --min-sdk ' + sdk_version
|
||||
log_file = 'logs.build'
|
||||
if not os.path.isdir('root/.tmp'): os.mkdir('root/.tmp')
|
||||
if os.path.isfile(log_file): os.rename(log_file, log_file+'.old')
|
||||
try: check_call('grep -q '+arch_dir+'/proc /proc/mounts', shell=True)
|
||||
except CalledProcessError:
|
||||
try: check_call('chroot . /bin/mount /proc', shell=True)
|
||||
except CalledProcessError: pass
|
||||
|
||||
cmd = build_cmd+' -p '+arch+' '+build_opt+' '+string.join(projects[arch], ' ')
|
||||
redirect = ' 2>&1 >> '+log_file if RunBackground else ' 2>&1 | tee -a '+log_file
|
||||
hook = 'source/'+PkgProject+'/SynoBuildConf/prebuild'
|
||||
if os.access(hook, os.X_OK): cmd = hook+redirect+';'+cmd
|
||||
cmd += redirect
|
||||
hook = 'source/'+PkgProject+'/SynoBuildConf/postbuild'
|
||||
if os.access(hook, os.X_OK): cmd += ';'+hook+redirect
|
||||
reportMessage(ERROR_LOG, cmd)
|
||||
|
||||
if RunBackground:
|
||||
plist.append(Popen(cmd, stdout=None, stderr=None, shell=True))
|
||||
else:
|
||||
p = popenPipe(cmd)
|
||||
p.communicate()
|
||||
if p.returncode != 0: PkgError = True
|
||||
os.chdir(curr_dir)
|
||||
if RunBackground: waitBackgroundProcess(plist)
|
||||
|
||||
|
||||
def installPackage(package, debug_mode):
|
||||
global PkgError
|
||||
install_cmd = 'chroot . ' + PkgScripts + '/SynoInstall'
|
||||
install_opt = '--with-debug' if debug_mode else ''
|
||||
plist = []
|
||||
curr_dir = os.getcwd()
|
||||
for arch in Platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
if os.path.isdir(arch_dir): os.chdir(arch_dir)
|
||||
else: continue
|
||||
log_file = 'logs.install'
|
||||
if os.path.isfile(log_file): os.rename(log_file, log_file+'.old')
|
||||
|
||||
cmd = install_cmd+' -p '+arch+' '+install_opt+' '+package
|
||||
reportMessage(ERROR_LOG, cmd)
|
||||
if RunBackground:
|
||||
cmd += ' 2>&1 > '+log_file
|
||||
plist.append(Popen(cmd, stdout=None, stderr=None, shell=True))
|
||||
else:
|
||||
p = popenPipe(cmd+' 2>&1 | tee '+log_file)
|
||||
p.communicate()
|
||||
if p.returncode != 0: PkgError = True
|
||||
os.chdir(curr_dir)
|
||||
if RunBackground: waitBackgroundProcess(plist)
|
||||
|
||||
|
||||
def packFlash(package, platforms):
|
||||
if not os.access(ScriptDir+'/PkgFlash', os.X_OK): return
|
||||
global PkgError
|
||||
plist = []
|
||||
result_dir = BaseDir+'/result_spk'+resolveDirSuffix()
|
||||
for arch in platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
log_file = arch_dir+'/logs.flash'
|
||||
cmd = ScriptDir+'/PkgFlash '+arch+' '+package+' '+result_dir+' '+arch_dir
|
||||
reportMessage(ERROR_LOG, cmd)
|
||||
if RunBackground:
|
||||
cmd += ' 2>&1 > '+log_file
|
||||
plist.append(Popen(cmd, stdout=None, stderr=None, shell=True))
|
||||
else:
|
||||
p = popenPipe(cmd+' 2>&1 | tee '+log_file)
|
||||
p.communicate()
|
||||
if p.returncode != 0: PkgError = True
|
||||
if RunBackground: waitBackgroundProcess(plist)
|
||||
|
||||
def sendReleaseMail(package, info):
|
||||
cmd = ScriptDir+'/ReleaseMail.php'
|
||||
if not os.access(cmd, os.X_OK): return
|
||||
version = info['version']
|
||||
try:
|
||||
build_num = version.split('-')[-1]
|
||||
cmd += ' '+build_num+' '+package
|
||||
except IndexError:
|
||||
reportMessage(ERROR_LOG, 'Fail to get build number from "'+version+'", use it directly to send relase mail.')
|
||||
cmd += ' '+version+' '+package
|
||||
reportMessage(ERROR_DEBUG, cmd)
|
||||
try: check_call(cmd, shell=True)
|
||||
except CalledProcessError: pass
|
||||
|
||||
def createGitTag(package, platforms, info):
|
||||
cmd = ScriptDir+'/PkgTag.py'
|
||||
if not os.access(cmd, os.X_OK): return
|
||||
name = info['package']
|
||||
version = info['version']
|
||||
|
||||
# Add tag
|
||||
tag_name = name+'-'+version+'-'+strftime('%y%m%d', localtime())
|
||||
tag_opt = '-y -p "'+string.join(platforms, ' ')+'"'
|
||||
if EnvTag != '': tag_opt += ' -e '+EnvTag
|
||||
if EnvSuffix != '': tag_opt += ' -s '+EnvSuffix
|
||||
if pythonutils.ENABLE_DEBUG: tag_opt += ' --debug'
|
||||
if DoBase: tag_opt += ' --base'
|
||||
cmd += ' '+tag_opt+' '+tag_name+' '+package
|
||||
reportMessage(ERROR_LOG, cmd)
|
||||
try: check_call(cmd, shell=True)
|
||||
except CalledProcessError: pass
|
||||
|
||||
# Commit uistring
|
||||
cmd = 'cd '+BaseDir+'/source/uistring;'
|
||||
cmd += 'git add .;'
|
||||
cmd += 'git commit -m "'+name+' '+version+'. Committed through '+ScriptName+'.";'
|
||||
cmd += 'git push;'
|
||||
reportMessage(ERROR_DEBUG, cmd)
|
||||
try: check_call(cmd, shell=True)
|
||||
except CalledProcessError: pass
|
||||
|
||||
def signPackage(arch, pattern):
|
||||
global PkgError
|
||||
major_ver, minor_ver = getEnvVer(arch, DictEnv)
|
||||
major_ver = int(major_ver)
|
||||
minor_ver = int(minor_ver)
|
||||
arch_dir = EnvDir + '/' + getArchDir(arch, DictEnv)
|
||||
spk_dir = '/image/packages/'
|
||||
src_dir = arch_dir + spk_dir
|
||||
|
||||
if major_ver < 5:
|
||||
return
|
||||
if not os.path.isdir(arch_dir):
|
||||
return
|
||||
for spk in os.listdir(src_dir):
|
||||
if not re.match(pattern, spk):
|
||||
continue
|
||||
cmd = 'chroot ' + arch_dir + ' php ' + PkgScripts + '/CodeSign.php --sign=' + spk_dir + spk
|
||||
try: check_call(cmd, shell = True)
|
||||
except CalledProcessError:
|
||||
PkgError = True
|
||||
reportMessage(ERROR_LOG, 'Failed to create signature: ' + spk)
|
||||
|
||||
def collectPackage(package, do_sign, milestone=None):
|
||||
global PkgError
|
||||
global FlashFail
|
||||
supported_platforms = []
|
||||
for arch in Platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
if os.path.isfile(arch_dir+'/source/'+package+'/INFO'):
|
||||
supported_platforms.append(arch)
|
||||
if len(supported_platforms) == 0:
|
||||
reportMessage(ERROR_LOG, 'No INFO file found!')
|
||||
return
|
||||
|
||||
info = readPackageInfo(EnvDir+'/'+getArchDir(supported_platforms[0], DictEnv)+'/source/'+package+'/INFO')
|
||||
package_id = info['package']
|
||||
name = package_id
|
||||
version = info['version']
|
||||
|
||||
# read setting file
|
||||
settings = readPackageSetting(EnvDir+'/'+getArchDir(supported_platforms[0], DictEnv)+'/source/'+package+'/SynoBuildConf/settings', package)
|
||||
if "pkg_name" in settings:
|
||||
name = settings["pkg_name"][0]
|
||||
|
||||
pattern = name + '.*' + version + '.*spk$'
|
||||
|
||||
result_dir = 'result_spk'+resolveDirSuffix()
|
||||
dst_dir = BaseDir+'/'+result_dir+'/'+name+'-'+version
|
||||
if os.path.exists(dst_dir):
|
||||
rename_dir = dst_dir+'.bad.'+strftime('%Y%m%d-%H%M', localtime())
|
||||
if os.path.isdir(rename_dir):
|
||||
rmtree(rename_dir)
|
||||
os.rename(dst_dir, rename_dir)
|
||||
os.makedirs(dst_dir)
|
||||
for arch in supported_platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
src_dir = arch_dir + '/image/packages/'
|
||||
|
||||
if do_sign:
|
||||
signPackage(arch, pattern)
|
||||
|
||||
hook = arch_dir+'/source/'+package+'/SynoBuildConf/collect'
|
||||
hook_env = {'SPK_SRC_DIR': src_dir, 'SPK_DST_DIR': dst_dir, 'SPK_VERSION': version}
|
||||
if os.path.isfile(hook):
|
||||
if not os.access(hook, os.X_OK):
|
||||
reportMessage(ERROR_LOG, hook+' not executable. Ignore it.')
|
||||
else:
|
||||
pipe = Popen(hook, shell=True, stdout=None, stderr=None, env=hook_env)
|
||||
pipe.communicate()
|
||||
if pipe.returncode != 0: PkgError = True
|
||||
continue
|
||||
info = readPackageInfo(arch_dir+'/source/'+package+'/INFO')
|
||||
src_files = src_dir+name+'*-'+version+'*.spk'
|
||||
try: check_call('mv '+src_files+' '+dst_dir+'/', shell=True)
|
||||
except CalledProcessError: reportMessage(ERROR_LOG, 'Fail to mv '+src_files)
|
||||
if PkgError: FlashFail = True
|
||||
|
||||
if not PkgError and os.access(ScriptDir+'/PkgImage', os.X_OK):
|
||||
upload_opt = '--suffix '+EnvSuffix if EnvSuffix != '' else ''
|
||||
if milestone != None: upload_opt += ' --milestone "'+BaseDir+'/source/'+package+'/SynoBuildConf/milestone:'+milestone+'"'
|
||||
if DemoMode: upload_opt += ' --demo'
|
||||
log_file = BaseDir+'/logs/error.upload'
|
||||
if os.path.isfile(log_file): os.rename(log_file, log_file+'.old')
|
||||
cmd = ScriptDir+'/PkgImage '+upload_opt+' '+version+' '+name+' 2>&1 | tee '+log_file
|
||||
reportMessage(ERROR_DEBUG, cmd)
|
||||
try: check_call(cmd, shell=True)
|
||||
except CalledProcessError: PkgError = True
|
||||
if not PkgError and not DemoMode:
|
||||
createGitTag(package, supported_platforms, info)
|
||||
if DoSendMail: sendReleaseMail(package, info)
|
||||
return
|
||||
|
||||
|
||||
def resolveSettings():
|
||||
global EnvDir
|
||||
EnvDir = BaseDir+'/build_env'+resolveDirSuffix()
|
||||
if not os.path.isdir(EnvDir):
|
||||
reportMessage(ERROR_ARG, 'Target folder '+EnvDir+' not found.')
|
||||
reportMessage(ERROR_LOG, 'Check available platforms under '+EnvDir)
|
||||
|
||||
if not Platforms :
|
||||
Platforms.extend(detectPlatforms(EnvDir, DictEnv))
|
||||
else:
|
||||
for arch in Platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
if not os.path.isdir(arch_dir):
|
||||
reportMessage(ERROR_ARG, 'Platform '+arch+'('+arch_dir+') not exist in '+EnvDir)
|
||||
for arch in ExcludedPlatforms:
|
||||
try: Platforms.remove(arch)
|
||||
except: pass
|
||||
if len(Platforms) == 0:
|
||||
reportMessage(ERROR_ARG, 'No existing platform specified')
|
||||
|
||||
# Check whether chroot is ready
|
||||
for arch in Platforms:
|
||||
arch_dir = EnvDir+'/'+getArchDir(arch, DictEnv)
|
||||
check_call('cp -f /etc/resolv.conf '+arch_dir+'/etc/', stderr=None, shell=True)
|
||||
check_call('cp -f /etc/hosts '+arch_dir+'/etc/', stderr=None, shell=True)
|
||||
try: check_call('chroot '+arch_dir+' echo -n ""', stderr=None, shell=True)
|
||||
except CalledProcessError: reportMessage(ERROR_ARG, 'Environment for '+arch+'('+arch_dir+') is not ready')
|
||||
|
||||
if __name__ == '__main__':
|
||||
RunBackground = False
|
||||
DoBase = False
|
||||
IgnoreBuiltin = True
|
||||
DoUpdate = DoLink = DoBuild = DoSign = True
|
||||
DoInstall = DoUpload = False
|
||||
DoSendMail = False
|
||||
DoUpdateCheck = False
|
||||
DemoMode = False
|
||||
Milestone = None
|
||||
BuildFail = InstallFail = FlashFail = PkgError = False
|
||||
Branch = 'master'
|
||||
Platforms = []
|
||||
ExcludedPlatforms = []
|
||||
EnvSuffix = ''
|
||||
EnvTag = ''
|
||||
EnvVer = ''
|
||||
SynoUpdateOpt = ''
|
||||
SynoBuildOpt = ''
|
||||
ProjDependsOpt = ''
|
||||
UpdateLog = 'logs/error.update'
|
||||
|
||||
# Parse options
|
||||
Date0 = time()
|
||||
LongOptions = ['base', 'no-builtin', 'help', 'debug', 'demo', 'ccache-size=', 'ccache-clean', 'no-sign']
|
||||
try:
|
||||
DictOpt, ListArg = getopt(sys.argv[1:], 'p:P:e:v:b:x:zs:j:m:JIicULlBSuh', LongOptions)
|
||||
except GetoptError:
|
||||
displayUsage(ERROR_ARG)
|
||||
for opt, arg in DictOpt:
|
||||
if opt == '-p': Platforms = arg.split(' ')
|
||||
if opt == '-P': ExcludedPlatforms = arg.split(' ')
|
||||
if opt == '-e': EnvTag = arg
|
||||
if opt == '-v': EnvVer = arg
|
||||
if opt == '-b': Branch = arg
|
||||
if opt == '-x':
|
||||
if re.match(r'^[0-9]+$', arg): ProjDependsOpt = '-x'+arg
|
||||
else: reportMessage(ERROR_ARG, 'Invalid dependency level "'+arg+'"')
|
||||
if opt == '-z': RunBackground = True
|
||||
if opt == '-s': EnvSuffix = arg
|
||||
if opt == '-j': SynoBuildOpt += ' --jobs '+arg
|
||||
if opt == '-J': SynoBuildOpt += ' -J'
|
||||
if opt == '-A': SynoBuildOpt += ' --without-ccache'
|
||||
if opt == '-I' or opt == '-i':
|
||||
DoUpdate = DoLink = DoBuild = False
|
||||
DoInstall = True
|
||||
DoUpload = True if opt == '-i' else False
|
||||
if opt == '-m': Milestone = arg
|
||||
if opt == '-c': DoInstall = DoUpload = DoSendMail = True
|
||||
if opt == '-U': DoUpdate = False
|
||||
if opt == '-L': DoUpdate = DoLink = False
|
||||
if opt == '-l': DoUpdate = DoBuild = False
|
||||
if opt == '-B': DoLink = DoBuild = False
|
||||
if opt == '-S': SynoBuildOpt += ' -S'
|
||||
if opt == '-u': DoUpdateCheck = True
|
||||
if opt == '--no-sign':
|
||||
DoSign = False
|
||||
if opt == '--demo':
|
||||
DemoMode = True
|
||||
os.environ['SYNO_DEMO_MODE'] = 'Yes'
|
||||
if opt == '--base': DoBase = True
|
||||
if opt == '--no-builtin':
|
||||
DoBase = True
|
||||
IgnoreBuiltin = False
|
||||
SynoUpdateOpt += ' --no-builtin'
|
||||
SynoBuildOpt += ' --no-builtin'
|
||||
if opt == '--debug': pythonutils.ENABLE_DEBUG = True
|
||||
if opt == '--ccache-size':
|
||||
if re.match(r'^[0-9]+(\.[0-9]+)?[KMG]?$', arg): SynoBuildOpt += ' --with-ccache '+arg
|
||||
else: reportMessage(ERROR_ARG, 'Invalid ccache size "'+arg+'"')
|
||||
if opt == '--ccache-clean': SynoBuildOpt += ' --with-clean-ccache'
|
||||
if opt == '-h' or opt == '--help': displayUsage(ERROR_NONE)
|
||||
|
||||
# Get environment
|
||||
if DoUpdate: updatePkgScripts()
|
||||
if len(ListArg) == 0:
|
||||
reportMessage(ERROR_ARG, 'Please specify package project')
|
||||
PkgProject = os.path.basename(ListArg[0])
|
||||
InputProjects = set(os.path.basename(p) for p in ListArg)
|
||||
UpdateScriptExist = True if os.access(ScriptDir+'/SynoUpdate', os.X_OK) else False
|
||||
|
||||
if DoUpdate and UpdateScriptExist:
|
||||
if os.path.isfile(BaseDir+'/'+UpdateLog):
|
||||
os.rename(BaseDir+'/'+UpdateLog, BaseDir+'/'+UpdateLog+'.old')
|
||||
updateProject(BasicProjects, 'master')
|
||||
updateProject(InputProjects, Branch)
|
||||
DictEnv = getBaseEnvironment(BaseDir, PkgProject, EnvTag, EnvVer)
|
||||
resolveSettings()
|
||||
|
||||
if Milestone != None:
|
||||
milestone_file = BaseDir+'/source/'+PkgProject+'/SynoBuildConf/milestone'
|
||||
if not os.path.isfile(milestone_file):
|
||||
reportMessage(ERROR_ARG, '"'+milestone_file+'" not exist')
|
||||
try: check_call(ScriptDir+'/include/check CheckMileStone '+milestone_file+ ' "'+Milestone+'"', shell=True)
|
||||
except CalledProcessError: reportMessage(ERROR_ARG, 'Milestone "'+Milestone+'" not found')
|
||||
|
||||
# Update, link and build
|
||||
if DoUpdate or DoLink or DoBuild:
|
||||
ProjectList = {}
|
||||
for arch in Platforms:
|
||||
hook = UpdateHook(arch, Branch, '', DoBase) if UpdateScriptExist and DoUpdate else None
|
||||
if UpdateScriptExist and DoUpdate: writeUpdateLog('\n\n==== Updating for '+arch+' ====\n\n')
|
||||
resolveBuildEnvPre(arch)
|
||||
Seen, RefOnly, ForPack = traverseDependProjects(InputProjects, arch, DictEnv, ScriptDir, DoBase, False, hook)
|
||||
resolveBuildEnvPost(arch, Seen['base'], RefOnly['base'])
|
||||
ProjectList[arch] = prepareProjects(arch)
|
||||
if DoLink: SynoBuildOpt += ' --dontask'
|
||||
else: SynoBuildOpt += ' --noclean'
|
||||
DateBuild0 = time()
|
||||
if DoBuild: buildPackage(PkgProject, ProjectList, SynoBuildOpt)
|
||||
if PkgError: BuildFail = True
|
||||
DateBuild1 = time()
|
||||
|
||||
# Install, collect spk
|
||||
DateInstall0 = time()
|
||||
if not PkgError and DoInstall:
|
||||
installPackage(PkgProject, True)
|
||||
if not PkgError: installPackage(PkgProject, False)
|
||||
if not PkgError: collectPackage(PkgProject, DoSign, Milestone)
|
||||
DateInstall1 = time()
|
||||
|
||||
# Show time consumption
|
||||
print ''
|
||||
if DoBuild: showTimeCost(DateBuild0, DateBuild1, 'Build')
|
||||
if DoInstall: showTimeCost(DateInstall0, DateInstall1, 'Install')
|
||||
print '\n['+ctime()+'] '+ScriptName+' Finish\n'
|
||||
Date1 = time()
|
||||
showTimeCost(Date0, Date1, ScriptName)
|
||||
|
||||
# Report
|
||||
if PkgError:
|
||||
log_msg = '!\nPlease check '+EnvDir+'/ds.{'+string.join(Platforms, ',')+'}/'
|
||||
err_msg = 'Some error(s) happened!'
|
||||
if BuildFail: err_msg += log_msg+'logs.build'
|
||||
if InstallFail: err_msg += log_msg+'logs.install'
|
||||
if FlashFail: err_msg += log_msg+'logs.flash'
|
||||
reportMessage(ERROR_OTHER, err_msg) # Exit
|
||||
sys.exit(ERROR_NONE)
|
439
ProjectDepends.py
Executable file
439
ProjectDepends.py
Executable file
@ -0,0 +1,439 @@
|
||||
#!/usr/bin/python2
|
||||
|
||||
import sys
|
||||
import string
|
||||
import os
|
||||
import glob
|
||||
import argparse
|
||||
import re
|
||||
from sets import Set
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(sys.argv[0])) + '/include')
|
||||
import pythonutils
|
||||
sys.path.append(os.path.dirname(os.path.abspath(sys.argv[0])) + '/include/python')
|
||||
|
||||
# XXX: unified the variable with pythonutils.py
|
||||
# config file, to get basic project parameters
|
||||
config_path = "include/project.depends"
|
||||
section_depends = "project dependency"
|
||||
section_depends64 = "64bit project dependency"
|
||||
section_variables = "variables"
|
||||
|
||||
# for kernel project replacement
|
||||
kernel_variable = "${Kernel}"
|
||||
libc_project = "uclibc0929"
|
||||
|
||||
# Target sections in SynoBuildConf for packages
|
||||
target_sections = ["BuildDependent", "BuildDependent-Tag"]
|
||||
target_sections64 = ["BuildDependent64", "BuildDependent-Tag64"]
|
||||
dynamic_variable = "dynamic variable list"
|
||||
|
||||
|
||||
class DependencyError(Exception):
|
||||
def __init__(self, stack, proj):
|
||||
self.stack = stack
|
||||
self.project = proj
|
||||
print("Error! Circluar dependency found!!")
|
||||
|
||||
def dumpCircluarDepList(self):
|
||||
blFound = False
|
||||
for proj in self.stack:
|
||||
if proj == self.project:
|
||||
blFound = True
|
||||
if blFound:
|
||||
print(proj + " -> ")
|
||||
print(self.project)
|
||||
|
||||
|
||||
class DepGraph:
|
||||
# all these attributes are not necessary, just for prototype reference
|
||||
def __init__(self, dictIn, level, direct, blUseSection64):
|
||||
self.dict = dictIn
|
||||
self.direct = direct
|
||||
self.stack = []
|
||||
self.listOut = []
|
||||
self.level = level
|
||||
self.graph = {}
|
||||
self.useSection64 = blUseSection64
|
||||
|
||||
def traveseList(self, listProjs, t_level):
|
||||
if self.level != 0 and t_level >= self.level:
|
||||
return
|
||||
|
||||
for proj in listProjs:
|
||||
if proj in self.stack:
|
||||
raise DependencyError(self.stack, proj)
|
||||
if proj in self.listOut:
|
||||
continue
|
||||
self.stack.append(proj)
|
||||
depProj = self.getDepProjList(proj)
|
||||
if len(depProj) > 0:
|
||||
self.traveseList(depProj, t_level+1)
|
||||
self.listOut.append(proj)
|
||||
self.stack.pop()
|
||||
|
||||
def traverseDepends(self, listProjs):
|
||||
try:
|
||||
self.traveseList(listProjs, 0)
|
||||
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
|
||||
|
||||
def getReverseDep(self, proj):
|
||||
Dict = {}
|
||||
if self.useSection64:
|
||||
reverseDep = []
|
||||
Dict = self.dict[section_depends64]
|
||||
reverseDep = self.getReverseList(proj, Dict)
|
||||
if reverseDep:
|
||||
return reverseDep
|
||||
|
||||
Dict = self.dict[section_depends]
|
||||
return self.getReverseList(proj, Dict)
|
||||
|
||||
def getTraverseList(self, proj, Dict):
|
||||
if proj in Dict:
|
||||
return Dict[proj]
|
||||
return []
|
||||
|
||||
def getTraverseDep(self, proj):
|
||||
Dict = {}
|
||||
if self.useSection64:
|
||||
Dict = self.dict[section_depends64]
|
||||
traverseDep = self.getTraverseList(proj, Dict)
|
||||
if traverseDep:
|
||||
return traverseDep
|
||||
|
||||
Dict = self.dict[section_depends]
|
||||
return self.getTraverseList(proj, Dict)
|
||||
|
||||
def getDepProjList(self, proj):
|
||||
# -r : Expand project dependency list reversely.
|
||||
if self.direct == 'backwardDependency':
|
||||
return self.getReverseDep(proj)
|
||||
|
||||
# -x: Traverse all dependant projects
|
||||
return self.getTraverseDep(proj)
|
||||
|
||||
|
||||
class DepNode:
|
||||
def __init__(self, proj):
|
||||
self.nodeName = proj
|
||||
self.projDependOn = []
|
||||
self.projDependedBy = []
|
||||
|
||||
def dumpNode(self):
|
||||
print('Project depened on : ' + self.projDependOn)
|
||||
print('Project depended by : ' + self.projDependedBy)
|
||||
|
||||
|
||||
def dumpProjectDepends(project, dict):
|
||||
if project in dict:
|
||||
print()
|
||||
print("check this line in file '" + config_path + "'")
|
||||
print(project + ": " + string.join(dict[project]))
|
||||
|
||||
|
||||
def _replaceVariable(dictVars, dictDepends):
|
||||
for var in dictVars:
|
||||
for proj in dictDepends:
|
||||
oldList = dictDepends[proj]
|
||||
if var in oldList: # if var is in dependency list, replace it
|
||||
strNew = string.join(oldList)
|
||||
strNew = strNew.replace(var, string.join(dictVars[var]))
|
||||
dictDepends[proj] = strNew.split()
|
||||
|
||||
# if the variable is a project name, replace the project name
|
||||
if var == proj:
|
||||
newProj = string.join(dictVars[var])
|
||||
newVal = dictDepends.pop(proj)
|
||||
dictDepends[newProj] = newVal
|
||||
|
||||
|
||||
# replace project.depends Variable section in project dependency section
|
||||
# i.e. ${KernelPacks} to synobios
|
||||
def replaceVariableSection(dict, bl64bit):
|
||||
dictVars = dict[section_variables]
|
||||
dictDepends = dict[section_depends]
|
||||
_replaceVariable(dictVars, dictDepends)
|
||||
|
||||
if bl64bit:
|
||||
dictDepends = dict[section_depends64]
|
||||
_replaceVariable(dictVars, dictDepends)
|
||||
|
||||
|
||||
def getAllDependencyKey(dict):
|
||||
allDepProjkeys = dict[section_depends].keys()
|
||||
|
||||
if dict[section_depends64].keys():
|
||||
for proj in dict[section_depends64].keys():
|
||||
if proj not in allDepProjkeys:
|
||||
allDepProjkeys.append(proj)
|
||||
return allDepProjkeys
|
||||
|
||||
|
||||
def isKernelHeaderProj(newProj):
|
||||
pattern_header = re.compile(r"^linux-.*-virtual-headers$")
|
||||
if pattern_header.match(newProj):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def normalizeProjects(dict, projects, kernels):
|
||||
out_projects = set()
|
||||
blAddKernelHeader = None
|
||||
|
||||
for proj in projects:
|
||||
newProj = proj.rstrip("/")
|
||||
|
||||
if isKernelHeaderProj(newProj):
|
||||
newProj = ""
|
||||
blAddKernelHeader = True
|
||||
if isKernelProject(dict, newProj):
|
||||
out_projects.update(kernels)
|
||||
continue
|
||||
elif newProj == libc_project: # always skip libc
|
||||
newProj = ""
|
||||
|
||||
out_projects.add(newProj)
|
||||
|
||||
return blAddKernelHeader, list(out_projects)
|
||||
|
||||
|
||||
def findPlatformDependsProj(platformDependsSection, platforms):
|
||||
listReplaceProj = Set()
|
||||
projects = []
|
||||
|
||||
# if there is no platform specified, check for all platforms
|
||||
if len(platforms) <= 0:
|
||||
platforms = platformDependsSection.keys()
|
||||
|
||||
# get all kernel projects of all specific platforms
|
||||
for p in platforms:
|
||||
if p in platformDependsSection:
|
||||
projects = platformDependsSection[p]
|
||||
else: # not in platform depends section
|
||||
try:
|
||||
projects = platformDependsSection['default']
|
||||
except KeyError:
|
||||
print("No such platform : " + p)
|
||||
sys.exit(1)
|
||||
|
||||
for proj in projects:
|
||||
listReplaceProj.add(proj)
|
||||
|
||||
return listReplaceProj
|
||||
|
||||
|
||||
def replaceVariableInDictSection(dictInput, variable, projsToReplace):
|
||||
for key in dictInput:
|
||||
listDepProj = dictInput[key]
|
||||
if variable in listDepProj:
|
||||
for proj in projsToReplace:
|
||||
listDepProj.insert(listDepProj.index(variable), proj)
|
||||
listDepProj.remove(variable)
|
||||
|
||||
|
||||
# Replace ${XXXX} in dependency list by [${XXXX}] section
|
||||
def replacePlatformDependsVariable(dictInput, platforms, bl64bit):
|
||||
def replaceVariableWithSection(variable, section_name):
|
||||
try:
|
||||
dictSection = dictInput[section_name]
|
||||
except KeyError:
|
||||
print("No such section:" + variable)
|
||||
|
||||
listPlatformDependsProj = findPlatformDependsProj(dictSection,
|
||||
platforms)
|
||||
|
||||
replaceVariableInDictSection(dictInput[section_depends],
|
||||
variable,
|
||||
listPlatformDependsProj)
|
||||
if bl64bit:
|
||||
replaceVariableInDictSection(dictInput[section_depends64],
|
||||
variable,
|
||||
listPlatformDependsProj)
|
||||
|
||||
if dynamic_variable not in dictInput:
|
||||
# for old project depends compatibility
|
||||
replaceVariableWithSection("${KernelProjs}", pythonutils.SECTION_KERNEL_OLD)
|
||||
return
|
||||
for variable in dictInput[dynamic_variable]['list']:
|
||||
replaceVariableWithSection(variable, variable)
|
||||
|
||||
|
||||
def isKernelProject(dictInput, strProj):
|
||||
bRet = False
|
||||
listKernels = pythonutils.getKernelDict(dictInput).values()
|
||||
listKernel = []
|
||||
|
||||
for list in listKernels:
|
||||
listKernel += list
|
||||
|
||||
if strProj in listKernel:
|
||||
bRet = True
|
||||
|
||||
return bRet
|
||||
|
||||
|
||||
def is64BitPlatform(platform):
|
||||
listPlatform64 = ['x64', 'bromolow', 'cedarview', 'avoton', 'braswell']
|
||||
if platform in listPlatform64:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def checkPlatform(platforms):
|
||||
bl64bit = True
|
||||
bl32bit = True
|
||||
for platform in platforms:
|
||||
blPlatformArch = is64BitPlatform(platform)
|
||||
bl64bit &= blPlatformArch
|
||||
bl32bit &= not blPlatformArch
|
||||
|
||||
if bl32bit is True:
|
||||
return "32"
|
||||
if bl64bit is True:
|
||||
return "64"
|
||||
|
||||
return "mix"
|
||||
|
||||
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('--header', dest='dump_header', default=False, action='store_true', help="Output kernel header")
|
||||
parser.add_argument('listProj', nargs='*', type=str, help='Replace project list')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def loadConfigFiles(platforms):
|
||||
dictConfigs = {}
|
||||
|
||||
strCurrentDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
strOutConfigPath = strCurrentDir + "/" + config_path
|
||||
dictConfigs = pythonutils.readKeyValueConfig(strOutConfigPath)
|
||||
|
||||
confList = glob.glob(strCurrentDir + "/../source/*/SynoBuildConf/depends*")
|
||||
for confPath in confList:
|
||||
project = confPath.split('/')[-3]
|
||||
filename = confPath.split('/')[-1]
|
||||
|
||||
if os.path.isfile(confPath):
|
||||
confSetting = pythonutils.readDependsConf(confPath, platforms)
|
||||
for sec, project_type in [(section_depends, 'build'), (section_depends64, 'build64')]:
|
||||
# we don't have section_depends64 in old file
|
||||
if sec not in dictConfigs and sec == section_depends64:
|
||||
continue
|
||||
if project not in dictConfigs[sec]:
|
||||
dictConfigs[sec][project] = []
|
||||
dictConfigs[sec][project] += confSetting[project_type]['curr']
|
||||
dictConfigs[sec][project] += confSetting[project_type]['base']
|
||||
|
||||
for rewriteProj in confSetting[project_type]['bug']:
|
||||
# XXX: what if the project hasn't loaded into dictConfigs?
|
||||
if rewriteProj in dictConfigs[sec]:
|
||||
dictConfigs[sec][rewriteProj] = confSetting[project_type]['bug'][rewriteProj]
|
||||
|
||||
return dictConfigs
|
||||
|
||||
# main procedure
|
||||
if __name__ == "__main__":
|
||||
# get command line arguments
|
||||
dictConfigs = {}
|
||||
listProjs = []
|
||||
listOut = []
|
||||
blAddKernelHeader = False
|
||||
direct = 'forwardDependency'
|
||||
|
||||
platforms = []
|
||||
level = -1
|
||||
|
||||
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:
|
||||
level = dictArgs.level
|
||||
elif dictArgs.r_level >= 0:
|
||||
level = dictArgs.r_level
|
||||
direct = 'backwardDependency'
|
||||
|
||||
# Reorder, we need to traverse all depend to sort the input projects.
|
||||
if dictArgs.level == -1 and dictArgs.r_level == -1:
|
||||
level = 0
|
||||
|
||||
dictConfigs = loadConfigFiles(platforms)
|
||||
|
||||
listProjs = dictArgs.listProj
|
||||
|
||||
kernelSection = pythonutils.getKernelDict(dictConfigs)
|
||||
kernels = findPlatformDependsProj(kernelSection, platforms)
|
||||
|
||||
platformArch = checkPlatform(platforms)
|
||||
if platformArch == "64" and section_depends64 in dictConfigs:
|
||||
bl64bit = True
|
||||
else:
|
||||
bl64bit = False
|
||||
|
||||
if listProjs:
|
||||
dictDepGraph = {}
|
||||
blAddKernelHeader, normalizedProjList = normalizeProjects(dictConfigs, listProjs, kernels)
|
||||
replaceVariableSection(dictConfigs, bl64bit)
|
||||
replacePlatformDependsVariable(dictConfigs, platforms, bl64bit)
|
||||
depGraph = DepGraph(dictConfigs, level, direct, bl64bit)
|
||||
listOut = depGraph.traverseDepends(normalizedProjList)
|
||||
|
||||
# mix means input has two different arch platform, we need to build
|
||||
# another graph for different arch.
|
||||
if platformArch == 'mix':
|
||||
depGraphMix = DepGraph(dictConfigs, level, direct, not bl64bit)
|
||||
listMix = depGraphMix.traverseDepends(normalizedProjList)
|
||||
for proj in listMix:
|
||||
if proj not in listOut:
|
||||
listOut.append(proj)
|
||||
|
||||
# reorder need filter while args not contain 'x' and 'r'
|
||||
if dictArgs.level == -1 and dictArgs.r_level == -1:
|
||||
listReorder = []
|
||||
for proj in listOut:
|
||||
if proj in listProjs:
|
||||
listReorder.append(proj)
|
||||
listOut = listReorder
|
||||
|
||||
if blAddKernelHeader or dictArgs.level >= 0 or dictArgs.dump_header:
|
||||
listKernelHeader = []
|
||||
for kernel in kernels:
|
||||
listKernelHeader.append(kernel + '-virtual-headers')
|
||||
listOut = listKernelHeader + listOut
|
||||
|
||||
strOut = string.join(listOut, " ")
|
||||
if len(strOut) > 0:
|
||||
print(strOut)
|
||||
elif len(platforms) > 0:
|
||||
# has platform specified, print kernel version
|
||||
if len(kernels) == 0:
|
||||
sys.stderr.write('Error: No matching kernel found!\n')
|
||||
sys.exit(1)
|
||||
if blAddKernelHeader or dictArgs.dump_header:
|
||||
listKernelHeader = []
|
||||
for kernel in kernels:
|
||||
listKernelHeader.append(kernel + '-virtual-headers')
|
||||
print(string.join(listKernelHeader, " "))
|
||||
else:
|
||||
print(" ".join(kernels))
|
||||
else: # len(listProjs) <= 0
|
||||
sys.exit(1)
|
46
README.md
Normal file
46
README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# 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.0 -p x64 # for example
|
||||
```
|
||||
|
||||
Finally, the whole working directory will look like the following figure,
|
||||
and **ds.${platform}-${version}** is the chroot environment to build your own projects.
|
||||
|
||||
```
|
||||
toolkit/
|
||||
├── pkgscripts/
|
||||
└── build_env/
|
||||
├── ds.${platform}-${version}/
|
||||
├── ...
|
||||
└── ds.${platform}-${version}/
|
||||
|
||||
```
|
||||
|
||||
### 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 {version} --list
|
||||
./EnvDeploy -v {version} --info platform
|
||||
```
|
||||
|
||||
### Update Environment
|
||||
Use EnvDeploy again to update your environments. For example, update x64 for DSM {{ book.ToolkitVersion }} by following command.
|
||||
```
|
||||
./EnvDeploy -v {version} -p x64
|
||||
```
|
||||
|
||||
### Remove Environment
|
||||
Remove 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 illustrate how to remove a building environment with version 5.2 and platform x64.
|
||||
|
||||
```
|
||||
chroot /toolkit/build_env/ds.x64-{version} umount /proc
|
||||
rm -rf /toolkit/build_env/ds.x64-{version}
|
||||
```
|
153
SynoBuild
Executable file
153
SynoBuild
Executable file
@ -0,0 +1,153 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
LANG=""
|
||||
LC_ALL=""
|
||||
. $(dirname `readlink -f "$0"`)/include/init
|
||||
|
||||
Usage() {
|
||||
cat << EOF
|
||||
|
||||
Usage
|
||||
`basename $0` [OPTIONS] project_name+
|
||||
|
||||
Synopsis
|
||||
Build projects.
|
||||
|
||||
Options
|
||||
-p, --platform {platform}
|
||||
Specify target platform.
|
||||
-c, --clean, --dontask
|
||||
Cleanup before building.
|
||||
-C, --cleanonly
|
||||
Cleanup only and exit.
|
||||
-j, --jobs {num}
|
||||
Specify how many jobs to build in parallel. Default is 4.
|
||||
-J Disable parallel build.
|
||||
-S Disable silent make.
|
||||
-x {level}
|
||||
Build all dependant projects. Can specify level of dependency.
|
||||
Expand project dependency list, and build them in turn.
|
||||
Cannot be used with -r and default value is 0.
|
||||
For example, -x3 means to traverse dependency to 3rd level (itself as level 0)
|
||||
-r {level}
|
||||
Expand project dependency list reversely, then build all depending projects.
|
||||
-d, --with-debug
|
||||
Build with debugging definition.
|
||||
-N, --noclean
|
||||
Do not cleanup before building.
|
||||
--no-builtin
|
||||
Do not skip built-in projects.
|
||||
--with-ccache {size}
|
||||
Set size of ccache to reduce compiler activities. Default is $DefaultCCacheSize.
|
||||
--with-clean-ccache
|
||||
Build with a cleared ccache.
|
||||
--min-sdk {version}
|
||||
Specify minimum required SDK version (for example, 4.0).
|
||||
-h, --help
|
||||
This help message.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
AppendSynoXtraCflags(){
|
||||
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"
|
||||
}
|
||||
|
||||
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 $@`
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
Usage
|
||||
exit 1
|
||||
fi
|
||||
set -- $ARGS
|
||||
|
||||
CheckPermission
|
||||
|
||||
main() {
|
||||
local projectList=
|
||||
local logFile=
|
||||
local builtinProjs=
|
||||
|
||||
ParseBuildDefaultArgs "$@"
|
||||
ParseExtArgs $UnHandledOpt
|
||||
|
||||
# Setup build environment
|
||||
SetupBuildEnv AppendSynoXtraCflags
|
||||
|
||||
projectList=$(NormalizeBuildProjects $InputProjs)
|
||||
INFO "" "projectList=\"$projectList\""
|
||||
builtinProjs=$(CollectBuiltinProjs)
|
||||
|
||||
for ThisProj in $projectList; do
|
||||
logFile="$LogDir/${ThisProj}.build"
|
||||
[ -f "$logFile" ] && mv -f $logFile $logFile.old
|
||||
|
||||
(
|
||||
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
|
||||
|
||||
CheckTimeCostLog build $projectList
|
||||
if ! CheckErrorLog build $projectList; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
main $@
|
96
SynoInstall
Executable file
96
SynoInstall
Executable file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
. $(dirname `readlink -f "$0"`)/include/init
|
||||
|
||||
LANG=""
|
||||
LC_ALL=""
|
||||
|
||||
Usage() {
|
||||
cat << EOF
|
||||
|
||||
Usage
|
||||
`basename $0` [OPTIONS] project_name+
|
||||
|
||||
Synopsis
|
||||
Install projects.
|
||||
|
||||
Options
|
||||
-p, --platform {platform}
|
||||
Specify target platform.
|
||||
-d, --with-debug
|
||||
Install binaries with debug symbols.
|
||||
-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
|
||||
;;
|
||||
*)
|
||||
Error "Unhandled option '$1'"
|
||||
Usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
local projectList=
|
||||
local logFile=
|
||||
local installFailed=N
|
||||
|
||||
ParseDefaultInstallArgs $@
|
||||
ParsePkgInstallArgs $UnHandledOpt
|
||||
|
||||
SetupInstallEnv "$IsDebugBuild"
|
||||
|
||||
projectList=$(UnifyInstallProjects $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 ! CheckErrorLog install $projectList; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
INFO "Finished SynoInstall script."
|
||||
return 0
|
||||
}
|
||||
|
||||
main $@
|
146
include/applyEnv
Normal file
146
include/applyEnv
Normal file
@ -0,0 +1,146 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_APPLY_ENV__" ]; then
|
||||
__INCLUDE_APPLY_ENV__=defined
|
||||
|
||||
Source "include/check"
|
||||
|
||||
FunCreateCCacheWrap() # {{{
|
||||
{
|
||||
for bin in $*
|
||||
do
|
||||
[ -z "$bin" ] && continue
|
||||
ln -fs /usr/bin/ccache-wrap $bin
|
||||
done
|
||||
}
|
||||
|
||||
_AssignArch() {
|
||||
eval $1=\$$1$2
|
||||
}
|
||||
|
||||
_ApplyEnvDir() {
|
||||
[ "$1" = "build" ] && SynoDir="/usr"
|
||||
[ "$1" = "install" ] && SynoDir="/usr/syno"
|
||||
SynoLibDir="$SynoDir/lib"
|
||||
SynoBinDir="$SynoDir/bin"
|
||||
SynoIncludeDir="$SynoDir/include"
|
||||
SynoShareDir="$SynoDir/share"
|
||||
LibDir="/usr/lib"
|
||||
BinDir="/usr/bin"
|
||||
IncludeDir="/usr/include"
|
||||
Prefix="/usr"
|
||||
ShareDir="/usr/share"
|
||||
SysRootPrefix="${ToolChainSysRoot}/usr"
|
||||
SysRootInclude="${ToolChainSysRoot}/usr/include"
|
||||
SysRootLib="${ToolChainSysRoot}/usr/lib"
|
||||
SysRootBin="${ToolChainSysRoot}/usr/bin"
|
||||
}
|
||||
|
||||
_ApplyBuildFlag() {
|
||||
local arch="$1"
|
||||
local phase="`GetBuildPhase $VERSION_FILE`"
|
||||
|
||||
_AssignArch "ToolChainDir" $arch
|
||||
_AssignArch "ToolChainPrefix" $arch
|
||||
_AssignArch "ToolChainBin" $arch
|
||||
_AssignArch "ToolChainInclude" $arch
|
||||
_AssignArch "ToolChainSysInclude" $arch
|
||||
_AssignArch "ToolChainSysRoot" $arch
|
||||
_AssignArch "ToolChainLib" $arch
|
||||
|
||||
_AssignArch "ConfigOpt" $arch
|
||||
_AssignArch "HOST" $arch
|
||||
|
||||
_AssignArch "CC" $arch
|
||||
_AssignArch "CXX" $arch
|
||||
_AssignArch "LD" $arch
|
||||
_AssignArch "AR" $arch
|
||||
_AssignArch "STRIP" $arch
|
||||
|
||||
_AssignArch "RANLIB" $arch
|
||||
_AssignArch "CFLAGS" $arch
|
||||
_AssignArch "LDFLAGS" $arch
|
||||
_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
|
||||
_AssignArch "GrubToolChainPrefix" $arch
|
||||
_AssignArch "GrubToolChainBin" $arch
|
||||
_AssignArch "GrubToolChainInclude" $arch
|
||||
_AssignArch "GrubToolChainSysInclude" $arch
|
||||
_AssignArch "GrubToolChainLib" $arch
|
||||
_AssignArch "GrubConfigOpt" $arch
|
||||
_AssignArch "GrubCFLAGS" $arch
|
||||
_AssignArch "GrubLDFLAGS" $arch
|
||||
_AssignArch "GrubCC" $arch
|
||||
_AssignArch "GrubCXX" $arch
|
||||
_AssignArch "GrubLD" $arch
|
||||
_AssignArch "GrubAR" $arch
|
||||
_AssignArch "GrubSTRIP" $arch
|
||||
_AssignArch "GrubRANLIB" $arch
|
||||
_AssignArch "GrubNM" $arch
|
||||
}
|
||||
|
||||
ApplyBuildEnv() {
|
||||
local arch="$1"
|
||||
_ApplyBuildFlag "${arch}"
|
||||
_ApplyEnvDir "build"
|
||||
|
||||
export PATH="/bin:/sbin:/usr/bin:/usr/syno/bin:${SysRootBin}"
|
||||
export BUILD_ARCH=$arch
|
||||
|
||||
if [ "$WithDebug" = "Yes" ]; then
|
||||
SYNO_XTRACFLAGS="$SYNO_XTRACFLAGS -DSYNO_DEBUG_BUILD"
|
||||
fi
|
||||
[ -z "$SYNO_XTRACFLAGS" ] && SYNO_XTRACFLAGS="-g"
|
||||
|
||||
CC="${ToolChainPrefix}ccache-gcc"
|
||||
CXX="${ToolChainPrefix}ccache-g++"
|
||||
[ -n "$StaticPrefix" ] && STATIC_CC="${StaticPrefix}ccache-gcc"
|
||||
|
||||
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}"
|
||||
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}"
|
||||
|
||||
CXXFLAGS="${CFLAGS}"
|
||||
}
|
||||
|
||||
ApplyInstallEnv() {
|
||||
local InstallArch="$1"
|
||||
|
||||
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}"
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
464
include/build
Normal file
464
include/build
Normal file
@ -0,0 +1,464 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 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"
|
||||
|
||||
PlatformOpts=`AllPlatformOptionsComma`
|
||||
BuildDefaultArgs="acCNdhx:r:p:jJSgT"
|
||||
BuildDefaultLongArgs="${PlatformOpts}platform:,\
|
||||
clean,noclean,cleanonly,dontask,\
|
||||
jobs:,without-ccache,with-ccache:,with-clean-ccache,\
|
||||
with-debug,help"
|
||||
|
||||
MakeSilent="Yes"
|
||||
MakeJobs="Yes"
|
||||
WithCcache="Yes"
|
||||
WithCleanCcache="No"
|
||||
WithDebug="No"
|
||||
|
||||
BUILD_DEP_LEVEL=""
|
||||
DEP_OPT=""
|
||||
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
|
||||
|
||||
# This function will parse default build args
|
||||
# InputProjs and UnHandledOpt will be export
|
||||
ParseBuildDefaultArgs(){
|
||||
unset InputProjs
|
||||
unset UnHandledOpt
|
||||
|
||||
while [ -n "$1" ]; do # {{{
|
||||
if IsPlatformOption $1; then
|
||||
AskPlatform $1
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
# platforms
|
||||
"-p" | "--platform")
|
||||
AskPlatform "--$2"
|
||||
shift
|
||||
;;
|
||||
# "make clean" options
|
||||
"-C" | "--cleanonly")
|
||||
MakeClean="Yes"
|
||||
CleanOnly="Yes"
|
||||
;;
|
||||
"-c" | "--clean" | "--dontask")
|
||||
MakeClean="Yes"
|
||||
;;
|
||||
"-N" | "--noclean")
|
||||
MakeClean="No"
|
||||
;;
|
||||
"-d" | "--with-debug")
|
||||
WithDebug="Yes"
|
||||
;;
|
||||
"--help" | "-h")
|
||||
Usage
|
||||
exit 0
|
||||
;;
|
||||
"-j")
|
||||
MakeJobs="Yes"
|
||||
;;
|
||||
"-J")
|
||||
MakeJobs="No"
|
||||
;;
|
||||
"--jobs")
|
||||
JOBS="$2"
|
||||
if [ "$2" -gt 1 ]; then
|
||||
MakeJobs="Yes"
|
||||
else
|
||||
MakeJobs="No"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
"-S")
|
||||
MakeSilent="No"
|
||||
;;
|
||||
"--without-ccache")
|
||||
WithCcache="No"
|
||||
;;
|
||||
"--with-ccache")
|
||||
WithCcache="Yes"
|
||||
if [[ "$2" =~ ^[0-9]+(\.[0-9]+)?[KMG]?$ ]]; then
|
||||
CCACHE_SIZE="$2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
"--with-clean-ccache")
|
||||
WithCcache="Yes"
|
||||
WithCleanCcache="Yes"
|
||||
;;
|
||||
"-x"|"-r")
|
||||
DEP_OPT="$1"
|
||||
|
||||
OPT_TMP=$2
|
||||
REG_TMP="^[0-9]+$"
|
||||
if [[ $OPT_TMP =~ $REG_TMP ]] ; then # valid level number, set as args
|
||||
BUILD_DEP_LEVEL="$2"
|
||||
shift
|
||||
else # if it's not a valid level number, skip it and reset OPTIND to last one
|
||||
BUILD_DEP_LEVEL="0" # 0 means to traverse all dependencies
|
||||
fi
|
||||
;;
|
||||
"-T")
|
||||
ENABLE_LTTNG_FLAGS=true
|
||||
;;
|
||||
"--")
|
||||
# remaining are project names
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
[ -n "$UnHandledOpt" ] && UnHandledOpt="$UnHandledOpt $1" || UnHandledOpt="$1"
|
||||
shift
|
||||
if [ "$1" = '--' ]; then
|
||||
shift
|
||||
break
|
||||
elif [[ "$1" =~ "-" ]]; then
|
||||
continue
|
||||
else
|
||||
UnHandledOpt="$UnHandledOpt $1"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done # }}}
|
||||
InputProjs=$@
|
||||
|
||||
if [ -z "$BUILD_OPT" ]; then
|
||||
# call again without parameters
|
||||
# to prompt user interactively
|
||||
AskPlatform
|
||||
fi
|
||||
}
|
||||
|
||||
NormalizeBuildProjects() {
|
||||
local projName=
|
||||
local projBaseName=
|
||||
local proj=
|
||||
local projList=
|
||||
|
||||
# Get basename for each project which are provide by argument.
|
||||
for projName in "$@"; do
|
||||
projBaseName=`basename $projName`
|
||||
projList="$projList $projBaseName"
|
||||
done
|
||||
|
||||
projList=$(echo $projList | sed 's/ /\n/g' | sort | uniq)
|
||||
if [ -z "$projList" ]; then
|
||||
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
|
||||
|
||||
echo $projList
|
||||
return 0
|
||||
}
|
||||
|
||||
ExcludeProjects() {
|
||||
local projList=$@
|
||||
local retProjs=
|
||||
|
||||
retProjs=$(ExcludeList "$projList" "$(getPlatformExcludeProjs)")
|
||||
BuildMachineOnly || retProjs=$(ExcludeList "$retProjs" ".*-virtual-protection dsm-Protection")
|
||||
echo $retProjs
|
||||
}
|
||||
|
||||
CheckCleanSource() {
|
||||
if [ -z $MakeClean ]; then
|
||||
printf "Do you want to make disclean before compile?(Y/N)[Y]:"
|
||||
read MakeClean
|
||||
|
||||
if [ "$MakeClean" != "N" -a "$MakeClean" != "n" ]; then
|
||||
MakeClean="Yes"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: hook for setup build env
|
||||
SetupBuildEnv() # {{{
|
||||
{
|
||||
local hook=$1
|
||||
|
||||
# Setup platform-dependent environment
|
||||
LoadPlatformRelated || exit 1
|
||||
|
||||
SetupDSMBuildNumber
|
||||
SetupCcache
|
||||
CheckCleanSource
|
||||
|
||||
export SYNO_PLATFORM="${BUILD_TARGET}"
|
||||
JOBS=${JOBS:-4}
|
||||
|
||||
# Execute build env hook
|
||||
if [ -n "$hook" ] && [ "$(type -t $hook)" = "function" ]; then
|
||||
$hook
|
||||
fi
|
||||
|
||||
[ -d "$DebDevBuild" ] && rm -rf $DebDevBuild/* || mkdir -p $DebDevBuild
|
||||
[ -d "$DebPkgDir" ] || mkdir -p $DebPkgDir
|
||||
|
||||
mkdir -p $LogDir
|
||||
CheckErrorOut $? "Failed to create $LogDir"
|
||||
GenerateEnvMak
|
||||
} #}}}
|
||||
|
||||
GenerateSelector() #{{{
|
||||
{
|
||||
local file="/env.mak"
|
||||
|
||||
cat << EOF > $file
|
||||
ifdef BUILD_ARCH
|
||||
ifeq ("\$(BUILD_ARCH)", "64")
|
||||
include /env64.mak
|
||||
else
|
||||
include /env32.mak
|
||||
endif
|
||||
endif
|
||||
EOF
|
||||
} #}}}
|
||||
|
||||
WriteEnvToFile() {
|
||||
local file="$1"
|
||||
|
||||
rm $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
|
||||
echo "ToolChainInclude=$ToolChainInclude" >> $file
|
||||
echo "ToolChainLib=$ToolChainLib" >> $file
|
||||
echo "ARCH=$ARCH" >> $file
|
||||
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 "LD=$LD" >> $file
|
||||
echo "AR=$AR" >> $file
|
||||
echo "STRIP=$STRIP" >> $file
|
||||
echo "STRIP_ORI=$STRIP_ORI" >> $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
|
||||
echo "SynoBinDir=$SynoBinDir" >> $file
|
||||
echo "BUILD_ARCH=$BUILD_ARCH" >> $file
|
||||
echo "SysRootPrefix=$ToolChainSysRoot/usr" >> $file
|
||||
echo "SysRootInclude=$ToolChainSysRoot/usr/include" >> $file
|
||||
echo "SysRootLib=$ToolChainSysRoot/usr/lib" >> $file
|
||||
echo "PLATFORM_FAMILY=$PLATFORM_FAMILY" >> $file
|
||||
|
||||
if Is64BitPlatform; then
|
||||
echo "GrubToolChainDir=$GrubToolChainDir64" >> $file
|
||||
echo "GrubConfigOpt=\"$GrubConfigOpt64\"" >> $file
|
||||
echo "GrubToolChainPrefix=$GrubToolChainPrefix64" >> $file
|
||||
echo "GrubToolChainInclude=$GrubToolChainInclude64" >> $file
|
||||
echo "GrubToolChainLib=$GrubToolChainLib64" >> $file
|
||||
echo "GrubCFLAGS=$GrubCFLAGS64" >> $file
|
||||
echo "GrubLDFLAGS=$GrubLDFLAGS64" >> $file
|
||||
echo "GrubCC=${GrubToolChainPrefix64}ccache-gcc" >> $file
|
||||
echo "GrubCXX=${GrubToolChainPrefix64}ccache-g++" >> $file
|
||||
echo "GrubLD=$GrubLD64" >> $file
|
||||
echo "GrubAR=$GrubAR64" >> $file
|
||||
echo "GrubSTRIP=$GrubSTRIP64" >> $file
|
||||
echo "GrubRANLIB=$GrubRANLIB64" >> $file
|
||||
echo "GrubNM=$GrubNM64" >> $file
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
GenerateEnvMak() # {{{
|
||||
{
|
||||
local arch=
|
||||
local supportArch="32"
|
||||
|
||||
if Is64BitPlatform; then
|
||||
supportArch="$supportArch 64"
|
||||
fi
|
||||
|
||||
# /env.mak
|
||||
GenerateSelector
|
||||
|
||||
# /env32.mak and /env64.mak
|
||||
for arch in $supportArch; do
|
||||
ApplyBuildEnv "$arch"
|
||||
WriteEnvToFile "/env${arch}.mak"
|
||||
done
|
||||
|
||||
return 0
|
||||
} # }}}
|
||||
|
||||
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_SLOPPINESS=file_macro,include_file_mtime,time_macros
|
||||
mkdir -p ${CCACHE_DIR}
|
||||
chmod 1777 ${CCACHE_DIR}
|
||||
$CCACHE_BIN -M ${CCACHE_SIZE:-$DEFAULT_CCACHE_SIZE}
|
||||
$CCACHE_BIN -z
|
||||
|
||||
if [ "${WithCleanCcache}" = "Yes" ]; then
|
||||
$CCACHE_BIN --clear
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ActionsBeforeDebPack() {
|
||||
# get SysRoot path
|
||||
local sysRootPath=$ToolChainSysRoot
|
||||
|
||||
# move file to SysRoot
|
||||
mkdir -p $DebDevBuild/$sysRootPath
|
||||
mv $DebDevDir/* $DebDevBuild/$sysRootPath
|
||||
|
||||
# remove SysRoot path in pc file
|
||||
PC_LIST=`find $DebDevBuild -name "*.pc"`
|
||||
for pc in $PC_LIST; do
|
||||
sed -i "s|${ToolChainSysRoot}||g" $pc
|
||||
done
|
||||
|
||||
# remove all .la file
|
||||
find $DebDevBuild -name '*.la' | xargs rm -rf
|
||||
}
|
||||
|
||||
ReplaceSynoSysRoot() {
|
||||
local configFile=$@
|
||||
for file in $configFile; do
|
||||
if [ ! -f "$file" ]; then
|
||||
ERROR "" "Replace sysroot fail! $file not exist."
|
||||
return 1
|
||||
fi
|
||||
sed -i "s|@SYNO_SYSROOT@|${ToolChainSysRoot}|g" $file
|
||||
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
|
||||
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
|
||||
unset InstallDevScript
|
||||
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/*
|
||||
}
|
||||
|
||||
|
||||
RunBuildScript() # {{{
|
||||
{
|
||||
local proj="$1"
|
||||
local buildScript=
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
ERROR "Wrong number of parameters to $FUNCNAME."
|
||||
return 1
|
||||
fi
|
||||
cd $SourceDir
|
||||
CheckErrorOut $? "Failed to cd $SourceDir"
|
||||
|
||||
if [ ! -d "$proj" ]; then
|
||||
ERROR "Project $proj doesn't exist."
|
||||
INFO "" "Use script SynoUpdate $proj to check out it."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! buildScript=`findBuildScript $proj`; then
|
||||
ERROR "There is no build scripts for $proj"
|
||||
return 1
|
||||
fi
|
||||
|
||||
INFO "SCRIPT" "build script: ${buildScript}"
|
||||
if ! cd $proj; then
|
||||
ERROR "can not cd to $proj"
|
||||
return 1
|
||||
fi
|
||||
|
||||
INFO "======= Run build script ======="
|
||||
(. $buildScript)
|
||||
|
||||
CheckProjectStatus build $proj > /dev/null
|
||||
return
|
||||
} # }}}
|
||||
|
||||
BuildProject() {
|
||||
local ret=
|
||||
local proj=$1
|
||||
|
||||
if ! RunBuildScript $proj; then
|
||||
ERROR "Build project fail!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
405
include/check
Normal file
405
include/check
Normal file
@ -0,0 +1,405 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 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"
|
||||
|
||||
# Build system will select virtual build script first and then projName script in build.
|
||||
CheckScript() {
|
||||
local projName="$1"
|
||||
local type=$2
|
||||
local findScript=
|
||||
|
||||
if [ -f "$SourceDir/$projName/$ConfDir/$type" ]; then
|
||||
findScript="$SourceDir/$projName/$ConfDir/$type"
|
||||
elif [ -f "$ScriptsDir/$type/$projName" ]; then
|
||||
findScript="$ScriptsDir/$type/$projName"
|
||||
fi
|
||||
|
||||
echo $findScript
|
||||
return 0
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if [ -n "$script" ]; then
|
||||
echo $script
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
findBuildScript() {
|
||||
local projName=$1
|
||||
FindScript "$projName" "build"
|
||||
}
|
||||
|
||||
findInstallDevScript() {
|
||||
local projName=$1
|
||||
FindScript "$projName" "install-dev"
|
||||
}
|
||||
|
||||
findInstallScript() {
|
||||
local projName=$1
|
||||
FindScript "$projName" "install"
|
||||
}
|
||||
|
||||
findDependConf() {
|
||||
local projName="$1"
|
||||
local conf=$(FindScript "$projName" "depends")
|
||||
if [ -n "$conf" ]; then
|
||||
echo "$conf"
|
||||
else
|
||||
echo "$ScriptsDir/$GlobalDependConf"
|
||||
fi
|
||||
}
|
||||
|
||||
CheckPermission()
|
||||
{
|
||||
# Only root can run this
|
||||
id | grep "uid=0" >/dev/null
|
||||
if [ $? != "0" ]; then
|
||||
echo "ERROR: This script must be run as root";
|
||||
echo "";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# Stop!! If /root/.chroot does not exit
|
||||
if [ ! -f /root/.chroot ]; then
|
||||
echo "ERROR: Please chroot first!!"
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: target to find, else: list to search
|
||||
CheckInList() {
|
||||
[ $# -lt 1 ] && CheckErrorOut 1 "Wrong number of parameters to $FUNCNAME()."
|
||||
local target="$1" proj=
|
||||
shift
|
||||
for proj in $@; do
|
||||
[ $proj = $target ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
CheckErrorLog()
|
||||
{
|
||||
local errors
|
||||
local warns
|
||||
local logFile
|
||||
local warnCount
|
||||
local allProjCount=0
|
||||
local errProjCount=0
|
||||
local warnProjCount=0
|
||||
local ret=
|
||||
local logType=$1
|
||||
shift
|
||||
local projectList=$@
|
||||
local errorFile="${LogDir}/error.$logType"
|
||||
|
||||
if [ -r "$errorFile" ]; then
|
||||
mv -f $errorFile ${errorFile}.old
|
||||
fi
|
||||
|
||||
|
||||
for proj in $projectList; do
|
||||
logFile="${LogDir}/${proj}.$logType"
|
||||
result=$(CheckProjectStatus $logType $proj)
|
||||
ret=$?
|
||||
if [ $ret -eq 1 ]; then
|
||||
echo "Result file $logFile doesn't exist or isn't readable." 2>&1 | tee -a $errorFile
|
||||
echo "Cannot check any information about compiling error(s)."
|
||||
echo ""
|
||||
errors="Y"
|
||||
else
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "I got the following error:" >> $logFile
|
||||
echo -e "$result" >> $logFile
|
||||
echo "########################################################"
|
||||
echo " Error(s) occurred on project \"$proj\"" 2>&1 | tee -a $errorFile
|
||||
echo "########################################################"
|
||||
errors="Y"
|
||||
errProjCount=$(( $errProjCount + 1 ))
|
||||
fi
|
||||
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
|
||||
warns="Y"
|
||||
warnProjCount=$(( $warnProjCount + 1 ))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
allProjCount=$(( $allProjCount + 1 ))
|
||||
done
|
||||
echo -n "$allProjCount projects, $errProjCount failed"
|
||||
if [ "$1" = "build" ]; then
|
||||
echo ", $warnProjCount have warnings."
|
||||
else
|
||||
echo "."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [ "$errors" = "Y" ]; then
|
||||
ERROR "Check [${errorFile}] for fixing errors."
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# check error code, if error code != 0, print message and exit
|
||||
# Usages:
|
||||
# CheckErrorOut ErrorCode Message
|
||||
CheckErrorOut()
|
||||
{
|
||||
if [ $1 != 0 ]; then
|
||||
echo "$2" >&2;
|
||||
exit $1;
|
||||
fi
|
||||
}
|
||||
|
||||
INFO(){
|
||||
if [ $# -lt 2 ]; then
|
||||
echo -e "[INFO] $1"
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
echo -e [INFO] $2
|
||||
else
|
||||
echo -e [$1] $2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ERROR(){
|
||||
if [ $# -lt 2 ]; then
|
||||
echo -e "\n[Error] $1\n" >&2
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
echo -e [Error] $2 >&2
|
||||
else
|
||||
echo -e [$1] $2 >&2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ShowTimeCost()
|
||||
{
|
||||
TAG_INTERNAL=""
|
||||
#echo $*
|
||||
|
||||
if [ -n "$3" ]; then
|
||||
TAG_INTERNAL="[$3]"
|
||||
fi
|
||||
|
||||
D_INT0=$1
|
||||
D_INT1=$2
|
||||
|
||||
DIFF_INT=$((${D_INT1}-${D_INT0}))
|
||||
DIFF_SEC=$((${DIFF_INT}%60))
|
||||
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}
|
||||
}
|
||||
|
||||
CheckTimeCostLog()
|
||||
{
|
||||
local logType=$1
|
||||
shift
|
||||
local projectList=$@
|
||||
local logFile=
|
||||
local result=
|
||||
|
||||
echo -e "\n----------------- Time cost statistics -----------------"
|
||||
|
||||
for proj in $projectList;
|
||||
do
|
||||
logFile="${LogDir}/${proj}.$logType"
|
||||
if [ -r "$logFile" ]; then
|
||||
#echo "file: ${logFile}"
|
||||
result=`grep "Time cost:" $logFile`
|
||||
echo $result
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
}
|
||||
|
||||
# FIXME for test
|
||||
Debug()
|
||||
{
|
||||
return 0
|
||||
[ $# -ne 2 ] && return 0
|
||||
echo -e "\033[$1m$2\033[0m"
|
||||
}
|
||||
|
||||
_get_key_value()
|
||||
{
|
||||
local key="$1"
|
||||
local file="$2"
|
||||
local val=
|
||||
|
||||
if [ -z "$key" -o ! -f "$file" ]; then
|
||||
echo "Error: _get_key_value failed. key is empty or file not found."
|
||||
return 1
|
||||
fi
|
||||
|
||||
val="$(grep "^$key=" "$file" | cut -d'"' -f2)"
|
||||
echo "$val"
|
||||
}
|
||||
|
||||
GetDSMBuildNumber() {
|
||||
_get_key_value "buildnumber" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetDSMMajorNumber()
|
||||
{
|
||||
_get_key_value "majorversion" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
GetDSMMinorNumber()
|
||||
{
|
||||
_get_key_value "minorversion" "$VERSION_FILE"
|
||||
}
|
||||
|
||||
Is64BitProject() {
|
||||
local Proj=$1
|
||||
local ProjExt=
|
||||
|
||||
Is32BitProject $Proj && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
Is32BitProject() { #{{{
|
||||
local ProjExt=""
|
||||
local Proj="$1"
|
||||
|
||||
if ! Is64BitPlatform; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
} #}}}
|
||||
|
||||
getPlatformExcludeProjs() {
|
||||
local platformExcludeProj=
|
||||
|
||||
if [ "$DefaultBuild32Bit" = "yes" ]; then
|
||||
platformExcludeProj=".*-virtual-64$"
|
||||
else
|
||||
platformExcludeProj=".*-virtual-32$"
|
||||
fi
|
||||
|
||||
if ! Is64BitPlatform; then
|
||||
echo $platformExcludeProj
|
||||
return
|
||||
fi
|
||||
return
|
||||
}
|
||||
|
||||
ExcludeList() {
|
||||
local list="$1"
|
||||
local excludeList="$2"
|
||||
|
||||
if [ -z "${excludeList}" ]; then
|
||||
echo $list
|
||||
return 0
|
||||
fi
|
||||
|
||||
local excludeArgument="^(`echo $excludeList | sed 's/ /|/g'`)\$"
|
||||
echo $list | sed 's/ /\n/g' | grep -vE "${excludeArgument}"
|
||||
|
||||
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() {
|
||||
local version="$1"
|
||||
local phase=$2
|
||||
|
||||
[ -z "$phase" ] && phase=$(GetBuildPhase $version)
|
||||
|
||||
case $phase in
|
||||
"beta"|"release"|"hotfix")
|
||||
echo release
|
||||
;;
|
||||
"dev"|"alpha"|"rc")
|
||||
echo development
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
SetupDSMBuildNumber() {
|
||||
unset DSM_BUILD_NUM DSM_SHLIB_MAJOR DSM_SHLIB_MAJOR
|
||||
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
|
||||
fi
|
||||
|
||||
if [ -z "$DSM_BUILD_NUM" ]; then
|
||||
DSM_BUILD_NUM=`date "+%Y%m%d"`
|
||||
fi
|
||||
|
||||
[ -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
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
25
include/check.pkg
Executable file
25
include/check.pkg
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 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
|
||||
}
|
||||
|
||||
ResolvePkgVersion() {
|
||||
[ $# -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}'`"
|
||||
}
|
||||
|
||||
[ "$(caller)" != "0 NULL" ] && return 0
|
||||
`$@`
|
||||
|
||||
# vim:ft=sh
|
13
include/config
Executable file
13
include/config
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$__INCLUDE_CONFIG__" ]; then
|
||||
__INCLUDE_CONFIG__=defined
|
||||
|
||||
if [ -z "$IS_GIT_SERVER" ]; then
|
||||
Source "include/variable"
|
||||
fi
|
||||
|
||||
Source "include/projects"
|
||||
|
||||
fi # header guard
|
||||
# vim:ft=sh
|
27
include/envutils
Normal file
27
include/envutils
Normal file
@ -0,0 +1,27 @@
|
||||
# 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
|
47
include/errors
Normal file
47
include/errors
Normal file
@ -0,0 +1,47 @@
|
||||
#!/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
|
41
include/init
Normal file
41
include/init
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_INIT__" ]; then
|
||||
__INCLUDE_INIT__=defined
|
||||
|
||||
CurDir=$(pwd)
|
||||
ScriptsDir=$(dirname $(readlink -f "$0"))
|
||||
ScriptsDirName=$(basename "$ScriptsDir")
|
||||
ScriptsName=$(basename "$0")
|
||||
SynoBase=$(dirname "$ScriptsDir")
|
||||
SourceDir=$SynoBase/source
|
||||
|
||||
UsingPkgScripts() {
|
||||
if [ "$ScriptsDirName" = "lnxscripts" ]; then
|
||||
return 1
|
||||
elif [ "$ScriptsDirName" = "branchscripts" ]; then
|
||||
return 1
|
||||
elif [ "$ScriptsDirName" = "pkgscripts" -o "$ScriptsDirName" = "pkgscripts-ng" ]; then
|
||||
return 0
|
||||
else
|
||||
echo -e "Error! Using lnxscripts or pkgscripts?"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
Source() {
|
||||
local script=${ScriptsDir}/$1
|
||||
local suffix=$2
|
||||
|
||||
[ -f "$script" ] && . ${script}
|
||||
|
||||
if [ -z "$suffix" ]; then
|
||||
UsingPkgScripts && suffix=pkg || suffix=lnx
|
||||
fi
|
||||
|
||||
[ -f ${script}.$suffix ] && . ${script}.$suffix
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
254
include/install
Normal file
254
include/install
Normal file
@ -0,0 +1,254 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_INSTALL__" ]; then
|
||||
__INCLUDE_INSTALL__=defined
|
||||
|
||||
Source include/config
|
||||
Source include/check
|
||||
Source include/platforms
|
||||
Source include/applyEnv
|
||||
BUILD_TARGET=""
|
||||
|
||||
PlatformOpts=`AllPlatformOptionsComma`
|
||||
DefaultLongArgs="${PlatformOpts}platform:,with-debug,help"
|
||||
DefaultArgs="dhp:"
|
||||
IsDebugBuild="N"
|
||||
DebType="bin"
|
||||
|
||||
ParseDefaultInstallArgs(){
|
||||
UnHandledOpt=
|
||||
while [ -n $1 ]; do
|
||||
IsPlatformOption $1
|
||||
if [ $? -eq 0 ]; then
|
||||
AskPlatform $1
|
||||
else
|
||||
case "$1" in
|
||||
# platforms
|
||||
"-p" | "--platform")
|
||||
AskPlatform "--$2"
|
||||
shift
|
||||
;;
|
||||
"-d" | "--with-debug")
|
||||
export NOSTRIP="NOSTRIP"
|
||||
IsDebugBuild="Y"
|
||||
;;
|
||||
"--help" | "-h")
|
||||
Usage
|
||||
exit 0
|
||||
;;
|
||||
"--")
|
||||
# remaining are project names
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
[ -n "$UnHandledOpt" ] && UnHandledOpt="$UnHandledOpt $1" || UnHandledOpt="$1"
|
||||
shift
|
||||
if [ "$1" = '--' ]; then
|
||||
shift
|
||||
break
|
||||
elif [[ "$1" =~ "-" ]]; then
|
||||
continue
|
||||
else
|
||||
UnHandledOpt="$UnHandledOpt $1"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
InputProjs=$@
|
||||
|
||||
if [ -z "$BUILD_OPT" ]; then
|
||||
# call again without parameters
|
||||
# to prompt user interactively
|
||||
AskPlatform
|
||||
fi
|
||||
}
|
||||
|
||||
SetupInstallEnv(){
|
||||
local debugBuild=$1
|
||||
|
||||
SetupDSMBuildNumber
|
||||
LoadPlatformRelated || exit 1
|
||||
|
||||
if [ "Y" = "$debugBuild" ]; then
|
||||
TarBallDir=$DebugTarBallDir
|
||||
DebType="debug"
|
||||
fi
|
||||
|
||||
mkdir -p ${TarBallDir} $LogDir $TmpInstDir
|
||||
[ -d "$DebPkgDir" ] || mkdir -p $DebPkgDir
|
||||
}
|
||||
|
||||
UnifyInstallProjects() {
|
||||
local projectList=
|
||||
|
||||
for proj in $@; do
|
||||
projectList="${projectList} `basename ${proj}`"
|
||||
done
|
||||
|
||||
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 installScript=
|
||||
|
||||
cd $SourceDir/$baseProj
|
||||
CheckErrorOut $? "Failed to cd $SourceDir/$baseProj"
|
||||
if ! installScript=$(findInstallScript "${proj}"); then
|
||||
ERROR "There is no install scripts for $proj"
|
||||
return 1
|
||||
fi
|
||||
|
||||
INFO "Execute install script: $installScript"
|
||||
(. $installScript)
|
||||
|
||||
CheckProjectStatus install $proj > /dev/null
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
SetupProjInstallEnv() {
|
||||
local proj=$1
|
||||
|
||||
if Is64BitProject "${proj}"; then
|
||||
INFO "ENV" "Using 64bit environment."
|
||||
ApplyInstallEnv "64"
|
||||
else
|
||||
INFO "ENV" "Using 32bit environment."
|
||||
ApplyInstallEnv "32"
|
||||
fi
|
||||
|
||||
rm -rf $TmpInstDir/*
|
||||
}
|
||||
|
||||
CreateTarball() {
|
||||
local proj=$1
|
||||
local haveFile=`ls $TmpInstDir`
|
||||
|
||||
if [ ! -z "$haveFile" ]; then
|
||||
echo ""
|
||||
echo "Create ${proj}.txz ..."
|
||||
XZ_OPT=-3 tar cJpvf "$TarBallDir/${proj}.txz" *
|
||||
echo "[Done]"
|
||||
else
|
||||
INFO "WARNING" "$TmpInstDir is empty!"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
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`
|
||||
if [ -n "${MODE}" ]; then
|
||||
MODE_ARG="-m ${MODE}"
|
||||
fi
|
||||
echo "mkdir -p ${MODE_ARG} $TargetDir/${DIR}"
|
||||
mkdir -p ${MODE_ARG} $TargetDir/${DIR}
|
||||
done
|
||||
}
|
||||
|
||||
InstallPkgFiles() # $1: Target Dir $2: Path $3: Default mode $4: FileList
|
||||
{
|
||||
PrefixDir="$1/$2"
|
||||
DefMode="$3"
|
||||
[ -n "$4" ] && mkdir -p "${PrefixDir}"
|
||||
for file in $4
|
||||
do
|
||||
FileBase=$(echo "$file" | cut -f1 -d':')
|
||||
FileDS=$(echo "$file" | cut -f2 -d':' -s)
|
||||
if [ -z "$FileDS" ]; then
|
||||
FileInst="$PrefixDir/$FileDS/$(basename "$FileBase")"
|
||||
else
|
||||
FileInst="$PrefixDir/$FileDS"
|
||||
fi
|
||||
|
||||
if [ ! -f "$FileBase" ]; then
|
||||
echo "Error: $FileBase not found!"
|
||||
continue
|
||||
fi
|
||||
|
||||
install -vm "$DefMode" "$FileBase" "$FileInst" | grep -- "->"
|
||||
RetInstall=$?
|
||||
if [ $RetInstall -ne 0 ]; then
|
||||
echo "Error: [install -vm $DefMode $FileBase $FileInst], ret=$RetInstall"
|
||||
continue
|
||||
fi
|
||||
|
||||
file "${FileInst}" | grep ELF > /dev/null 2>&1
|
||||
if [ $? -eq 0 -a "x$NOSTRIP" != "xNOSTRIP" ]; then
|
||||
echo "Striping ${FileInst}"
|
||||
${STRIP} -s --remove-section=.note --remove-section=.comment "$FileInst"
|
||||
fi
|
||||
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
|
408
include/pkg_util.sh
Executable file
408
include/pkg_util.sh
Executable file
@ -0,0 +1,408 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
pkg_warn() {
|
||||
local ret=$?
|
||||
echo "Error: $@" >&2
|
||||
return $?
|
||||
}
|
||||
|
||||
pkg_log() {
|
||||
local ret=$?
|
||||
echo "$@" >&2
|
||||
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
|
||||
local arch=
|
||||
|
||||
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" ;;
|
||||
BROMOLOW) arch="bromolow" ;;
|
||||
CEDARVIEW) arch="cedarview" ;;
|
||||
AVOTON) arch="avoton" ;;
|
||||
BRASWELL) arch="braswell" ;;
|
||||
MARVELL_ARMADAXP) arch="armadaxp" ;;
|
||||
MARVELL_ARMADA370) arch="armada370" ;;
|
||||
MARVELL_ARMADA375) arch="armada375" ;;
|
||||
EVANSPORT) arch="evansport" ;;
|
||||
MINDSPEED_COMCERTO2K) arch="comcerto2k" ;;
|
||||
ALPINE) arch="alpine" ;;
|
||||
STM_MONACO) arch="monaco" ;;
|
||||
MARVELL_ARMADA38X) arch="armada38x" ;;
|
||||
*) arch="" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "$arch"
|
||||
}
|
||||
|
||||
plat_to_unified_plat() {
|
||||
local plat="$1"
|
||||
local unified_plat=
|
||||
|
||||
case "$plat" in
|
||||
x86 | bromolow | cedarview | avoton | braswell )
|
||||
unified_plat="x86 bromolow cedarview avoton braswell"
|
||||
;;
|
||||
# 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 )
|
||||
family="x86_64"
|
||||
;;
|
||||
evansport )
|
||||
family="i686"
|
||||
;;
|
||||
alpine | alpine4k )
|
||||
family="armv7"
|
||||
;;
|
||||
88f6281 )
|
||||
family="armv5"
|
||||
;;
|
||||
qoriq )
|
||||
family="ppc"
|
||||
;;
|
||||
# armv7 not ready platforms.
|
||||
comcerto2k | armada370 | armada375 | armadaxp | monaco | armada38x)
|
||||
family="$plat"
|
||||
;;
|
||||
*)
|
||||
echo "Failed to get platform family for $family" 1>&2
|
||||
echo "Please add the mapping information into pkgscripts/pkg_util.sh:pkg_get_platform_family" 1>&2
|
||||
return 1
|
||||
esac
|
||||
echo "$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
|
||||
|
||||
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_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
|
||||
done
|
||||
|
||||
echo "$text" | sed -e "s/${product_name_original}/${product_name}/g" | sed -e "s/${os_name_original}/${os_name}/g"
|
||||
}
|
||||
|
||||
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=
|
||||
|
||||
case "$plat" in
|
||||
88f6281)
|
||||
spk_unified_platform="88f628x"
|
||||
;;
|
||||
x86 | bromolow | cedarview | avoton | braswell )
|
||||
spk_unified_platform="x64"
|
||||
;;
|
||||
alpine | alpine4k )
|
||||
spk_unified_platform="alpine"
|
||||
;;
|
||||
*)
|
||||
spk_unified_platform="$plat"
|
||||
;;
|
||||
esac
|
||||
echo "$spk_unified_platform"
|
||||
}
|
||||
|
||||
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
|
||||
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 log_collector
|
||||
support_aaprofile auto_upgrade_from offline_install precheckstartstop"
|
||||
local f= lan= file= sec= key=
|
||||
|
||||
for f in $fields; do
|
||||
if [ -n "${!f}" ]; then
|
||||
echo $f=\"${!f}\"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "$UISTRING_PATH" -a "$description_sec" -a "$description_key" ]; then
|
||||
sec=$description_sec
|
||||
key=$description_key
|
||||
for lan in $UISTRING_PATH/*; do
|
||||
lan=$(basename "$lan")
|
||||
file="$UISTRING_PATH/$lan/strings"
|
||||
if [ -r "$file" ]; then
|
||||
echo description_$lan=\"$(pkg_get_string "$file" "$sec" "$key")\"
|
||||
if [ "x$lan" = "xenu" ]; then
|
||||
echo description=\"$(pkg_get_string "$file" "$sec" "$key")\"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
elif [ "x" != "x$description" ]; then
|
||||
echo "description=\"${description}\""
|
||||
fi
|
||||
|
||||
if [ -e "$UISTRING_PATH" -a "$displayname_sec" -a "$displayname_key" ]; then
|
||||
sec=$displayname_sec
|
||||
key=$displayname_key
|
||||
for lan in $UISTRING_PATH/*; do
|
||||
lan=$(basename "$lan")
|
||||
file="$UISTRING_PATH/$lan/strings"
|
||||
if [ -r "$file" ]; then
|
||||
echo displayname_$lan=\"$(pkg_get_string "$file" "$sec" "$key")\"
|
||||
if [ "x$lan" = "xenu" ]; then
|
||||
echo displayname=\"$(pkg_get_string "$file" "$sec" "$key")\"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
elif [ "x" != "x$displayname" ]; then
|
||||
echo "displayname=\"${displayname}\""
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_get_tar_option() {
|
||||
local version_file="/PkgVersion"
|
||||
|
||||
echo "cJf"
|
||||
}
|
||||
|
||||
pkg_make_package() { # <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)"
|
||||
|
||||
# check parameters
|
||||
if [ -z "$source_path" -o ! -d "$source_path" ]; then
|
||||
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_package: bad parameters, please set destination dir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# add extractsize to INFO
|
||||
pkg_size=`du -sk "$source_path" | awk '{print $1}'`
|
||||
echo "${pkg_size}" >> "$dest_path/$temp_extractsize"
|
||||
echo ls $source_path \| tar $tar_option "$dest_path/$package_name" -C "$source_path" -T /dev/stdin
|
||||
ls $source_path | tar $tar_option "$dest_path/$package_name" -C "$source_path" -T /dev/stdin
|
||||
}
|
||||
|
||||
__get_spk_name() { #<info path>
|
||||
local spk_name=
|
||||
local platform_func="$1"
|
||||
local info_path="${2:-$PKG_DIR/INFO}"
|
||||
local package_name="$3"
|
||||
|
||||
. $info_path
|
||||
|
||||
# construct package name
|
||||
if [ -z "$package" -o -z "$arch" -o -z "$version" ]; then
|
||||
pkg_warn "pkg_make_spk: package, arch, version can not be empty"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "x$arch" = "xnoarch" ]; then
|
||||
spk_arch="noarch"
|
||||
elif ! spk_arch=$($platform_func); then
|
||||
spk_arch="none"
|
||||
fi
|
||||
|
||||
if [ "x$arch" = "xnoarch" ]; then
|
||||
spk_arch=""
|
||||
else
|
||||
spk_arch="-"$spk_arch
|
||||
fi
|
||||
|
||||
if [ -z "$package_name" ]; then
|
||||
package_name="$package";
|
||||
fi
|
||||
|
||||
if [ "${NOSTRIP}" == NOSTRIP ]; then
|
||||
spk_name="$package_name$spk_arch-${version}_debug.spk"
|
||||
else
|
||||
spk_name="$package_name$spk_arch-$version.spk"
|
||||
fi
|
||||
echo $spk_name;
|
||||
}
|
||||
|
||||
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 $@
|
||||
}
|
||||
|
||||
pkg_make_spk() { # <source path> <dest path> <spk file name>
|
||||
local pack="tar cf"
|
||||
local source_path=$1
|
||||
local dest_path=$2
|
||||
local info_path="$source_path/INFO"
|
||||
local spk_name=$3
|
||||
local spk_arch=
|
||||
local temp_extractsize="extractsize_tmp"
|
||||
|
||||
# check parameters
|
||||
if [ -z "$source_path" -o ! -d "$source_path" ]; then
|
||||
pkg_warn "pkg_make_spk: bad parameters, please set source dir"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$dest_path" -o ! -d "$dest_path" ]; then
|
||||
pkg_warn "pkg_make_spk: bad parameters, please set destination dir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# check INFO exists and source INFO
|
||||
if [ ! -r "$info_path" ]; then
|
||||
pkg_warn "pkg_make_spk: INFO '$info_path' is not existed"
|
||||
return 1
|
||||
fi
|
||||
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
|
||||
rm "$source_path/$temp_extractsize"
|
||||
|
||||
echo toolkit_version=$DSM_BUILD_NUM >> $info_path
|
||||
echo "create_time=\"$(date +%Y%m%d-%T)\"" >> $info_path
|
||||
|
||||
# tar .spk file
|
||||
pkg_log "creating package: $spk_name"
|
||||
pkg_log "source: $source_path"
|
||||
pkg_log "destination: $dest_path/$spk_name"
|
||||
$pack "$dest_path/$spk_name" -C "$source_path" $(ls $source_path)
|
||||
}
|
||||
|
||||
[ "$(caller)" != "0 NULL" ] && return 0
|
||||
|
||||
usage() {
|
||||
cat >&2 <<EOF
|
||||
USAGE: $(basename $0) <action> [action options...]
|
||||
ACTION:
|
||||
make_spk <source path> <dest path> <spk name>
|
||||
make_package <source path> <dest path>
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && usage
|
||||
PkgBuildAction=$1 ; shift
|
||||
case "$PkgBuildAction" in
|
||||
make_spk) pkg_make_spk "$@" ;;
|
||||
make_package) pkg_make_package "$@" ;;
|
||||
*) usage ;;
|
||||
esac
|
42
include/platform.6281
Normal file
42
include/platform.6281
Normal file
@ -0,0 +1,42 @@
|
||||
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/usr/include"
|
||||
ToolChainLib32="${ToolChainDir32}/libc/lib"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/libc"
|
||||
ARCH="arm"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_ARMV5"
|
||||
|
||||
ConfigOpt32="--host=armle-unknown-linux --target=armle-unknown-linux --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
HOST32=armle-unknown-linux
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_MARVELL_88F6281 -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/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_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
|
||||
|
||||
KernelToolchain="gcc464_glibc215_88f6281"
|
||||
ToolchainTGZList="$KernelToolchain uclibc09332_88f6281"
|
||||
SynoKernelConfig="88f6281"
|
||||
SynoGNUSources="628x"
|
31
include/platform.alpine
Normal file
31
include/platform.alpine
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=arm-unknown-linux-gnueabi --target=arm-unknown-linux-gnueabi --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc472_glibc215_alpine"
|
||||
UBootToolchain="gcc472_glibc215_alpine"
|
||||
SynoKernelConfig="alpine"
|
||||
SynoGNUSources="alpine"
|
31
include/platform.alpine4k
Normal file
31
include/platform.alpine4k
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=arm-unknown-linux-gnueabi --target=arm-unknown-linux-gnueabi --build=i686-pc-linux"
|
||||
|
||||
# For sdk usbcam
|
||||
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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc472_glibc215_alpine"
|
||||
UBootToolchain="gcc472_glibc215_alpine"
|
||||
SynoKernelConfig="alpine4k"
|
||||
SynoGNUSources="alpine4k"
|
30
include/platform.armada370
Normal file
30
include/platform.armada370
Normal file
@ -0,0 +1,30 @@
|
||||
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"
|
||||
|
||||
# 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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc445_glibc211_softfp_armada370"
|
||||
UBootToolchain="gcc445_glibc211_softfp_armada370"
|
||||
SynoKernelConfig="armada370"
|
||||
SynoGNUSources="armada370"
|
31
include/platform.armada375
Normal file
31
include/platform.armada375
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"
|
||||
|
||||
# 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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc464_glibc215_softfp_armada375"
|
||||
UBootToolchain="gcc464_glibc215_softfp_armada375"
|
||||
SynoKernelConfig="armada375"
|
||||
SynoGNUSources="armada375"
|
29
include/platform.armada38x
Normal file
29
include/platform.armada38x
Normal file
@ -0,0 +1,29 @@
|
||||
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
|
||||
|
||||
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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
SynoKernelConfig="armada38x"
|
||||
SynoGNUSources="armada38x"
|
||||
|
||||
BRINGUP_VERSION=5.2
|
30
include/platform.armadaxp
Normal file
30
include/platform.armadaxp
Normal file
@ -0,0 +1,30 @@
|
||||
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"
|
||||
|
||||
# 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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc445_glibc211_softfp_armada370"
|
||||
UBootToolchain="gcc445_glibc211_softfp_armada370"
|
||||
SynoKernelConfig="armadaxp"
|
||||
SynoGNUSources="armadaxp"
|
75
include/platform.avoton
Executable file
75
include/platform.avoton
Executable 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
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_AVOTON -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_AVOTON -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 -DSYNO_AVOTON"
|
||||
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="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
SynoKernelConfig="avoton"
|
||||
SynoGNUSources="x86 x64"
|
101
include/platform.braswell
Normal file
101
include/platform.braswell
Normal file
@ -0,0 +1,101 @@
|
||||
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_BRASWELL -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/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"
|
||||
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_BRASWELL -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
|
||||
|
||||
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
|
||||
|
||||
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_BRASWELL"
|
||||
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="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64 uclibc09332_i686 uclibc09332_x86_64"
|
||||
SynoKernelConfig="braswell"
|
||||
SynoGNUSources="x86 x64"
|
74
include/platform.bromolow
Executable file
74
include/platform.bromolow
Executable 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 -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 -DSYNO_BROMOLOW -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 -DSYNO_BROMOLOW"
|
||||
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="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
SynoKernelConfig="bromolow"
|
||||
SynoGNUSources="x86 x64"
|
75
include/platform.cedarview
Executable file
75
include/platform.cedarview
Executable 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
|
||||
|
||||
CFLAGS32="-D$PLATFORM_FAMILY -DSYNO_CEDARVIEW -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_CEDARVIEW -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 -DSYNO_CEDARVIEW"
|
||||
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="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
SynoKernelConfig="cedarview"
|
||||
SynoGNUSources="x86 x64"
|
32
include/platform.comcerto2k
Normal file
32
include/platform.comcerto2k
Normal file
@ -0,0 +1,32 @@
|
||||
ToolChainDir32="/usr/local/arm-unknown-linux-gnueabi"
|
||||
ToolChainPrefix32="/usr/local/arm-unknown-linux-gnueabi/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"
|
||||
|
||||
# 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"
|
||||
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_hard"
|
||||
ToolchainTGZList="$KernelToolchain gcc464_glibc217_soft_comcerto gcc454_glibc214_soft_comcerto uclibc09332_comcerto2k"
|
||||
UBootToolchain="gcc454_glibc214_soft_comcerto"
|
||||
SynoKernelConfig="comcerto2k"
|
||||
SynoGNUSources="comcerto2k"
|
29
include/platform.evansport
Executable file
29
include/platform.evansport
Executable file
@ -0,0 +1,29 @@
|
||||
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"
|
||||
PLATFORM_FAMILY="SYNOPLAT_F_I686"
|
||||
|
||||
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_EVANSPORT -DSYNO_X86 -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
|
||||
|
||||
KernelToolchain="gcc493_glibc220_linaro_i686"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
SynoKernelConfig="evansport"
|
||||
SynoGNUSources="x86"
|
32
include/platform.monaco
Normal file
32
include/platform.monaco
Normal file
@ -0,0 +1,32 @@
|
||||
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"
|
||||
|
||||
# For sdk usbcam
|
||||
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"
|
||||
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
|
||||
|
||||
KernelToolchain="gcc493_glibc220_hard"
|
||||
ToolchainTGZList="$KernelToolchain"
|
||||
UBootToolchain="gcc483_glibc219_hard"
|
||||
SynoKernelConfig="monaco"
|
||||
SynoGNUSources="monaco"
|
41
include/platform.qoriq
Normal file
41
include/platform.qoriq
Normal file
@ -0,0 +1,41 @@
|
||||
ToolChainDir32="/usr/local/powerpc-e500v2-linux-gnuspe"
|
||||
ToolChainPrefix32="/usr/local/powerpc-e500v2-linux-gnuspe/bin/powerpc-e500v2-linux-gnuspe-"
|
||||
ToolChainBin32="${ToolChainDir32}/bin"
|
||||
ToolChainSysRoot32="${ToolChainDir32}/powerpc-e500v2-linux-gnuspe/sysroot"
|
||||
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_QORIQ -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_QORIQ"
|
||||
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="gcc493_glibc220_hard_qoriq"
|
||||
ToolchainTGZList="$KernelToolchain uclibc0929_qoriq freescale-2010.09 uclibc09321_qoriq gcc452_glibc213_qoriq"
|
||||
SynoKernelConfig="ppcQorIQ"
|
||||
SynoGNUSources="qoriq"
|
53
include/platform.x64
Executable file
53
include/platform.x64
Executable file
@ -0,0 +1,53 @@
|
||||
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_X64 -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_X64 -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="gcc493_glibc220_linaro_x86_64"
|
||||
ToolchainTGZList="$KernelToolchain gcc493_glibc220_linaro_i686on64"
|
||||
SynoKernelConfig="x86_64"
|
||||
SynoGNUSources="x86 x64"
|
184
include/platforms
Normal file
184
include/platforms
Normal file
@ -0,0 +1,184 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_PLATFORMS__" ]; then
|
||||
__INCLUDE_PLATFORMS__=defined
|
||||
|
||||
Source "include/variable"
|
||||
|
||||
AllPlatformOptionNames="6281 alpine alpine4k armada370 armada375 armada38x armadaxp avoton braswell bromolow cedarview comcerto2k evansport monaco qoriq x64"
|
||||
|
||||
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
|
||||
evansport EVANSPORT linux-3.x Intel Evansport
|
||||
comcerto2k MINDSPEED_COMCERTO2K linux-3.x MindSpeed comcerto 2000
|
||||
avoton AVOTON linux-3.10.x Intel Avoton
|
||||
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
|
||||
"
|
||||
|
||||
#
|
||||
# Return name list of all supported platforms
|
||||
#
|
||||
AllPlatformOptions () {
|
||||
echo "$AllPlatformOptionNames"
|
||||
}
|
||||
|
||||
Is64BitPlatform() {
|
||||
local all64BitPlatforms="X64 BROMOLOW CEDARVIEW AVOTON BRASWELL"
|
||||
CheckInList $BUILD_TARGET $all64BitPlatforms && return 0 || return 1
|
||||
}
|
||||
|
||||
|
||||
# check build platform and set the corresponding variables:
|
||||
# PLATFORM_ABBR, BUILD_TARGET, BUILD_OPT
|
||||
#
|
||||
# Usage
|
||||
# AskPlatfrom $@
|
||||
AskPlatform()
|
||||
{
|
||||
# PLATFORM_ABBR BUILD_TARGET kernel_version Comment
|
||||
local INDEX="" i=1 abbr target kernel comment others
|
||||
declare -a AbbrArray TargetArray
|
||||
# init array & hash table
|
||||
line=`echo "$AllPlatforms"| wc -l`
|
||||
for (( i=1; i <= line; i++ )); do
|
||||
abbr=`echo "$AllPlatforms" | awk '(NR=='$i'){print $1}'`
|
||||
target=`echo "$AllPlatforms" | awk '(NR=='$i'){print $2}'`
|
||||
declare AbbrHash_$abbr=$i
|
||||
declare TargetHash_$target=$i
|
||||
AbbrArray[$i]=$abbr
|
||||
TargetArray[$i]=$target
|
||||
done
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
for ThisArg in $@; do
|
||||
# Remember platform choice
|
||||
INDEX=AbbrHash_${ThisArg#--*}
|
||||
if [ -n "${!INDEX}" ]; then
|
||||
PLATFORM_ABBR=${ThisArg#--*}
|
||||
BUILD_TARGET=${TargetArray[${!INDEX}]}
|
||||
BUILD_OPT="--${PLATFORM_ABBR}"
|
||||
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 [ -n "${!INDEX}" ]; then
|
||||
PLATFORM_ABBR="${AbbrArray[${!INDEX}]}"
|
||||
BUILD_TARGET=$SYNO_PLATFORM
|
||||
BUILD_OPT="--${PLATFORM_ABBR}"
|
||||
else
|
||||
echo "Failed to detect platform ($SYNO_PLATFORM) in env32.mak"
|
||||
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
|
||||
# way to distinguish them
|
||||
if [ "${BUILD_TARGET}" = "ALPINE" ]; then
|
||||
local platform="alpine"
|
||||
cat /root/.bashrc | grep "PS1" | grep "alpine4k" > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
platform="alpine4k"
|
||||
fi
|
||||
PLATFORM_ABBR="${platform}"
|
||||
BUILD_OPT="--${platform}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ask platform interactively if not specified in argument
|
||||
if [ -z "$BUILD_TARGET" ]; then
|
||||
echo "Please choose target platform:"
|
||||
i=0
|
||||
echo "$AllPlatforms" | while read abbr target kernel comment; do
|
||||
printf "\t%4s %-30s%-20s%-20s\n" \
|
||||
"[$((i+=1))]" "$comment" "($kernel)" "{--$abbr}"
|
||||
done
|
||||
echo -en "Enter a number: "
|
||||
read Reply;
|
||||
if [ -z "${AbbrArray[$Reply]}" ]; then
|
||||
echo "Unknow platform. EXIT!!"
|
||||
exit 1
|
||||
fi
|
||||
PLATFORM_ABBR="${AbbrArray[${Reply}]}"
|
||||
BUILD_TARGET=${TargetArray[$Reply]}
|
||||
BUILD_OPT="--${PLATFORM_ABBR}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Return name list of all supported platforms, comma separated
|
||||
#
|
||||
AllPlatformOptionsComma ()
|
||||
{
|
||||
local RetString
|
||||
for PLATFORM in $AllPlatformOptionNames; do
|
||||
RetString="${RetString}${PLATFORM},"
|
||||
done
|
||||
echo $RetString
|
||||
}
|
||||
|
||||
#
|
||||
# Check if $1 is a supported platform name.
|
||||
# Support both forms of "platform" and "--platform".
|
||||
#
|
||||
# Returns 0 if true, else 1
|
||||
#
|
||||
IsPlatformOption ()
|
||||
{
|
||||
if [ $# -gt 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
for PLATFORM in $AllPlatformOptionNames; do
|
||||
if [ "$1" = "$PLATFORM" ]; then
|
||||
return 0
|
||||
fi
|
||||
# Handle arg with "--" too
|
||||
if [ "$1" = "--$PLATFORM" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
# not matching any of known platforms
|
||||
return 1
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Read platform config file {{{
|
||||
#
|
||||
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}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
PrepareKernelEnv()
|
||||
{
|
||||
cp -vf "$SynobiosDir/include/synobios.h" include/linux/synobios.h
|
||||
}
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
33
include/project.depends
Normal file
33
include/project.depends
Normal file
@ -0,0 +1,33 @@
|
||||
# first part, for project dependency
|
||||
[dynamic variable list]
|
||||
list="${Kernel} ${Desktop}"
|
||||
|
||||
[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"
|
||||
evansport="linux-3.x"
|
||||
avoton="linux-3.10.x"
|
||||
braswell="linux-3.10.x"
|
||||
6281="linux-2.6.32"
|
||||
qoriq="linux-2.6.32"
|
||||
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"
|
57
include/projects
Normal file
57
include/projects
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_PROJECTS__" ]; then
|
||||
__INCLUDE_PROJECTS__=defined
|
||||
|
||||
PreBuildProjects=""
|
||||
|
||||
# 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
|
539
include/pythonutils.py
Executable file
539
include/pythonutils.py
Executable file
@ -0,0 +1,539 @@
|
||||
#!/usr/bin/python2
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
|
||||
import sys, os, string, re
|
||||
from collections import defaultdict
|
||||
from subprocess import check_call, CalledProcessError, Popen, PIPE
|
||||
from time import time, ctime
|
||||
|
||||
|
||||
# Error codes
|
||||
ERROR_NONE = 0
|
||||
ERROR_DEBUG = 1
|
||||
ERROR_LOG = 2
|
||||
ERROR_ARG = 3
|
||||
ERROR_IO = 4
|
||||
ERROR_DEP = 5
|
||||
ERROR_OTHER = 6
|
||||
|
||||
VAR_KERNEL_PROJ = '${Kernel}' # Variable name for kernel project
|
||||
ENABLE_DEBUG = False # Debug flag
|
||||
VIRTUAL_PROJ_SEP = '-virtual-'
|
||||
|
||||
# Section names in dependency config files
|
||||
SECTION_VAR = 'variables'
|
||||
SECTION_DEP = 'project dependency'
|
||||
SECTION_DEP64 = '64bit project dependency'
|
||||
SECTION_KERNEL = VAR_KERNEL_PROJ
|
||||
SECTION_KERNEL_OLD = 'platform kernel'
|
||||
BASE_SECTIONS = [SECTION_VAR, SECTION_DEP, SECTION_KERNEL]
|
||||
SECTION_BUILD = 'BuildDependent'
|
||||
SECTION_REF = 'ReferenceOnly'
|
||||
SECTION_PACK = 'PackagePacking'
|
||||
SECTION_BUG = SECTION_BUILD+'-Bug'
|
||||
SECTION_DEFAULT = 'default'
|
||||
CONF_SECTIONS = [SECTION_BUILD, SECTION_BUILD+'-Tag', SECTION_REF, SECTION_REF+'-Tag', SECTION_PACK, SECTION_PACK+'-Tag', SECTION_BUG]
|
||||
|
||||
# Keys in INFO to be considered
|
||||
INFO_KEYS = ['package', 'version', 'arch']
|
||||
|
||||
# Basic projects to be checkout
|
||||
BasicProjects = set(['uistring', 'synopkgutils'])
|
||||
|
||||
|
||||
def reportMessage(code, message):
|
||||
if code == ERROR_NONE:
|
||||
print >> sys.stderr, 'Warning: '+message+'!\n'
|
||||
elif code == ERROR_DEBUG:
|
||||
if ENABLE_DEBUG: print >> sys.stdout, '\033[34mDebug: '+message+'\033[0m'
|
||||
elif code == ERROR_LOG:
|
||||
print >> sys.stdout, 'Log: '+message
|
||||
else:
|
||||
print >> sys.stderr, '\033[31mError: '+message+'!\033[0m\n'
|
||||
if code > ERROR_LOG: sys.exit(code)
|
||||
|
||||
|
||||
def getNextLine(file_handle):
|
||||
while (True):
|
||||
line = file_handle.readline()
|
||||
if line == '': break # EOF
|
||||
line = line.strip()
|
||||
if line != '' and line[0] != '#': break # Get non-empty, non-comment line
|
||||
return re.sub(r'\s*#.*', '', line) # Remove comment and return
|
||||
|
||||
def parseSectionName(line):
|
||||
name = ''
|
||||
if re.match(r'\[.*\]', line): name = line[1:len(line)-1]
|
||||
return name
|
||||
|
||||
def parseKeyValue(line):
|
||||
key = ''
|
||||
values = []
|
||||
if re.match(r'.*\s*=\s*\"', line):
|
||||
key = line.split('=')[0].strip()
|
||||
values = line.split('"')[1].strip().split(' ')
|
||||
return key, values
|
||||
|
||||
def parseSectionNames(filename, arch): # For platform-specific dependency
|
||||
sections = []
|
||||
for name in CONF_SECTIONS:
|
||||
pipe = Popen('grep "^\['+name+':.*'+arch+'.*\]" '+filename, stdout=PIPE, stderr=PIPE, shell=True)
|
||||
line = pipe.communicate()[0].strip()
|
||||
if pipe.returncode != 0:
|
||||
sections.append(name)
|
||||
continue
|
||||
line = line.split(']')[0]
|
||||
if arch in line[string.index(line, ':')+1:].split(','):
|
||||
sections.append(line[1:])
|
||||
else:
|
||||
sections.append(name)
|
||||
return sections
|
||||
|
||||
|
||||
def resolveKeyNames(section):
|
||||
# format: [project_type-tag_type(64)?:platform]
|
||||
project_mapping = {
|
||||
SECTION_BUILD: 'build',
|
||||
SECTION_REF: 'ref',
|
||||
SECTION_PACK: 'pack',
|
||||
}
|
||||
tag_mapping = {
|
||||
'Tag': 'base',
|
||||
'Bug': 'bug',
|
||||
'': 'curr',
|
||||
}
|
||||
|
||||
# project_t tag_type 64 platform
|
||||
matches = re.match(r'([^-:]+)-?([^-:0-9]*)(64)?:?([^-:]*)', section)
|
||||
project_type, tag_type, is64, platform = matches.groups()
|
||||
|
||||
if project_type in project_mapping:
|
||||
project_type = project_mapping[project_type]
|
||||
else:
|
||||
return '', None, None
|
||||
|
||||
if is64:
|
||||
project_type = project_type + "64"
|
||||
|
||||
tag_type = tag_mapping[tag_type]
|
||||
|
||||
if not platform:
|
||||
platform = "all"
|
||||
|
||||
return project_type, tag_type, platform
|
||||
|
||||
|
||||
def readConfigFile(filePath):
|
||||
retDict = {}
|
||||
if not os.path.isfile(filePath):
|
||||
raise RuntimeError(filePath + " is not a file")
|
||||
|
||||
with open(filePath, 'r') as conf:
|
||||
currSection = ''
|
||||
while (True):
|
||||
line = getNextLine(conf)
|
||||
if line == '':
|
||||
break # EOF
|
||||
|
||||
section_name = parseSectionName(line)
|
||||
if section_name:
|
||||
currSection = section_name
|
||||
retDict[currSection] = []
|
||||
continue
|
||||
|
||||
if currSection:
|
||||
retDict[currSection].append(line)
|
||||
return retDict
|
||||
|
||||
|
||||
def readKeyValueConfig(filename):
|
||||
configDict = readConfigFile(filename)
|
||||
retDict = {}
|
||||
for sec in configDict:
|
||||
retDict[sec] = {}
|
||||
for line in configDict[sec]:
|
||||
key, values = parseKeyValue(line)
|
||||
if not key or not values:
|
||||
continue
|
||||
retDict[sec][key] = values
|
||||
|
||||
return retDict
|
||||
|
||||
|
||||
def getKernelDict(allDict):
|
||||
if SECTION_KERNEL in allDict:
|
||||
return allDict[SECTION_KERNEL]
|
||||
|
||||
return allDict[SECTION_KERNEL_OLD]
|
||||
|
||||
|
||||
def readDependsBase(filename):
|
||||
configDict = readKeyValueConfig(filename)
|
||||
|
||||
kernelDict = getKernelDict(configDict)
|
||||
|
||||
for key in kernelDict:
|
||||
kernelDict[key] = kernelDict[key][0]
|
||||
|
||||
for key in configDict[SECTION_VAR]:
|
||||
configDict[SECTION_VAR][key] = ' '.join(configDict[SECTION_VAR][key])
|
||||
|
||||
return configDict[SECTION_VAR], configDict[SECTION_DEP], kernelDict
|
||||
|
||||
|
||||
def readDependsConf(filename, platforms):
|
||||
def appendPlatInfo(p, confWithPlat, output):
|
||||
for proj_t in confWithPlat:
|
||||
for tag_t in confWithPlat[proj_t]:
|
||||
if p not in confWithPlat[proj_t][tag_t]:
|
||||
p = 'all'
|
||||
|
||||
if tag_t == 'bug':
|
||||
output[proj_t][tag_t].update(confWithPlat[proj_t][tag_t][p])
|
||||
else:
|
||||
output[proj_t][tag_t] = list(set(output[proj_t][tag_t] + confWithPlat[proj_t][tag_t][p]))
|
||||
|
||||
dict_conf = {'build': {'curr': [], 'base': [], 'bug': {}},
|
||||
'ref': {'curr': [], 'base': []},
|
||||
'pack': {'curr': [], 'base': []},
|
||||
'build64': {'curr': [], 'base': [], 'bug': {}},
|
||||
'ref64': {'curr': [], 'base': []},
|
||||
'pack64': {'curr': [], 'base': []}}
|
||||
|
||||
configDict = readConfigFile(filename)
|
||||
defaultdicts = lambda:defaultdict(defaultdicts)
|
||||
confWithPlat = defaultdicts()
|
||||
|
||||
for sec in configDict:
|
||||
project_type, tag_type, platform = resolveKeyNames(sec)
|
||||
if not project_type:
|
||||
continue
|
||||
|
||||
if configDict[sec]:
|
||||
for line in configDict[sec]:
|
||||
if tag_type == 'bug':
|
||||
key, values = parseKeyValue(line)
|
||||
if key == '':
|
||||
reportMessage(ERROR_IO, "Line '"+line+"' is not a legal key-value pair")
|
||||
else:
|
||||
confWithPlat[project_type][tag_type][platform][key] = values
|
||||
else:
|
||||
# XXX: should be a list
|
||||
confWithPlat[project_type][tag_type][platform] = []
|
||||
confWithPlat[project_type][tag_type][platform] += configDict[sec]
|
||||
if platforms:
|
||||
for p in platforms:
|
||||
appendPlatInfo(p, confWithPlat, dict_conf)
|
||||
else:
|
||||
appendPlatInfo('all', confWithPlat, dict_conf)
|
||||
|
||||
return dict_conf
|
||||
|
||||
|
||||
def getBaseEnvironment(base_dir, proj, env, ver = ''):
|
||||
filename = findDependsFile(base_dir, proj)
|
||||
dict_env = {}
|
||||
|
||||
if ver:
|
||||
dict_env['all'] = ver
|
||||
return dict_env
|
||||
|
||||
if not env:
|
||||
env = SECTION_DEFAULT
|
||||
|
||||
try:
|
||||
conf = open(filename, 'r')
|
||||
except IOError:
|
||||
reportMessage(ERROR_LOG, 'Fail to open '+filename+'. Assume not a normal project.')
|
||||
dict_env['all'] = 'unknown'
|
||||
else:
|
||||
while (True):
|
||||
line = getNextLine(conf)
|
||||
if line == '': break # EOF
|
||||
section_name = parseSectionName(line)
|
||||
if section_name != '':
|
||||
if section_name == env:
|
||||
section = env
|
||||
else:
|
||||
section = ''
|
||||
continue
|
||||
if section == '':
|
||||
continue
|
||||
key, value = parseKeyValue(line)
|
||||
if key == '':
|
||||
reportMessage(ERROR_IO, "Line '"+line+"' is not a legal key-value pair")
|
||||
elif len(value) == 0:
|
||||
continue # Skip line without base environment specified
|
||||
dict_env[key] = value[0]
|
||||
conf.close()
|
||||
#if not dict_env.has_key('all'):
|
||||
# reportMessage(ERROR_OTHER, 'Please specify all="..." in '+filename)
|
||||
reportMessage(ERROR_LOG, 'Use environment settings in ['+ env +']')
|
||||
return dict_env
|
||||
|
||||
|
||||
def getBuiltinProjects(script_dir):
|
||||
cmd = '. '+script_dir+'/include/projects; echo $BuiltinProjects'
|
||||
reportMessage(ERROR_LOG, cmd)
|
||||
pipe = Popen(cmd, stdout=PIPE, shell=True)
|
||||
return set(pipe.stdout.read().strip().split(' '))
|
||||
|
||||
|
||||
def readPackageSetting(filename, package_id):
|
||||
package_setting = {}
|
||||
global_setting = {}
|
||||
|
||||
if os.path.exists(filename):
|
||||
global_setting = readKeyValueConfig(filename)
|
||||
|
||||
if package_id in global_setting:
|
||||
package_setting = global_setting[package_id]
|
||||
|
||||
return package_setting
|
||||
|
||||
def readPackageInfo(filename):
|
||||
dict_info = {}
|
||||
try:
|
||||
info = open(filename, 'r')
|
||||
except IOError:
|
||||
reportMessage(ERROR_IO, 'Fail to open '+filename)
|
||||
else:
|
||||
while (True):
|
||||
line = getNextLine(info)
|
||||
if line == '': break # EOF
|
||||
key, value = parseKeyValue(line)
|
||||
if key in INFO_KEYS: dict_info[key] = string.join(value, ' ')
|
||||
info.close()
|
||||
return dict_info
|
||||
|
||||
|
||||
class TraverseHook:
|
||||
def __init__(self, arch, branch, base, do_base):
|
||||
self.arch = arch
|
||||
self.branch = branch
|
||||
self.base = base
|
||||
self.do_base = do_base
|
||||
pass
|
||||
def perform(self, config, info):
|
||||
pass
|
||||
|
||||
|
||||
def resolveBaseTarget(arch, dict_env):
|
||||
base = ''
|
||||
if dict_env.has_key(arch): base = dict_env[arch]
|
||||
elif dict_env.has_key('all'): base = dict_env['all']
|
||||
else: reportMessage(ERROR_DEP, 'Base environment not specified for '+arch)
|
||||
return base
|
||||
|
||||
|
||||
def replaceSingleVariable(group, target, replacement):
|
||||
try:
|
||||
group.remove(target)
|
||||
if replacement != '': group.add(replacement)
|
||||
except KeyError: pass
|
||||
|
||||
|
||||
def replaceVariables(group, arch, dict_var, dict_kernel, do_base):
|
||||
if VAR_KERNEL_PROJ in group['curr'] | group['base']:
|
||||
try:
|
||||
kernel = string.join(set(dict_kernel.values()), ' ') if arch == '' else dict_kernel[arch]
|
||||
except KeyError:
|
||||
kernel = ''
|
||||
reportMessage(ERROR_LOG, 'Kernel projects not specified! Skip it.')
|
||||
replaceSingleVariable(group['curr'], VAR_KERNEL_PROJ, kernel)
|
||||
if do_base: replaceSingleVariable(group['base'], VAR_KERNEL_PROJ, kernel)
|
||||
for key in dict_var.keys():
|
||||
replaceSingleVariable(group['curr'], key, dict_var[key])
|
||||
if do_base: replaceSingleVariable(group['base'], key, dict_var[key])
|
||||
|
||||
def traverseSource(projects, base_dir, arch, dict_info, hook, do_base):
|
||||
dict_dep = dict_info['dep']
|
||||
|
||||
seen = {'curr': projects.copy()|BasicProjects, 'base': set()}
|
||||
build_dep = {'curr': set(), 'base': set()}
|
||||
ref_only = {'curr': set(), 'base': set()}
|
||||
for_pack = {'curr': set(), 'base': set()}
|
||||
base = resolveBaseTarget(arch, dict_info['env'])
|
||||
|
||||
builtin = getBuiltinProjects(base_dir+'/pkgscripts-ng')
|
||||
todo = projects.copy()
|
||||
while len(todo) != 0:
|
||||
build_dep['curr'].clear()
|
||||
if do_base: build_dep['base'].clear()
|
||||
for proj in todo:
|
||||
filename = findDependsFile(base_dir, proj)
|
||||
if not re.match(r'^\$', proj) and os.path.isfile(filename):
|
||||
dict_conf = readDependsConf(filename, [arch])
|
||||
# FIXME merge dict_dep and dict_conf with logs?
|
||||
for p in dict_conf['build']['bug']:
|
||||
dict_dep[p] = dict_conf['build']['bug'][p];
|
||||
if len(dict_dep[p]) == 0 or dict_dep[p][0] == '': del dict_dep[p]
|
||||
build_dep['curr'].update(dict_conf['build']['curr'])
|
||||
build_dep['curr'].update(dict_conf['pack']['curr'])
|
||||
ref_only['curr'].update(dict_conf['ref']['curr'])
|
||||
for_pack['curr'].update(dict_conf['pack']['curr'])
|
||||
if do_base:
|
||||
build_dep['base'].update(dict_conf['build']['base'])
|
||||
build_dep['base'].update(dict_conf['pack']['base'])
|
||||
ref_only['base'].update(dict_conf['ref']['base'])
|
||||
for_pack['curr'].update(dict_conf['pack']['base'])
|
||||
elif do_base and dict_dep.has_key(proj):
|
||||
build_dep['base'].update(dict_dep[proj])
|
||||
build_dep['curr'] -= seen['curr']
|
||||
seen['curr'] |= build_dep['curr']
|
||||
if do_base:
|
||||
build_dep['base'] -= seen['base']
|
||||
seen['base'] |= build_dep['base']
|
||||
# FIXME better error report?
|
||||
conflict = seen['curr'] & seen['base']
|
||||
if len(conflict) != 0:
|
||||
# Ignore conflict but built-in projects
|
||||
level = ERROR_LOG if len(conflict-builtin) == 0 else ERROR_DEP
|
||||
reportMessage(level, 'Conflict at {'+string.join(conflict, ',')+'}')
|
||||
|
||||
if hook != None:
|
||||
config = {'proj':
|
||||
{'curr': build_dep['curr'],
|
||||
'base': build_dep['base']},
|
||||
'base': base, 'do_base': do_base, 'branch': ''}
|
||||
hook.perform(config, dict_info)
|
||||
|
||||
todo.clear()
|
||||
todo.update(build_dep['curr'])
|
||||
if do_base: todo.update(build_dep['base'])
|
||||
|
||||
if hook != None:
|
||||
config = {'proj':
|
||||
{'curr': ref_only['curr'] - seen['curr'],
|
||||
'base': ref_only['base'] - seen['base']},
|
||||
'base': base, 'do_base': do_base, 'branch': ''}
|
||||
try:
|
||||
if VAR_KERNEL_PROJ in seen['curr']:
|
||||
config['proj']['curr'].add(dict_info['kernel'][arch])
|
||||
elif VAR_KERNEL_PROJ in seen['base']:
|
||||
config['proj']['base'].add(dict_info['kernel'][arch])
|
||||
except KeyError:
|
||||
reportMessage(ERROR_LOG, 'Kernel projects not specified! Skip it.')
|
||||
hook.perform(config, dict_info)
|
||||
|
||||
# Replace variables
|
||||
for group in [seen, ref_only, for_pack]:
|
||||
replaceVariables(group, arch, dict_info['var'], dict_info['kernel'], do_base)
|
||||
return seen, ref_only, for_pack
|
||||
|
||||
|
||||
def checkBuildMachine(filename):
|
||||
pipe = Popen('. '+filename+'; echo $BuildMachineList', stdout=PIPE, shell=True)
|
||||
machine_list = pipe.stdout.read().strip().split(' ')
|
||||
for interface in ["eth0", "net0", "net1", "bond0"]:
|
||||
cmd = 'ifconfig %s 2> /dev/null | grep "inet addr:" | cut -d":" -f2 | cut -d" " -f1' % interface
|
||||
ip = Popen(cmd, stdout=PIPE, shell=True).stdout.read().strip()
|
||||
if not ip:
|
||||
cmd = "ifconfig %s 2> /dev/null | grep 'inet ' | awk '{print $2}'" % interface
|
||||
ip = Popen(cmd, stdout=PIPE, shell=True).stdout.read().strip()
|
||||
if ip:
|
||||
break
|
||||
if ip in machine_list:
|
||||
return True
|
||||
else:
|
||||
print('This IP ('+ip+') is not build machine.')
|
||||
return False
|
||||
|
||||
|
||||
def showTimeCost(start, end, tag):
|
||||
diff = int(end-start)
|
||||
diff_second = diff%60
|
||||
diff_minute = (diff/60)%60
|
||||
diff_hour = (diff/3600)%60
|
||||
print('Time cost: {0:02d}:{1:02d}:{2:02d} [{3:s}]'.format(diff_hour, diff_minute, diff_second, tag))
|
||||
|
||||
|
||||
def getArchDir(arch, dict_env):
|
||||
if dict_env.has_key(arch):
|
||||
return 'ds.'+arch+'-'+dict_env[arch]
|
||||
elif dict_env.has_key('all'):
|
||||
return 'ds.'+arch+'-'+dict_env['all']
|
||||
else:
|
||||
reportMessage(ERROR_ARG, 'Fail to get directory of '+arch)
|
||||
|
||||
|
||||
def getEnvVer(arch, dict_env):
|
||||
version = ''
|
||||
result = []
|
||||
if dict_env.has_key(arch):
|
||||
version = dict_env[arch]
|
||||
elif dict_env.has_key('all'):
|
||||
version = dict_env['all']
|
||||
else:
|
||||
reportMessage(ERROR_ARG, 'Fail to get enviroment version of ' + arch)
|
||||
|
||||
result = version.split('.')
|
||||
return int(result[0]), int(result[1])
|
||||
|
||||
|
||||
def detectPlatforms(root_folder, dict_env):
|
||||
platforms = []
|
||||
if not os.path.isdir(root_folder):
|
||||
reportMessage(ERROR_ARG, root_folder+' is not a folder')
|
||||
for folder in os.listdir(root_folder):
|
||||
if not os.path.isdir(root_folder+'/'+folder): continue
|
||||
if not re.match(r'^ds\.', folder): continue
|
||||
parts = string.join(folder.split('.')[1:], '.').split('-')
|
||||
if len(parts) != 2 or parts[0] == '' or parts[1] == '': continue
|
||||
arch = parts[0]
|
||||
suffix = string.join(parts[1:], '-')
|
||||
idx = arch if dict_env.has_key(arch) else 'all'
|
||||
if not dict_env.has_key(idx): continue
|
||||
if dict_env[idx] == suffix: platforms.append(arch)
|
||||
if not platforms :
|
||||
reportMessage(ERROR_ARG, 'No platform found in '+root_folder)
|
||||
return platforms
|
||||
|
||||
|
||||
def replaceVirtualProjects(projects):
|
||||
result = set()
|
||||
addedBase = set()
|
||||
for proj in projects:
|
||||
idx = string.find(proj, VIRTUAL_PROJ_SEP)
|
||||
baseName = proj[:idx]
|
||||
if baseName in addedBase: continue
|
||||
addedBase.add(baseName)
|
||||
result.add(proj)
|
||||
return result
|
||||
|
||||
|
||||
def findDependsFile(base_dir, proj):
|
||||
idx = string.find(proj, VIRTUAL_PROJ_SEP)
|
||||
if idx == -1:
|
||||
real = proj
|
||||
suffix = ''
|
||||
else:
|
||||
real = proj[:idx]
|
||||
suffix = proj[idx:]
|
||||
proj_dir = base_dir+'/source/'+proj
|
||||
if not os.path.isdir(proj_dir):
|
||||
proj_dir = base_dir + '/source/' + real
|
||||
|
||||
filename = proj_dir + '/SynoBuildConf/depends'
|
||||
return filename+suffix if os.path.isfile(filename+suffix) else filename
|
||||
|
||||
|
||||
def setDependsFile(script_dir, arch, dict_env):
|
||||
curr_dir = os.getcwd()
|
||||
os.chdir(script_dir)
|
||||
try:
|
||||
check_call('. include/gitutils; GitSetDependsFile '+arch+':'+resolveBaseTarget(arch, dict_env), shell=True)
|
||||
except CalledProcessError:
|
||||
pass
|
||||
os.chdir(curr_dir)
|
||||
|
||||
|
||||
def traverseDependProjects(projects, arch, dict_env, script_dir, do_base, checkout_depend_file=True, hook=None):
|
||||
# checkout and read base depend file
|
||||
if checkout_depend_file:
|
||||
setDependsFile(script_dir, arch, dict_env)
|
||||
DictVar, DictDep, DictKernel = readDependsBase(script_dir+'/include/project.depends')
|
||||
|
||||
return traverseSource(projects, os.path.dirname(script_dir), arch,
|
||||
{'env': dict_env, 'var': DictVar, 'dep': DictDep, 'kernel': DictKernel}, hook, do_base)
|
BIN
include/pythonutils.pyc
Normal file
BIN
include/pythonutils.pyc
Normal file
Binary file not shown.
3
include/toolkit.config
Executable file
3
include/toolkit.config
Executable file
@ -0,0 +1,3 @@
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
AvailablePlatform_6_0="6281 alpine alpine4k armada370 armada375 armada38x armadaxp avoton braswell bromolow cedarview comcerto2k evansport monaco qoriq x64"
|
27
include/variable
Normal file
27
include/variable
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_VARIABLE__" ]; then
|
||||
__INCLUDE_VARIABLE__=defined
|
||||
|
||||
ConfDir="SynoBuildConf"
|
||||
|
||||
# Directory for all compile logs
|
||||
LogDir="/logs"
|
||||
|
||||
# We will install to $TmpInstDir dir and make a tgz file to $TarBallDir
|
||||
ImageDir="/image"
|
||||
TarBallDir="${ImageDir}/tarballs"
|
||||
DebugTarBallDir="${ImageDir}/synodebug"
|
||||
TmpInstDir="/tmp/_install"
|
||||
|
||||
DebDir="/deb"
|
||||
DebDevBuild="${DebDir}/build"
|
||||
DebDevDir="${DebDir}/tmpInstallDir"
|
||||
DebPkgDir="${DebDir}/result"
|
||||
GlobalDependConf="include/project.depends"
|
||||
|
||||
DEFAULT_CCACHE_SIZE="3G"
|
||||
|
||||
fi # header guard
|
||||
# vim:ft=sh
|
11
include/variable.pkg
Normal file
11
include/variable.pkg
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2000-2016 Synology Inc. All rights reserved.
|
||||
|
||||
if [ -z "$__INCLUDE_VARIABLE_PKG__" ]; then
|
||||
__INCLUDE_VARIABLE_PKG__=defined
|
||||
|
||||
VERSION_FILE=/PkgVersion
|
||||
DownloadServer="sourceforge.net/projects/dsgpl/files"
|
||||
|
||||
fi
|
||||
# vim:ft=sh
|
Reference in New Issue
Block a user