From 265a73c346ccfe1b4529e5a7eca6755e5bd44941 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 30 Mar 2011 11:09:06 -0600 Subject: [PATCH] Use libdir instead of libexecdir Rename octave_pkg_preun macro Fix multilib installs Re-enable prelinking, seems to work Add patch to enable building packages from directories --- macros.octave | 6 +-- octave-3.4.0-libdir.patch | 72 +++++++++++++++++++++++++++++ octave-3.4.0-pkgbuilddir.patch | 41 +++++++++++++++++ octave.spec | 84 ++++++++++++++++++++++++++++++---- 4 files changed, 191 insertions(+), 12 deletions(-) create mode 100644 octave-3.4.0-libdir.patch create mode 100644 octave-3.4.0-pkgbuilddir.patch diff --git a/macros.octave b/macros.octave index 278598b..5875023 100644 --- a/macros.octave +++ b/macros.octave @@ -6,7 +6,7 @@ # Octave Package Directories %octshareprefix %{_datadir}/octave %octprefix %{octshareprefix}/packages -%octarchprefix %{_libexecdir}/octave/packages +%octarchprefix %{_libdir}/octave/packages %octpkgdir %{octprefix}/%{octpkg}-%{version} %octpkglibdir %{octarchprefix}/%{octpkg}-%{version} @@ -14,7 +14,7 @@ %octave_cmd() octave -H -q --no-site-file --eval "%*"; # Build Source0 into a package tar file in a temporary location -%octave_pkg_build %octave_cmd pkg build '-verbose' %{_tmppath}/%{name}-%{version}-%{release}.%{_arch} %SOURCE0 +%octave_pkg_build %octave_cmd pkg build '-verbose' %{_tmppath}/%{name}-%{version}-%{release}.%{_arch} %{_builddir}/%{buildsubdir} # Install a package. We use the octave pkg install command to install the # built package into the buildroot. We also put a note to prevent the root @@ -34,7 +34,7 @@ echo "endfunction" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \ # preun script - we need to remove our uninstall protection and perhaps # run the package's own uninstall script. -%_octave_pkg_preun \ +%octave_pkg_preun \ rm %{octpkgdir}/packinfo/on_uninstall.m \ if [ -e %{octpkgdir}/packinfo/on_uninstall.m.orig ]; then \ mv %{octpkgdir}/packinfo/on_uninstall.m.orig %{octpkgdir}/packinfo/on_uninstall.m \ diff --git a/octave-3.4.0-libdir.patch b/octave-3.4.0-libdir.patch new file mode 100644 index 0000000..3bc68af --- /dev/null +++ b/octave-3.4.0-libdir.patch @@ -0,0 +1,72 @@ +--- octave-3.4.0/configure.libdir 2011-02-08 03:03:31.000000000 -0700 ++++ octave-3.4.0/configure 2011-03-18 10:35:25.014978076 -0600 +@@ -6680,7 +6680,7 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining octetcdir to be $octetcdir" >&5 + $as_echo "defining octetcdir to be $octetcdir" >&6; } + +-: ${octlibdir='$(libdir)/octave-$(version)'} ++: ${octlibdir='$(libdir)/octave/$(version)'} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining octlibdir to be $octlibdir" >&5 + $as_echo "defining octlibdir to be $octlibdir" >&6; } + +@@ -6700,19 +6700,19 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localverarchlibdir to be $localverarchlibdir" >&5 + $as_echo "defining localverarchlibdir to be $localverarchlibdir" >&6; } + +-: ${octfiledir='$(libexecdir)/octave/$(version)/oct/$(canonical_host_type)'} ++: ${octfiledir='$(libdir)/octave/$(version)/oct'} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining octfiledir to be $octfiledir" >&5 + $as_echo "defining octfiledir to be $octfiledir" >&6; } + +-: ${localoctfiledir='$(libexecdir)/octave/site/oct/$(canonical_host_type)'} ++: ${localoctfiledir='$(libdir)/octave/site/oct'} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localoctfiledir to be $localoctfiledir" >&5 + $as_echo "defining localoctfiledir to be $localoctfiledir" >&6; } + +-: ${localapioctfiledir='$(libexecdir)/octave/site/oct/$(api_version)/$(canonical_host_type)'} ++: ${localapioctfiledir='$(libdir)/octave/site/oct/$(api_version)'} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localapioctfiledir to be $localapioctfiledir" >&5 + $as_echo "defining localapioctfiledir to be $localapioctfiledir" >&6; } + +-: ${localveroctfiledir='$(libexecdir)/octave/$(version)/site/oct/$(canonical_host_type)'} ++: ${localveroctfiledir='$(libdir)/octave/$(version)/site/oct'} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localveroctfiledir to be $localveroctfiledir" >&5 + $as_echo "defining localveroctfiledir to be $localveroctfiledir" >&6; } + +--- octave-3.4.0/scripts/pkg/pkg.m.libdir 2011-03-18 09:34:11.258406127 -0600 ++++ octave-3.4.0/scripts/pkg/pkg.m 2011-03-18 10:56:58.763177238 -0600 +@@ -248,7 +248,7 @@ + if (prefix == -1) + if (global_install) + prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages"); +- archprefix = fullfile (octave_config_info ("libexecdir"), ++ archprefix = fullfile (octave_config_info ("libdir"), + "octave", "packages"); + else + prefix = fullfile ("~", "octave"); +@@ -293,7 +293,7 @@ + global_install = true; + if (! user_prefix) + prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages"); +- archprefix = fullfile (octave_config_info ("libexecdir"), ++ archprefix = fullfile (octave_config_info ("libdir"), + "octave", "packages"); + endif + case available_actions +@@ -2211,14 +2211,13 @@ + endfunction + + function arch = getarch () +- persistent _arch = cstrcat (octave_config_info("canonical_host_type"), ... +- "-", octave_config_info("api_version")); ++ persistent _arch = octave_config_info("api_version"); + arch = _arch; + endfunction + + function archprefix = getarchprefix (desc, global_install) + if ((nargin == 2 && global_install) || (nargin < 2 && issuperuser ())) +- archprefix = fullfile (octave_config_info ("libexecdir"), "octave", ++ archprefix = fullfile (octave_config_info ("libdir"), "octave", + "packages", cstrcat(desc.name, "-", desc.version)); + else + archprefix = desc.dir; diff --git a/octave-3.4.0-pkgbuilddir.patch b/octave-3.4.0-pkgbuilddir.patch new file mode 100644 index 0000000..c6811dc --- /dev/null +++ b/octave-3.4.0-pkgbuilddir.patch @@ -0,0 +1,41 @@ +--- octave-3.4.0/scripts/pkg/pkg.m.pkgbuilddir 2011-02-08 03:00:51.000000000 -0700 ++++ octave-3.4.0/scripts/pkg/pkg.m 2011-03-18 09:31:24.670165643 -0600 +@@ -644,7 +644,14 @@ + for i = 1:length (files) + tgz = files{i}; + +- if (exist (tgz, "file")) ++ ## The filename pointed to an uncompressed package to begin with. ++ if (exist (tgz, "dir")) ++ if (tgz(1) == '/') ++ packdir = tgz; ++ else ++ packdir = fullfile (pwd(), tgz); ++ endif ++ elseif (exist (tgz, "file")) + ## Create a temporary directory. + tmpdir = tmpnam (); + tmpdirs{end+1} = tmpdir; +@@ -671,20 +678,12 @@ + if (length (dirlist) > 3) + error ("bundles of packages are not allowed"); + endif +- endif + +- ## The filename pointed to an uncompressed package to begin with. +- if (exist (tgz, "dir")) +- dirlist = {".", "..", tgz}; ++ ## The two first entries of dirlist are "." and "..". ++ packdir = fullfile (tmpdir, dirlist{3}); + endif + + if (exist (tgz, "file") || exist (tgz, "dir")) +- ## The two first entries of dirlist are "." and "..". +- if (exist (tgz, "file")) +- packdir = fullfile (tmpdir, dirlist{3}); +- else +- packdir = fullfile (pwd(), dirlist{3}); +- endif + packdirs{end+1} = packdir; + + ## Make sure the package contains necessary files. diff --git a/octave.spec b/octave.spec index b5977b7..47ccfc3 100644 --- a/octave.spec +++ b/octave.spec @@ -3,7 +3,7 @@ Name: octave Version: 3.4.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A high-level language for numerical computations Epoch: 6 Group: Applications/Engineering @@ -12,6 +12,11 @@ Source0: ftp://ftp.gnu.org/gnu/octave/octave-%{version}.tar.bz2 Source1: macros.octave # Add missing cstddef for gcc 4.6 Patch0: octave-3.4.0-gcc46.patch +# Use libdir instead of libexecdir +Patch1: octave-3.4.0-libdir.patch +# https://savannah.gnu.org/bugs/index.php?32839 +# Fix building packages from directories +Patch2: octave-3.4.0-pkgbuilddir.patch URL: http://www.octave.org BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -69,6 +74,8 @@ This package contains documentation for Octave. %prep %setup -q %patch0 -p1 -b .gcc46 +%patch1 -p1 -b .libdir +%patch2 -p1 -b .pkgbuilddir # Check that octave_api is set correctly if ! grep -q '^#define OCTAVE_API_VERSION "%{octave_api}"' src/version.h then @@ -99,10 +106,10 @@ rm -f %{buildroot}%{_infodir}/dir # Make library links mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d -echo "%{_libdir}/octave-%{version}" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/octave-%{_arch}.conf +echo "%{_libdir}/octave/%{version}" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/octave-%{_arch}.conf # Remove RPM_BUILD_ROOT from ls-R files -perl -pi -e "s,%{buildroot},," %{buildroot}%{_libexecdir}/%{name}/ls-R +perl -pi -e "s,%{buildroot},," %{buildroot}%{_libdir}/%{name}/ls-R perl -pi -e "s,%{buildroot},," %{buildroot}%{_datadir}/%{name}/ls-R # Make sure ls-R exists touch %{buildroot}%{_datadir}/%{name}/ls-R @@ -115,14 +122,66 @@ desktop-file-install --vendor fedora --remove-category Development --add-categor # Create directories for add-on packages HOST_TYPE=`%{buildroot}%{_bindir}/octave-config -p CANONICAL_HOST_TYPE` -mkdir -p %{buildroot}%{_libexecdir}/%{name}/site/oct/%{octave_api}/$HOST_TYPE -mkdir -p %{buildroot}%{_libexecdir}/%{name}/site/oct/$HOST_TYPE +mkdir -p %{buildroot}%{_libdir}/%{name}/site/oct/%{octave_api}/$HOST_TYPE +mkdir -p %{buildroot}%{_libdir}/%{name}/site/oct/$HOST_TYPE mkdir -p %{buildroot}%{_datadir}/%{name}/packages +mkdir -p %{buildroot}%{_libdir}/%{name}/packages touch %{buildroot}%{_datadir}/%{name}/octave_packages # work-around broken pre-linking (bug 524493) -install -d %{buildroot}%{_sysconfdir}/prelink.conf.d -echo "-b %{_bindir}/octave-%{version}" > %{buildroot}%{_sysconfdir}/prelink.conf.d/octave.conf +#install -d %{buildroot}%{_sysconfdir}/prelink.conf.d +#echo "-b %{_bindir}/octave-%{version}" > %{buildroot}%{_sysconfdir}/prelink.conf.d/octave.conf + +# Fix multilib installs +for include in config defaults oct-conf +do + mv %{buildroot}%{_includedir}/%{name}-%{version}/%{name}/${include}.h \ + %{buildroot}%{_includedir}/%{name}-%{version}/%{name}/${include}-%{__isa_bits}.h + cat > %{buildroot}%{_includedir}/%{name}-%{version}/%{name}/${include}.h < + +#if __WORDSIZE == 32 +#include "${include}-32.h" +#elif __WORDSIZE == 64 +#include "${include}-64.h" +#else +#error "Unknown word size" +#endif +EOF +done +for script in octave-config-%{version} mkoctfile-%{version} +do + mv %{buildroot}%{_bindir}/${script} %{buildroot}%{_libdir}/%{name}/%{version}/${script} + cat > %{buildroot}%{_bindir}/${script} < - 6:3.4.0-5 +- Use libdir instead of libexecdir +- Rename octave_pkg_preun macro +- Fix multilib installs +- Re-enable prelinking, seems to work +- Add patch to enable building packages from directories + * Wed Feb 23 2011 Orion Poplawski - 6:3.4.0-4 - Update rpm macros per FPC comments