[PATCH 4/4] 5/llvm: Add LLVM as a package for RTEMS.
chrisj at rtems.org
chrisj at rtems.org
Sun Sep 15 02:58:41 UTC 2019
From: Chris Johns <chrisj at rtems.org>
- Add '%source download <source>' to only download the source
and do not unpack and prep. This can used when a package
internally needs another source package.
- Install the staging root only if it is present. A package
may internally build another package that is not staged as it
is not suitable for installing.
Updates #3250
Updatew #3797
---
bare/config/devel/swig-4.0.1.cfg | 20 ++++
bare/config/devel/swig.bset | 19 +++
rtems/config/5/rtems-llvm.bset | 21 ++++
rtems/config/rtems-base.bset | 9 +-
rtems/config/tools/rtems-llvm-8.0.1.cfg | 21 ++++
source-builder/config/llvm-common-1.cfg | 152 ++++++++++++++++++++++++
source-builder/config/swig-4-1.cfg | 97 +++++++++++++++
source-builder/defaults.mc | 3 +-
source-builder/sb/build.py | 99 ++++++++-------
source-builder/sb/darwin.py | 1 +
source-builder/sb/freebsd.py | 1 +
source-builder/sb/options.py | 2 +
source-builder/sb/setbuilder.py | 54 +++++----
source-builder/sb/sources.py | 27 +++--
14 files changed, 451 insertions(+), 75 deletions(-)
create mode 100644 bare/config/devel/swig-4.0.1.cfg
create mode 100644 bare/config/devel/swig.bset
create mode 100644 rtems/config/5/rtems-llvm.bset
create mode 100644 rtems/config/tools/rtems-llvm-8.0.1.cfg
create mode 100644 source-builder/config/llvm-common-1.cfg
create mode 100644 source-builder/config/swig-4-1.cfg
diff --git a/bare/config/devel/swig-4.0.1.cfg b/bare/config/devel/swig-4.0.1.cfg
new file mode 100644
index 0000000..9352862
--- /dev/null
+++ b/bare/config/devel/swig-4.0.1.cfg
@@ -0,0 +1,20 @@
+#
+# SWIG 4.0.1
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+%include %{_configdir}/base.cfg
+
+%define swig_version 4.0.1
+%hash sha512 swig-rel-%{swig_version}.tar.gz AeegX9wtAHvY40gxQoEHXIx4RuQG4KpSopReBWwbsmhzfLSz8saStvixkhNgl+ZygHCgGqRFPQdQrArxLLQDSg==
+
+%define pcre_version 8.40
+%hash sha512 pcre-%{pcre_version}.tar.bz2 tMJ+r73zO9ehOEZVsZNvS+O8Z0XAcjR+sm6YiJbFJmS9haxCRE2hvni24g9Ftsflkh9fIPWwdBtb09mETlvU4g==
+
+#
+# The SWIG build instructions.
+#
+%include %{_configdir}/swig-4-1.cfg
diff --git a/bare/config/devel/swig.bset b/bare/config/devel/swig.bset
new file mode 100644
index 0000000..c269f24
--- /dev/null
+++ b/bare/config/devel/swig.bset
@@ -0,0 +1,19 @@
+#
+# Build set for SWIG
+#
+
+%define release 1
+
+#
+# Name of the package.
+#
+package: swig-%{swig_version}-%{_host}-%{release}
+
+#
+# A magic internal path that would break if changes in the defaults.mc
+# macro file are made.
+#
+%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
+
+devel/autotools-internal
+devel/swig-4.0.1
diff --git a/rtems/config/5/rtems-llvm.bset b/rtems/config/5/rtems-llvm.bset
new file mode 100644
index 0000000..2b461a0
--- /dev/null
+++ b/rtems/config/5/rtems-llvm.bset
@@ -0,0 +1,21 @@
+#
+# LLVM for RTEMS 5 Tools Stable
+#
+
+%define release 1
+
+%define rtems_arch none
+
+#
+# The RTEMS base defines.
+#
+%include rtems-base.bset
+
+#
+# Build and install into a prefix that is away from the staged area or it will
+# be installed.
+#
+%define swig_prefix %{_tmproot}/swig
+
+devel/swig
+tools/rtems-llvm-8.0.1
diff --git a/rtems/config/rtems-base.bset b/rtems/config/rtems-base.bset
index 6749ce4..9f76434 100644
--- a/rtems/config/rtems-base.bset
+++ b/rtems/config/rtems-base.bset
@@ -20,9 +20,14 @@ package: rtems-%{rtems_version}-%{_target}-%{_host}-%{release}
#
# Project custom message
#
-%define rtems_gcc_version %{rtems_version}
-%define gcc_version_message RTEMS %{rtems_gcc_version}, RSB %{_sbgit_id}, Newlib %{newlib_version}
+%define rtems_version_message RTEMS %{rtems_version}, RSB %{_sbgit_id}
+%define rtems_gcc_version %{rtems_version}
+%define gcc_version_message %{rtems_version_message}, Newlib %{newlib_version}
+
+%define rtems_llvm_version %{rtems_version}
+%define llvm_version_message %{rtems_version_message}
+%define clang_version_message %{rtems_version_message}
#
# Pick up the RTEMS URLs.
#
diff --git a/rtems/config/tools/rtems-llvm-8.0.1.cfg b/rtems/config/tools/rtems-llvm-8.0.1.cfg
new file mode 100644
index 0000000..1bf6986
--- /dev/null
+++ b/rtems/config/tools/rtems-llvm-8.0.1.cfg
@@ -0,0 +1,21 @@
+#
+# LLVM
+#
+
+%define llvm_version 8.0.1
+
+%hash sha512 llvm-%{llvm_version}.src.tar.xz guEgvlyr39URGuu+popmP+IpyIYdc4AtarCaO/SPYN4zPgfmH4+2G+qhSsK+ok/NdPpvdhrK9iRp9Ta3n8seFg==
+%hash sha512 cfe-%{llvm_version}.src.tar.xz Eiey0yBSxwtLSUZZhJAAGI/ORvwxpx8zUrqEV6wLCxfkvHyFiYdMhYbVWqgI7mwfzrffUBqvozWZ+N97/St5HQ==
+%hash sha512 clang-tools-extra-%{llvm_version}.src.tar.xz 05liww7p2KFnnYAHAJtI3qLIqusoO+14Gp4ioaV7gYbCz+BY2gRmWIgqzhyEow3fm0y3W86YiJEYnoQjtsanLA==
+%hash sha512 compiler-rt-%{llvm_version}.src.tar.xz Er8b2r4lwMOoTMc6cY/hVFc91ynsP/Xgmb1fdMa+ycgFIbh97WRtOyDf25qlHeoCNCgUGMfrgYBeHdXTEH09jg==
+%hash sha512 libcxx-%{llvm_version}.src.tar.xz dXSdCLKzQ8b1+a77BL5j5C9tEu/FEQHTZH7W9wx6bQUK+zqy82NurnjLUj9YRN5nuWCnoxRe2JqwxwFd6xSSHg==
+%hash sha512 libcxxabi-%{llvm_version}.src.tar.xz V3z8sE67Ke6E017TGqj+yyj8dLB+9/8pjw/i1ED4I973PgkjWcQdjYYA5t8Y9VIk7YlnTUA8WuVqfXlzSHuHNA==
+%hash sha512 libunwind-%{llvm_version}.src.tar.xz wRVYLKh54hW5fSTkqoBpZ5Y4PnmFbPJuQLTd1rJV1Zj5+phnsw8P0Wkb53B3mDWsHUuaXkpxQksYSZt56jfQYA==
+%hash sha512 lld-%{llvm_version}.src.tar.xz ZGQY1KTOki0aaem/LkcvXXWPJewhuAosZt/l7/xZycMS+xZ89k7i2KLO2YbnR07T0plqOL5m+/Y8V0Ip0o4JAA==
+%hash sha512 lldb-%{llvm_version}.src.tar.xz 6wMZha1NCCJuxHqQ/jLB5tBwlIlxylI1/UMc99W36iD11RMSN7+DpkGXc9GMM5WQv5Zy57T4hDBEl+Y8EDCYjw==
+%hash sha512 openmp-%{llvm_version}.src.tar.xz ne14XIEp57OnC1TwfE3eUpRW7cyUkErXf8V4z38JbPo/8ieZWdf38dtRVx4RxTN18ztZfH82zm3GtRLETO2AJg==
+
+#
+# The llvm build instructions.
+#
+%include %{_configdir}/llvm-common-1.cfg
diff --git a/source-builder/config/llvm-common-1.cfg b/source-builder/config/llvm-common-1.cfg
new file mode 100644
index 0000000..c75769f
--- /dev/null
+++ b/source-builder/config/llvm-common-1.cfg
@@ -0,0 +1,152 @@
+#
+# LLVM Common Support.
+#
+# This configuration file configure's, make's and install's LLVM and some of
+# it projects.
+#
+
+%include %{_configdir}/checks.cfg
+
+#
+# The package description.
+#
+Name: rtems-llvm-%{llvm_version}-%{_host}-%{release}
+Summary: LLVM v%{llvm_version} on host %{_host}
+Version: %{llvm_version}
+Release: %{release}
+URL: http://llvm.org/
+
+#
+# The LLVM version depends on the type of build we are doing.
+#
+%if %{rsb_released}
+ %define rtems_llvm_version %{rsb_version}
+%else
+ %define rtems_llvm_version %{rtems_version}
+%endif
+
+#
+# LLVM Download URL.
+#
+%define llvm_url https://github.com/llvm/llvm-project/releases/download/llvmorg-%{llvm_version}
+
+#
+# Packages
+#
+%source set cfe %{llvm_url}/cfe-%{llvm_version}.src.tar.xz
+%source set clang-tools-extra %{llvm_url}/clang-tools-extra-%{llvm_version}.src.tar.xz
+%source set compiler-rt %{llvm_url}/compiler-rt-%{llvm_version}.src.tar.xz
+%source set libcxx %{llvm_url}/libcxx-%{llvm_version}.src.tar.xz
+%source set libcxxabi %{llvm_url}/libcxxabi-%{llvm_version}.src.tar.xz
+%source set libunwind %{llvm_url}/libunwind-%{llvm_version}.src.tar.xz
+%source set lld %{llvm_url}/lld-%{llvm_version}.src.tar.xz
+%source set lldb %{llvm_url}/lldb-%{llvm_version}.src.tar.xz
+%source set llvm %{llvm_url}/llvm-%{llvm_version}.src.tar.xz
+%source set openmp %{llvm_url}/openmp-%{llvm_version}.src.tar.xz
+
+#
+# Build LLDB on all hosts except MacOS as it reqires a codesign login key of
+# name 'llvm'.
+#
+%if %{_build_os} != darwin
+ %define with_llvm_lldb 1
+%endif
+
+%if %{defined with_llvm_lldb}
+ %define lldb_codesign_identity -DLLDB_CODESIGN_IDENTITY=llvm
+%else
+ %define lldb_codesign_identity %{nil}
+%endif
+
+#
+# Prepare the source code.
+#
+%prep
+ # save the build top directory and cd back to it rather than
+ # using 'cd ..' because some shells change $PWD to a symlink's
+ # target location and 'cd ..' fails.
+ build_top=$(pwd)
+
+ llvm_source=%{?llvm_external:%{llvm_expand_name}}%{!?llvm_external:"llvm-%{llvm_version}"}
+
+ # llvm is a collection of separate packages, download them and then create
+ # the source tree.
+
+ source_dir_llvm=${llvm_source}
+
+ %source setup llvm -q
+ %{__mv} llvm-%{llvm_version}.src ${source_dir_llvm}
+
+ %source setup cfe -q
+ %{__mv} cfe-%{llvm_version}.src ${source_dir_llvm}/tools/clang
+
+ %source setup clang-tools-extra -q
+ %{__mv} clang-tools-extra-%{llvm_version}.src ${source_dir_llvm}/tools/clang/extra
+
+ %source setup compiler-rt -q
+ %{__mv} compiler-rt-%{llvm_version}.src ${source_dir_llvm}/projects/compiler-rt
+
+ %source setup libcxx -q
+ %{__mv} libcxx-%{llvm_version}.src ${source_dir_llvm}/projects/libcxx
+
+ %source setup libcxxabi -q
+ %{__mv} libcxxabi-%{llvm_version}.src ${source_dir_llvm}/projects/libcxxabi
+
+ %source setup libunwind -q
+ %{__mv} libunwind-%{llvm_version}.src ${source_dir_llvm}/projects/libunwind
+
+ %source setup lld -q
+ %{__mv} lld-%{llvm_version}.src ${source_dir_llvm}/tools/lld
+
+ %if %{defined with_llvm_lldb}
+ %source setup lldb -q
+ %{__mv} lldb-%{llvm_version}.src ${source_dir_llvm}/tools/lldb
+ %endif
+
+ %source setup openmp -q
+ %{__mv} openmp-%{llvm_version}.src ${source_dir_llvm}/tools/openmp
+
+ %patch setup llvm -p1
+
+ cd ${build_top}
+
+%build
+ build_top=$(pwd)
+
+ # SWIG will be built and installed into %{swig_prefix} if defined
+ # so add it as a path.
+ %if %{defined swig_prefix}
+ export PATH=%{swig_prefix}/bin:$PATH
+ %endif
+
+ %{build_directory}
+
+ mkdir -p ${build_dir}
+ cd ${build_dir}
+
+ %{__cmake} -Wno-dev \
+ -G "Unix Makefiles" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DPACKAGE_VERSION="%{llvm_version} (%{llvm_version_message})" \
+ %{lldb_codesign_identity} \
+ ../${source_dir_llvm}
+
+ version_inc="tools/clang/include/clang/Basic/Version.inc"
+ %{__cat} ${version_inc} | \
+ sed -e 's/CLANG_VERSION_STRING "[0-9]*\.[0-9]*\.[0-9]*/& \(%{llvm_version_message}\)/g' \
+ > ${version_inc}.tmp
+ %{__mv} ${version_inc}.tmp ${version_inc}
+
+ %{__make} %{?_smp_mflags}
+
+ cd ${build_top}
+
+%install
+ build_top=$(pwd)
+
+ %{__rmdir} $SB_BUILD_ROOT
+
+ cd ${build_dir}
+ %{__make} DESTDIR=$SB_BUILD_ROOT install
+ cd ${build_top}
diff --git a/source-builder/config/swig-4-1.cfg b/source-builder/config/swig-4-1.cfg
new file mode 100644
index 0000000..6c10114
--- /dev/null
+++ b/source-builder/config/swig-4-1.cfg
@@ -0,0 +1,97 @@
+#
+# SWIG 4.xx Version 1.
+#
+# This configuration file configure's, make's and install's m4
+#
+# Warning: this package is only for bootstrapping within a build.
+#
+
+
+Name: swig-%{swig_version}-%{_host}-%{release}
+Summary: SWIG v%{swig_version} for host %{_host}
+Version: %{swig_version}
+Release: %{release}
+URL: http://www.swig.org/
+
+#
+# Source
+#
+%source set swig --rsb-file=swig-rel-%{swig_version}.tar.gz https://github.com/swig/swig/archive/rel-%{swig_version}.tar.gz
+%source set pcre https://ftp.pcre.org/pub/pcre/pcre-%{pcre_version}.tar.bz2
+
+#
+# See if a special swig prefix is provided
+#
+%if %{defined swig_prefix}
+ %define _disable_collecting yes
+ %define _disable_packaging yes
+ %define _disable_reporting yes
+ %define _disable_installing yes
+%endif
+
+#
+# Prepare the source code.
+#
+%prep
+ build_top=$(pwd)
+
+ source_dir_swig="swig-rel-%{swig_version}"
+
+ %source setup swig -q -n swig-rel-%{swig_version}
+ %source download pcre
+
+ %patch setup swig -p1
+
+ # SWIG does not ship from github with it's generated files. We
+ # need to generate them.
+ # Add the path to the internal autoconf tools
+ SWIG_XPATH=$PATH
+ %if %{defined _internal_autotools_path}
+ export PATH=%{_internal_autotools_path}/bin:$PATH
+ %endif
+ ./autogen.sh
+ export PATH=$SWIG_XPATH
+
+ cd ${build_top}
+
+%build
+ build_top=$(pwd)
+
+ %{build_directory}
+
+ mkdir -p ${build_dir}
+ cd ${build_dir}
+
+ %{host_build_flags}
+
+ # build PCRE using the SWIG script as it is a static link
+ %{__cp} %{_sourcedir}/pcre-%{pcre_version}.tar.bz2 pcre-%{pcre_version}.tar.bz2
+ ../${source_dir_swig}/Tools/pcre-build.sh
+
+ %if %{defined swig_prefix}
+ prefix=%{swig_prefix}
+ %else
+ prefix=%{_prefix}
+ %endif
+
+ ../${source_dir_swig}/configure \
+ --host=%{_host} \
+ --prefix=${prefix}
+
+ %{__make} %{?_smp_mflags}
+
+ cd ${build_top}
+
+%install
+ build_top=$(pwd)
+
+ %{__rmdir} ${SB_BUILD_ROOT}
+
+ cd ${build_dir}
+ %if %{!defined swig_prefix}
+ %define destdir DESTDIR=${SB_BUILD_ROOT}
+ %else
+ %define destdir %{nil}
+ %endif
+ %{__make} %{destdir} install
+ cd ${build_top}
diff --git a/source-builder/defaults.mc b/source-builder/defaults.mc
index 9d5dd44..273bd31 100644
--- a/source-builder/defaults.mc
+++ b/source-builder/defaults.mc
@@ -157,6 +157,7 @@ __cc: exe, required, 'gcc'
__chgrp: exe, required, '/usr/bin/chgrp'
__chmod: exe, required, '/bin/chmod'
__chown: exe, required, '/usr/sbin/chown'
+__cmake: exe, optional, '/usr/bin/cmake'
__cp: exe, required, '/bin/cp'
__cpp: exe, none, '%{__cc} -E'
__cvs: exe, optional, '/usr/bin/cvs'
@@ -205,7 +206,7 @@ ___build_cmd: none, none, '%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh}
___build_post: none, none, 'exit 0'
# Prebuild set up script.
-___build_pre: none, none, '''# ___build_pre in as set up in defaults.py
+___build_pre: none, none, '''# ___build_pre as set up in defaults.py
# Save the original path away.
export SB_ORIG_PATH=${PATH}
# Directories
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index abc50c0..69f95cf 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -203,7 +203,7 @@ class build:
not _disable_installing and \
not _canadian_cross
- def source(self, name, strip_components):
+ def source(self, name, strip_components, download_only):
#
# Return the list of sources. Merge in any macro defined sources as
# these may be overridden by user loaded macros.
@@ -238,31 +238,37 @@ class build:
if o.startswith('--rsb-file'):
os_ = o.split('=')
if len(os_) != 2:
- raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
+ raise error.general('invalid --rsb-file option: %s' % \
+ (' '.join(args)))
if os_[0] != '--rsb-file':
- raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
+ raise error.general('invalid --rsb-file option: %s' % \
+ (' '.join(args)))
file_override = os_[1]
opts = [o for o in opts if not o.startswith('--rsb-')]
url = self.config.expand(' '.join(url))
- src = download.parse_url(url, '_sourcedir', self.config, self.opts, file_override)
+ src = download.parse_url(url, '_sourcedir',
+ self.config, self.opts, file_override)
download.get_file(src['url'], src['local'], self.opts, self.config)
- if strip_components > 0:
- tar_extract = '%%{__tar_extract} --strip-components %d' % (strip_components)
- else:
- tar_extract = '%{__tar_extract}'
- if 'symlink' in src:
- sname = name.replace('-', '_')
- src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], sname)
- elif 'compressed' in src:
- #
- # Zip files unpack as well so do not use tar.
- #
- src['script'] = '%s %s' % (src['compressed'], src['local'])
- if src['compressed-type'] != 'zip':
- src['script'] += ' | %s -f -' % (tar_extract)
- else:
- src['script'] = '%s -f %s' % (tar_extract, src['local'])
- srcs += [src]
+ if not download_only:
+ if strip_components > 0:
+ tar_extract = '%%{__tar_extract} --strip-components %d' % \
+ (strip_components)
+ else:
+ tar_extract = '%{__tar_extract}'
+ if 'symlink' in src:
+ sname = name.replace('-', '_')
+ src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % \
+ (src['symlink'], sname)
+ elif 'compressed' in src:
+ #
+ # Zip files unpack as well so do not use tar.
+ #
+ src['script'] = '%s %s' % (src['compressed'], src['local'])
+ if src['compressed-type'] != 'zip':
+ src['script'] += ' | %s -f -' % (tar_extract)
+ else:
+ src['script'] = '%s -f %s' % (tar_extract, src['local'])
+ srcs += [src]
return srcs
def source_setup(self, package, args):
@@ -270,7 +276,7 @@ class build:
setup_name = args[1]
args = args[1:]
try:
- opts, args = getopt.getopt(args[1:], 'qDcn:bas:')
+ opts, args = getopt.getopt(args[1:], 'qDcn:bas:g')
except getopt.GetoptError as ge:
raise error.general('source setup error: %s' % str(ge))
quiet = False
@@ -282,6 +288,7 @@ class build:
changed_dir = False
strip_components = 0
opt_name = None
+ download_only = False
for o in opts:
if o[0] == '-q':
quiet = True
@@ -297,30 +304,37 @@ class build:
unpack_before_chdir = False
elif o[0] == '-s':
if not o[1].isdigit():
- raise error.general('source setup error: invalid strip count: %s' % (o[1]))
+ raise error.general('source setup error: invalid strip count: %s' % \
+ (o[1]))
strip_components = int(o[1])
+ elif o[0] == '-g':
+ download_only = True
name = None
- for source in self.source(setup_name, strip_components):
+ for source in self.source(setup_name, strip_components, download_only):
if name is None:
if opt_name is None:
if source:
opt_name = source['name']
else:
- raise error.general('setup source tag not found: %d' % (source_tag))
+ raise error.general('setup source tag not found: %d' % \
+ (source_tag))
else:
name = opt_name
- self.script_build.append(self.config.expand('cd %{_builddir}'))
- if not deleted_dir and delete_before_unpack:
- self.script_build.append(self.config.expand('%{__rm} -rf ' + name))
- deleted_dir = True
- if not created_dir and create_dir:
- self.script_build.append(self.config.expand('%{__mkdir_p} ' + name))
- created_dir = True
- if not changed_dir and (not unpack_before_chdir or create_dir):
- self.script_build.append(self.config.expand('cd ' + name))
- changed_dir = True
- self.script_build.append(self.config.expand(source['script']))
- if not changed_dir and (unpack_before_chdir and not create_dir):
+ if not download_only:
+ self.script_build.append(self.config.expand('cd %{_builddir}'))
+ if not deleted_dir and delete_before_unpack and name is not None:
+ self.script_build.append(self.config.expand('%{__rm} -rf ' + name))
+ deleted_dir = True
+ if not created_dir and create_dir and name is not None:
+ self.script_build.append(self.config.expand('%{__mkdir_p} ' + name))
+ created_dir = True
+ if not changed_dir and (not unpack_before_chdir or create_dir) and \
+ name is not None:
+ self.script_build.append(self.config.expand('cd ' + name))
+ changed_dir = True
+ self.script_build.append(self.config.expand(source['script']))
+ if not changed_dir and (unpack_before_chdir and not create_dir) and \
+ name is not None and not download_only:
self.script_build.append(self.config.expand('cd ' + name))
changed_dir = True
self.script_build.append(self.config.expand('%{__setup_post}'))
@@ -345,7 +359,7 @@ class build:
else:
url += [pp]
if len(url) == 0:
- raise error.general('patch URL not found: %s' % (' '.join(args)))
+ raise error.general('patch URL not found: %s' % (' '.join(opts)))
#
# Look for --rsb-file as an option we use as a local file name.
# This can be used if a URL has no reasonable file name the
@@ -357,9 +371,11 @@ class build:
if o.startswith('--rsb-file'):
os_ = o.split('=')
if len(os_) != 2:
- raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
+ raise error.general('invalid --rsb-file option: %s' % \
+ (' '.join(opts)))
if os_[0] != '--rsb-file':
- raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
+ raise error.general('invalid --rsb-file option: %s' % \
+ (' '.join(opts)))
file_override = os_[1]
opts = [o for o in opts if not o.startswith('--rsb-')]
if len(opts) == 0:
@@ -371,7 +387,8 @@ class build:
#
# Parse the URL first in the source builder's patch directory.
#
- patch = download.parse_url(url, '_patchdir', self.config, self.opts, file_override)
+ patch = download.parse_url(url, '_patchdir', self.config,
+ self.opts, file_override)
#
# Download the patch
#
diff --git a/source-builder/sb/darwin.py b/source-builder/sb/darwin.py
index d79cf47..a21a6bc 100644
--- a/source-builder/sb/darwin.py
+++ b/source-builder/sb/darwin.py
@@ -52,6 +52,7 @@ def load():
'_var': ('dir', 'optional', '/usr/local/var'),
'_prefix': ('dir', 'optional', '%{_usr}'),
'__ldconfig': ('exe', 'none', ''),
+ '__cmake': ('exe', 'optional', 'cmake'),
'__cvs': ('exe', 'optional', 'cvs'),
'__xz': ('exe', 'required', 'xz'),
'with_zlib': ('none', 'none', '--with-zlib=no'),
diff --git a/source-builder/sb/freebsd.py b/source-builder/sb/freebsd.py
index decd1c9..8fc7db1 100644
--- a/source-builder/sb/freebsd.py
+++ b/source-builder/sb/freebsd.py
@@ -63,6 +63,7 @@ def load():
'_var': ('dir', 'optional', '/usr/local/var'),
'__bash': ('exe', 'optional', '/usr/local/bin/bash'),
'__bison': ('exe', 'required', '/usr/local/bin/bison'),
+ '__cmake': ('exe', 'optional', '/usr/local/bin/cmake'),
'__git': ('exe', 'required', '/usr/local/bin/git'),
'__svn': ('exe', 'optional', '/usr/local/bin/svn'),
'__unzip': ('exe', 'optional', '/usr/local/bin/unzip'),
diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
index 9fe0269..8063734 100644
--- a/source-builder/sb/options.py
+++ b/source-builder/sb/options.py
@@ -293,6 +293,8 @@ class command_line:
'--without-log',
'--without-error-report',
'--without-release-url']
+ if a == '--dry-run':
+ self.args += ['--without-error-report']
arg += 1
def post_process(self, logfile = True):
diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index 380fa00..3d10d58 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -405,18 +405,6 @@ class buildset:
if nesting_count != 1:
if self.installing():
self.macros['install_mode'] = 'staging'
- #
- # Prepend staging areas, bin directory tothe
- # path. Lets the later package depend on the eailier
- # ones.
- #
- pathprepend = ['%{stagingroot}/bin'] + \
- macro_expand(self.macros, '%{_pathprepend}').split(':')
- pathprepend = [pp for pp in pathprepend if len(pp)]
- if len(pathprepend) == 1:
- self.macros['_pathprepend'] = pathprepend[0]
- else:
- self.macros['_pathprepend'] = ':'.join(pathprepend)
#
# Only the outter build set can have staging to install. Get the staging
@@ -430,6 +418,20 @@ class buildset:
log.trace('_bset: %2d: %s: configs: %s' % (nesting_count,
self.bset, ', '.join(configs)))
+ if nesting_count == 1 and len(configs) > 1:
+ #
+ # Prepend staging areas, bin directory to the
+ # path. Lets the later package depend on the earlier
+ # ones.
+ #
+ pathprepend = ['%{stagingroot}/bin'] + \
+ macro_expand(self.macros, '%{_pathprepend}').split(':')
+ pathprepend = [pp for pp in pathprepend if len(pp)]
+ if len(pathprepend) == 1:
+ self.macros['_pathprepend'] = pathprepend[0]
+ else:
+ self.macros['_pathprepend'] = ':'.join(pathprepend)
+
sizes_valid = False
builds = []
for s in range(0, len(configs)):
@@ -519,7 +521,7 @@ class buildset:
log.trace('_bset: %2d: %s: builds: %s' % \
(nesting_count, self.install_mode(),
', '.join([b.name() for b in builds])))
- if deps is None and not have_errors:
+ if deps is None and not self.opts.no_install() and not have_errors:
for b in builds:
log.trace('_bset: : %s: %r' % (self.install_mode(),
b.installable()))
@@ -586,18 +588,22 @@ class buildset:
# If builds have been staged install into the finaly prefix.
#
if have_staging and not self.opts.no_install() and not have_errors:
- log.trace('_bset: %2d: install staging' % (nesting_count))
stagingroot = macro_expand(self.macros, '%{stagingroot}')
- prefix = macro_expand(self.macros, '%{_prefix}')
- self.install(self.install_mode(), self.bset, stagingroot, prefix)
- staging_size = path.get_size(stagingroot)
- if not self.opts.no_clean() or self.opts.always_clean():
- log.notice('clean staging: %s' % (self.bset))
- log.trace('removing: %s' % (stagingroot))
- if not self.opts.dry_run():
- if path.exists(stagingroot):
- path.removeall(stagingroot)
- log.notice('Staging Size: %s' % (build.humanize_number(staging_size, 'B')))
+ have_stagingroot = path.exists(stagingroot)
+ log.trace('_bset: %2d: install staging, present: %s' % \
+ (nesting_count, have_stagingroot))
+ if have_stagingroot:
+ prefix = macro_expand(self.macros, '%{_prefix}')
+ self.install(self.install_mode(), self.bset, stagingroot, prefix)
+ staging_size = path.get_size(stagingroot)
+ if not self.opts.no_clean() or self.opts.always_clean():
+ log.notice('clean staging: %s' % (self.bset))
+ log.trace('removing: %s' % (stagingroot))
+ if not self.opts.dry_run():
+ if path.exists(stagingroot):
+ path.removeall(stagingroot)
+ log.notice('Staging Size: %s' % \
+ (build.humanize_number(staging_size, 'B')))
except error.general as gerr:
if not build_error:
log.stderr(str(gerr))
diff --git a/source-builder/sb/sources.py b/source-builder/sb/sources.py
index 967becc..c5f0037 100644
--- a/source-builder/sb/sources.py
+++ b/source-builder/sb/sources.py
@@ -49,8 +49,8 @@ def add(label, args, macros, error):
def set(label, args, macros, error):
args = _args(args)
if len(args) < 2:
- error('%%%s requires at least 2 arguments' % (label))
- return
+ error('%%%s set requires at least 2 arguments' % (label))
+ return []
_map = '%s-%s' % (label, args[0])
macros.create_map(_map)
key = _make_key(label, 0)
@@ -63,12 +63,26 @@ def set(label, args, macros, error):
def setup(label, args, macros, error):
args = _args(args)
if len(args) < 2:
- error('%%%s requires at least 2 arguments: %s' % (label, ' '.join(args)))
+ error('%%%s setup requires at least 2 arguments: %s' % (label, ' '.join(args)))
ss = '%%setup %s %s' % (label, ' '.join(args))
_map = '%s-%s' % (label, args[0])
if 'setup' in macros.map_keys(_map):
error('%%%s already setup source: %s' % (label, ' '.join(args)))
- return
+ return []
+ macros.set_write_map(_map)
+ macros.define('setup', ss)
+ macros.unset_write_map()
+ return [ss]
+
+def download(label, args, macros, error):
+ args = _args(args)
+ if len(args) != 1:
+ error('%%%s download requires 1 argument: %s' % (label, ' '.join(args)))
+ ss = '%%setup %s %s -g' % (label, ' '.join(args))
+ _map = '%s-%s' % (label, args[0])
+ if 'setup' in macros.map_keys(_map):
+ error('%%%s already setup source: %s' % (label, ' '.join(args)))
+ return []
macros.set_write_map(_map)
macros.define('setup', ss)
macros.unset_write_map()
@@ -79,15 +93,14 @@ def process(label, args, macros, error):
error('invalid source type: %s' % (label))
args = _args(args)
log.trace('sources: %s' % (' '.join(args)))
- if len(args) < 3:
- error('%%%s requires at least 3 arguments: %s' % (label, ' '.join(args)))
- return
if args[0] == 'set':
return set(label, args[1:], macros, error)
elif args[0] == 'add':
return add(label, args[1:], macros, error)
elif args[0] == 'setup':
return setup(label, args[1:], macros, error)
+ elif args[0] == 'download':
+ return download(label, args[1:], macros, error)
error('invalid %%%s command: %s' % (label, args[0]))
def hash(args, macros, error):
--
2.20.1
More information about the devel
mailing list