Build in a build sub-directory

This commit is contained in:
Orion Poplawski 2016-12-07 14:36:17 -07:00
parent af0420f223
commit 7a5c2dba41
2 changed files with 16 additions and 9 deletions

View File

@ -19,16 +19,20 @@
# Build unpacked source directory into a package tar file in a temporary location
# Pass -T to use source tarball
%octave_pkg_build(T) %{lua:
if (rpm.expand("%{-T}") == "") then
if (rpm.expand("%{-T}") == "-T") then
octpkg_tarfile = rpm.expand("%{SOURCE0}")
else
octpkg_tarfile = rpm .expand("%{_tmppath}/%{octpkg}-%{version}.tar.gz")
print("tar czf "..octpkg_tarfile.." -C "..rpm.expand("%{_builddir} %{buildsubdir}").."\\n")
else
octpkg_tarfile = rpm.expand("%{SOURCE0}")
end
-- Avoid a warning from pkg build about making the build directory
-- and use a clean directory as octave pkg build will delete contents
print(rpm.expand("mkdir -p %{_builddir}/%{buildsubdir}/build\\n"))
-- This fails to keep the arguments to %octave_cmd for some reason
-- print(rpm.expand("%octave_cmd pkg build -verbose -nodeps %{_builddir}/%{buildsubdir} "..octpkg_tarfile).."\\n")
print(rpm.expand("octave -H -q --no-window-system --no-site-file --eval 'pkg build -verbose -nodeps %{_builddir}/%{buildsubdir} "..octpkg_tarfile).."'\\n")
-- Extract the build tarball for debuginfo generation
print(rpm.expand("tar xf %{octpkg}-%{version}-%{octave_host}-%{octave_api}.tar.gz\\n"))
print(rpm.expand("octave -H -q --no-window-system --no-site-file --eval 'pkg build -verbose -nodeps %{_builddir}/%{buildsubdir}/build "..octpkg_tarfile).."'\\n")
-- Extract the source tarball for debuginfo generation
print(rpm.expand("tar xf "..octpkg_tarfile.." -C %{_builddir}/%{buildsubdir}/build\\n"))
}
# Install a package. We use the octave pkg install command to install the
@ -39,7 +43,7 @@
%octave_pkg_install \
mkdir -p %{buildroot}%{octprefix} \
mkdir -p %{buildroot}%{octarchprefix} \
%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{octpkg}-%{version}-%{octave_host}-%{octave_api}.tar.gz");unlink(pkg("local_list"));unlink(pkg("global_list")); \
%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{_builddir}/%{buildsubdir}/build/%{octpkg}-%{version}-%{octave_host}-%{octave_api}.tar.gz");unlink(pkg("local_list"));unlink(pkg("global_list")); \
if [ -e %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m ] \
then \
mv %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m.orig \
@ -52,7 +56,7 @@ echo "endfunction" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
# Run pkg tests - We need to reinstall to recreate 'octave_packages' so that
# octave can find the package, then remove 'octave_packages' again.
%octave_pkg_check \
%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{octpkg}-%{version}-%{octave_host}-%{octave_api}.tar.gz");pkg("load","%{octpkg}");runtests("%{buildroot}%{octpkgdir}");unlink(pkg("local_list"));unlink(pkg("global_list")); \
%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{_builddir}/%{buildsubdir}/build/%{octpkg}-%{version}-%{octave_host}-%{octave_api}.tar.gz");pkg("load","%{octpkg}");runtests("%{buildroot}%{octpkgdir}");unlink(pkg("local_list"));unlink(pkg("global_list")); \
%{nil}
# preun script - we need to remove our uninstall protection and perhaps

View File

@ -14,7 +14,7 @@
Name: octave
Epoch: 6
Version: 4.2.0
Release: 4%{?rcver:.rc%{rcver}}%{?dist}
Release: 5%{?rcver:.rc%{rcver}}%{?dist}
Summary: A high-level language for numerical computations
Group: Applications/Engineering
License: GPLv3+
@ -422,6 +422,9 @@ fi
%{_pkgdocdir}/refcard*.pdf
%changelog
* Wed Dec 07 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.2.0-5
- Build in a build sub-directory
* Wed Dec 07 2016 Orion Poplawski <orion@cora.nwra.com> - 6:4.2.0-4
- Use 'octave-config -p CANONICAL_HOST_TYPE' in macros