slackbuilds/a/grub2/grub2.SlackBuild
Gwenhael Le moine 17345fc6e1 add a/grub2, stolen from http://github.com/abrouwers/ajb_slackbuilds/tree/master/grub/ ^_^
Signed-off-by: Gwenhael Le moine <gwenhael.le.moine@gmail.com>
2009-12-01 20:28:33 +07:00

129 lines
4.1 KiB
Bash
Executable file

#!/bin/sh
# Copyright 2009 Andrew Brouwers, abrouwers.gmail.com
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Based on Pat's slackbuild from 13.0
PKGNAM=grub
VERSION=1.97.1
ARCH=${ARCH:-x86_64}
BUILD=1cyco
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
rm -rf $PKG
mkdir -p $TMP $PKG
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2"
fi
cd $TMP
rm -rf ${PKGNAM}-${VERSION}
tar xzvf $CWD/${PKGNAM}-${VERSION}.tar.gz
cd ${PKGNAM}-${VERSION}
# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# /usr/share seems appropriate grub's files, so we'll append it to --libdir
CFLAGS="${SLKCFLAGS}" \
./configure \
--prefix=/usr \
--libdir=/usr/share \
--infodir=/usr/info \
--mandir=/usr/man \
--sbindir=/sbin \
--sysconfdir=/etc
make || exit 1
make install DESTDIR=$PKG || exit 1
[ -e $CWD/50_cycojesus ] && cp $CWD/50_cycojesus $PKG/etc/grub.d/ && chmod +x $PKG/etc/grub.d/$CWD/50_cycojesus
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
for manpagedir in $(find . -type d -name "man*") ; do
( cd $manpagedir
for eachpage in $( find . -type l -maxdepth 1) ; do
ln -s $( readlink $eachpage ).gz $eachpage.gz
rm $eachpage
done
gzip -9 *.?
)
done
)
fi
# Compress info pages and purge "dir" file from the package:
if [ -d $PKG/usr/info ]; then
( cd $PKG/usr/info
rm -f dir
gzip -9 *
)
fi
mkdir -p $PKG/usr/doc/grub-$VERSION
cp -a \
AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO \
$PKG/usr/doc/grub-$VERSION
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
grub: grub (GNU GRUB bootloader)
grub:
grub: This is the next-generation GRUB bootloader. Grub2 has been
grub: re-written from scratch to clean up everything from modularity
grub: and portability. It features support for scripting, themes,
grub: real memory-management, rescue mode, and various other improvements
grub: over grub-legacy.
grub:
grub: Visit the homepage: http://www.gnu.org/software/grub/grub-2.en.html
grub:
EOF
cd $PKG
makepkg -l y -c n $TMP/grub-$VERSION-$ARCH-$BUILD.txz