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
This commit is contained in:
Orion Poplawski 2011-03-30 11:09:06 -06:00
parent 6948e3e45a
commit 265a73c346
4 changed files with 191 additions and 12 deletions

View File

@ -6,7 +6,7 @@
# Octave Package Directories # Octave Package Directories
%octshareprefix %{_datadir}/octave %octshareprefix %{_datadir}/octave
%octprefix %{octshareprefix}/packages %octprefix %{octshareprefix}/packages
%octarchprefix %{_libexecdir}/octave/packages %octarchprefix %{_libdir}/octave/packages
%octpkgdir %{octprefix}/%{octpkg}-%{version} %octpkgdir %{octprefix}/%{octpkg}-%{version}
%octpkglibdir %{octarchprefix}/%{octpkg}-%{version} %octpkglibdir %{octarchprefix}/%{octpkg}-%{version}
@ -14,7 +14,7 @@
%octave_cmd() octave -H -q --no-site-file --eval "%*"; %octave_cmd() octave -H -q --no-site-file --eval "%*";
# Build Source0 into a package tar file in a temporary location # 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 # 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 # 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 # preun script - we need to remove our uninstall protection and perhaps
# run the package's own uninstall script. # run the package's own uninstall script.
%_octave_pkg_preun \ %octave_pkg_preun \
rm %{octpkgdir}/packinfo/on_uninstall.m \ rm %{octpkgdir}/packinfo/on_uninstall.m \
if [ -e %{octpkgdir}/packinfo/on_uninstall.m.orig ]; then \ if [ -e %{octpkgdir}/packinfo/on_uninstall.m.orig ]; then \
mv %{octpkgdir}/packinfo/on_uninstall.m.orig %{octpkgdir}/packinfo/on_uninstall.m \ mv %{octpkgdir}/packinfo/on_uninstall.m.orig %{octpkgdir}/packinfo/on_uninstall.m \

72
octave-3.4.0-libdir.patch Normal file
View File

@ -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;

View File

@ -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.

View File

@ -3,7 +3,7 @@
Name: octave Name: octave
Version: 3.4.0 Version: 3.4.0
Release: 4%{?dist} Release: 5%{?dist}
Summary: A high-level language for numerical computations Summary: A high-level language for numerical computations
Epoch: 6 Epoch: 6
Group: Applications/Engineering Group: Applications/Engineering
@ -12,6 +12,11 @@ Source0: ftp://ftp.gnu.org/gnu/octave/octave-%{version}.tar.bz2
Source1: macros.octave Source1: macros.octave
# Add missing cstddef for gcc 4.6 # Add missing cstddef for gcc 4.6
Patch0: octave-3.4.0-gcc46.patch 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 URL: http://www.octave.org
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -69,6 +74,8 @@ This package contains documentation for Octave.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .gcc46 %patch0 -p1 -b .gcc46
%patch1 -p1 -b .libdir
%patch2 -p1 -b .pkgbuilddir
# Check that octave_api is set correctly # Check that octave_api is set correctly
if ! grep -q '^#define OCTAVE_API_VERSION "%{octave_api}"' src/version.h if ! grep -q '^#define OCTAVE_API_VERSION "%{octave_api}"' src/version.h
then then
@ -99,10 +106,10 @@ rm -f %{buildroot}%{_infodir}/dir
# Make library links # Make library links
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d 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 # 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 perl -pi -e "s,%{buildroot},," %{buildroot}%{_datadir}/%{name}/ls-R
# Make sure ls-R exists # Make sure ls-R exists
touch %{buildroot}%{_datadir}/%{name}/ls-R 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 # Create directories for add-on packages
HOST_TYPE=`%{buildroot}%{_bindir}/octave-config -p CANONICAL_HOST_TYPE` HOST_TYPE=`%{buildroot}%{_bindir}/octave-config -p CANONICAL_HOST_TYPE`
mkdir -p %{buildroot}%{_libexecdir}/%{name}/site/oct/%{octave_api}/$HOST_TYPE mkdir -p %{buildroot}%{_libdir}/%{name}/site/oct/%{octave_api}/$HOST_TYPE
mkdir -p %{buildroot}%{_libexecdir}/%{name}/site/oct/$HOST_TYPE mkdir -p %{buildroot}%{_libdir}/%{name}/site/oct/$HOST_TYPE
mkdir -p %{buildroot}%{_datadir}/%{name}/packages mkdir -p %{buildroot}%{_datadir}/%{name}/packages
mkdir -p %{buildroot}%{_libdir}/%{name}/packages
touch %{buildroot}%{_datadir}/%{name}/octave_packages touch %{buildroot}%{_datadir}/%{name}/octave_packages
# work-around broken pre-linking (bug 524493) # work-around broken pre-linking (bug 524493)
install -d %{buildroot}%{_sysconfdir}/prelink.conf.d #install -d %{buildroot}%{_sysconfdir}/prelink.conf.d
echo "-b %{_bindir}/octave-%{version}" > %{buildroot}%{_sysconfdir}/prelink.conf.d/octave.conf #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 <<EOF
#include <bits/wordsize.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} <<EOF
#!/bin/bash
ARCH=\$(uname -m)
case \$ARCH in
x86_64 | ia64 | s390x) LIB_DIR=/usr/lib64
SECONDARY_LIB_DIR=/usr/lib
;;
* )
LIB_DIR=/usr/lib
SECONDARY_LIB_DIR=/usr/lib64
;;
esac
if [ ! -x \$LIB_DIR/%{name}/%{version}/${script} ] ; then
if [ ! -x \$SECONDARY_LIB_DIR/%{name}/%{version}/${script} ] ; then
echo "Error: \$LIB_DIR/%{name}/%{version}/${script} not found"
if [ -d \$SECONDARY_LIB_DIR ] ; then
echo " and \$SECONDARY_LIB_DIR/%{name}/%{version}/${script} not found"
fi
exit 1
fi
LIB_DIR=\$SECONDARY_LIB_DIR
fi
exec \$LIB_DIR/%{name}/%{version}/${script} "\$@"
EOF
chmod +x %{buildroot}%{_bindir}/${script}
done
# remove timestamp from doc-cache
sed -i -e '/^# Created by Octave/d' %{buildroot}%{_datadir}/%{name}/%{version}/etc/doc-cache
# rpm macros # rpm macros
mkdir -p %{buildroot}%{_sysconfdir}/rpm mkdir -p %{buildroot}%{_sysconfdir}/rpm
@ -158,7 +217,7 @@ fi
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/octave-*.conf %config(noreplace) %{_sysconfdir}/ld.so.conf.d/octave-*.conf
%config(noreplace) %{_sysconfdir}/rpm/macros.octave %config(noreplace) %{_sysconfdir}/rpm/macros.octave
%{_bindir}/octave* %{_bindir}/octave*
%{_libdir}/octave-%{version}/ %{_libdir}/octave/
%{_libexecdir}/octave/ %{_libexecdir}/octave/
%{_mandir}/man1/octave*.1.* %{_mandir}/man1/octave*.1.*
%{_infodir}/liboctave.info* %{_infodir}/liboctave.info*
@ -172,7 +231,7 @@ fi
%ghost %{_datadir}/octave/octave_packages %ghost %{_datadir}/octave/octave_packages
%{_datadir}/octave/packages/ %{_datadir}/octave/packages/
%{_datadir}/octave/site/ %{_datadir}/octave/site/
%{_sysconfdir}/prelink.conf.d/octave.conf #%{_sysconfdir}/prelink.conf.d/octave.conf
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -189,6 +248,13 @@ fi
%changelog %changelog
* Fri Mar 18 2011 Orion Poplawski <orion[AT]cora.nwra com> - 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 <orion[AT]cora.nwra com> - 6:3.4.0-4 * Wed Feb 23 2011 Orion Poplawski <orion[AT]cora.nwra com> - 6:3.4.0-4
- Update rpm macros per FPC comments - Update rpm macros per FPC comments