refactored emacs

This commit is contained in:
Gwenhael Le Moine 2017-12-04 12:23:52 +01:00
parent d244204e2e
commit 253b1928bf
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -27,53 +27,39 @@
# Modified by Patrick Volkerding <volkerdi@slackware.com> # Modified by Patrick Volkerding <volkerdi@slackware.com>
# Modified by Gwenhael Le Moine <gwenhael.le.moine@gmail.com> # Modified by Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
ONLY_X11=${ONLY_X11:=YES} CWD=$(pwd)
X_TOOLKIT=${X_TOOLKIT:=lucid}
PRGNAM=emacs PRGNAM=emacs
BRANCH=${BRANCH:=trunk}
VERSION=${VERSION:-$(date +"%Y.%m.%d_%H.%M")} VERSION=${VERSION:-$(date +"%Y.%m.%d_%H.%M")}
ARCH=${ARCH:-$(uname -m)} ARCH=${ARCH:-$(uname -m)}
NUMJOBS=${NUMJOBS:-" -j3 "} NUMJOBS=${NUMJOBS:-" -j3 "}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
fi
CWD=$(pwd)
TAG=cyco TAG=cyco
OUTPUT=/tmp OUTPUT=/tmp
TMP=${TMP:-/tmp/$TAG} TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/pkg-$PRGNAM PKG=$TMP/pkg-$PRGNAM
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
SLKCFLAGS="-O2 -fPIC"
X_TOOLKIT=${X_TOOLKIT:=lucid}
rm -rf $PKG rm -rf $PKG
mkdir -p $TMP $PKG mkdir -p $TMP $PKG
cd $TMP cd $TMP
rm -rf $PRGNAM rm -rf $PRGNAM
if [ ! -e $CWD/$PRGNAM-$VERSION.tar.?z* ] ; then [ ! -e $REPOSITORY ] && git clone git://git.savannah.gnu.org/emacs.git $REPOSITORY
[ ! -e $REPOSITORY ] && git clone git://git.savannah.gnu.org/emacs.git $REPOSITORY
( cd $REPOSITORY ( cd $REPOSITORY
git pull git pull
[ -e Makefile ] && make distclean [ -e Makefile ] && make distclean
) )
VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )" VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
cd $TMP cd $TMP
mkdir -p $TMP/$PRGNAM mkdir -p $TMP/$PRGNAM
SRCDIR=$REPOSITORY SRCDIR=$REPOSITORY
else
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* || exit 1
SRCDIR=.
fi
cd $PRGNAM || exit 1 cd $PRGNAM || exit 1
chown -R root:root . chown -R root:root .
@ -87,7 +73,7 @@ find . \
./autogen.sh ./autogen.sh
) )
EMACS_VERSION=$(grep "AC_INIT(GNU Emacs," $SRCDIR/configure.ac | sed 's|AC_INIT(GNU Emacs, \([0-9.]*\), bug-gnu-emacs@gnu.org)|\1|') EMACS_VERSION=$(grep "AC_INIT(GNU Emacs," $SRCDIR/configure.ac | cut -d, -f 2 | tr -d \ )
CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \
@ -114,58 +100,15 @@ make install DESTDIR=$PKG || exit 1
( cd $PKG/usr/bin ( cd $PKG/usr/bin
rm emacs rm emacs
mv emacs-${EMACS_VERSION} emacs-${EMACS_VERSION}-with-x11 mv emacs-${EMACS_VERSION} emacs-${EMACS_VERSION}-with-x11
cat <<EOF > $PKG/usr/bin/emacs ln -s emacs-${EMACS_VERSION}-with-x11 emacs
#!/bin/sh # cat <<EOF > $PKG/usr/bin/emacs
# #!/bin/sh
XMODIFIERS= GTK_IM_MODULE= QT_IM_MODULE= /usr/bin/emacs-${EMACS_VERSION}-with-x11 "\$@" # XMODIFIERS= GTK_IM_MODULE= QT_IM_MODULE= /usr/bin/emacs-${EMACS_VERSION}-with-x11 "\$@"
EOF # EOF
chmod +x $PKG/usr/bin/emacs # chmod +x $PKG/usr/bin/emacs
) )
if [ ! "x$ONLY_X11" == "xYES" ] ; then
# Also add a version of the binary that is not linked to X11:
cd $TMP
rm -rf $PRGNAM
if [ ! -e $CWD/$PRGNAM-$VERSION.tar.?z* ] ; then
[ -e $TMP/$PRGNAM ] && rm -fr $TMP/$PRGNAM
mkdir -p $TMP/$PRGNAM
SRCDIR=$REPOSITORY/$BRANCH
else
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* || exit 1
SRCDIR=.
fi
cd $PRGNAM || exit 1
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 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
$SRCDIR/configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--program-prefix="" \
--program-suffix="" \
--mandir=/usr/man \
--infodir=/usr/info \
--with-x=no \
--without-gconf \
--with-compress-install \
--build=${ARCH}-slackware-linux
make $NUMJOBS || make || exit 1
# Install the non-x version:
cat src/emacs > $PKG/usr/bin/emacs-${EMACS_VERSION}-no-x11
chown root:root $PKG/usr/bin/emacs-${EMACS_VERSION}-no-x11
chmod 1755 $PKG/usr/bin/emacs-${EMACS_VERSION}-no-x11
fi
# I don't care for broken permissions. # I don't care for broken permissions.
chmod 755 $PKG/var/games/emacs chmod 755 $PKG/var/games/emacs
chown -R games:root $PKG/var/games/emacs chown -R games:root $PKG/var/games/emacs