mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 15:00:45 -08:00
243 lines
7.3 KiB
Bash
Executable file
243 lines
7.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Copyright (C) 2008 Free Software Foundation, Inc.
|
|
|
|
# This file is part of GNU Emacs.
|
|
|
|
# GNU Emacs is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# GNU Emacs is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
# This script configures and builds Emacs to the subdirectory ./build .
|
|
#
|
|
# If --shared-lisp 'install_prefix' is given, lisp files will be installed to
|
|
# install_prefix/share/emacs/23.0.0. This option must be run with 'sudo'.
|
|
#
|
|
# Otherwise (default) lisp will be installed under Emacs.app/Contents/Resources.
|
|
# It does this by configuring it to install there, and running "make install".
|
|
#
|
|
# Some setup is different for GNUstep vs. Cocoa, and it determines which one
|
|
# it's on using 'uname'.
|
|
|
|
# After it is run, Emacs can be run directly from the .app, which itself
|
|
# can be placed anywhere.
|
|
|
|
# Further C development can be done using Xcode on OS X (not tested recently),
|
|
# or by typing './remake' in the '../src' directory. Further Lisp
|
|
# development can be done by either copying the files you modify
|
|
# into install location, or running this script again.
|
|
|
|
|
|
# Set up path and config variables.
|
|
|
|
PREFIX=""
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--shared-lisp=*)
|
|
PREFIX=`echo "$1" | sed s/--shared-lisp=//`
|
|
shift
|
|
;;
|
|
--enable-local-lisp-path=*)
|
|
locallisppath=`echo "$1" | sed s/--enable-local-lisp-path=//`
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Usage: $0 [--shared-lisp='install_root' --enable-local-lisp-path='some path(s)']"
|
|
exit
|
|
esac
|
|
done
|
|
|
|
DISTDIR=`pwd`/..
|
|
|
|
#OPTFLAGS='-g -O2'
|
|
OPTFLAGS='-g'
|
|
|
|
# MAC OS X
|
|
if [ `uname` == "Darwin" ]; then
|
|
BASEDIR=`pwd`/build/Emacs.app/Contents
|
|
BINDIR=${BASEDIR}/MacOS
|
|
if [ "x$PREFIX" == "x" ]; then
|
|
PREFIX=${BASEDIR}/Resources
|
|
fi
|
|
# If you want to try experimental enhanced Ctrl-g support, add to NS_CFG_OPTS:
|
|
# --enable-cocoa-experimental-ctrl-g
|
|
# (See bottom of USAGE.txt)
|
|
NS_CFG_OPTS="--with-ns --without-x --without-freetype --prefix=${PREFIX} --exec_prefix=${BASEDIR}/MacOS --libexecdir=${BASEDIR}/MacOS/libexec"
|
|
# --enable-cocoa-experimental-ctrl-g"
|
|
# MAKE="make -j3"
|
|
steve=`/usr/sbin/sysctl hw.ncpu | awk '{print $NF}'`
|
|
MAKE="make -j`expr $steve + 1`"
|
|
export CC=gcc-4.0
|
|
export MACOSX_DEPLOYMENT_TARGET=10.3
|
|
export MACOSX_DEPLOYMENT_TARGET_ppc=10.3
|
|
export MACOSX_DEPLOYMENT_TARGET_i386=10.4
|
|
export CFLAGS="$OPTFLAGS -arch ppc -arch i386"
|
|
# -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk
|
|
# -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
|
|
|
|
# GNUSTEP
|
|
else
|
|
|
|
# Currently must pass three dirs into Make process via environment variables.
|
|
source /etc/GNUstep/GNUstep.conf
|
|
if [ "x$GNUSTEP_MAKEFILES" == "x" ]; then
|
|
if [ "x$GNUSTEP_SYSTEM_ROOT" == "x" ]; then
|
|
echo "Failed to obtain any useful information from /etc/GNUstep/GNUstep.conf."
|
|
echo "Please make sure GNUstep is installed on your system."
|
|
exit
|
|
fi
|
|
GNUSTEP_MAKEFILES=${GNUSTEP_SYSTEM_ROOT}/Library/Makefiles
|
|
GNUSTEP_SYSTEM_HEADERS=${GNUSTEP_SYSTEM_ROOT}/Library/Headers
|
|
GNUSTEP_SYSTEM_LIBRARIES=${GNUSTEP_SYSTEM_ROOT}/Library/Libraries
|
|
fi
|
|
export GNUSTEP_MAKEFILES
|
|
export GNUSTEP_SYSTEM_HEADERS
|
|
export GNUSTEP_SYSTEM_LIBRARIES
|
|
|
|
BASEDIR=`pwd`/build/Emacs.app
|
|
BINDIR=${BASEDIR}
|
|
if [ "x${PREFIX}" == "x" ]; then
|
|
PREFIX=${BASEDIR}/Resources
|
|
fi
|
|
NS_CFG_OPTS="--with-ns --without-x --without-freetype --prefix=${PREFIX} --exec-prefix=${BASEDIR} --libexecdir=${BASEDIR}/libexec"
|
|
# --enable-cocoa-experimental-ctrl-g
|
|
|
|
if [ "x$MAKE" == "x" ]; then
|
|
if [ "`gmake 2>&1`" == "gmake: *** No targets specified and no makefile found. Stop." ]; then
|
|
MAKE=gmake
|
|
else
|
|
MAKE=make
|
|
fi
|
|
export MAKE
|
|
CFLAGS="$OPTFLAGS"
|
|
export CFLAGS
|
|
fi
|
|
|
|
# PENDING: Not sure why this is needed
|
|
export EMACSLOADPATH="${DISTDIR}/lisp:${DISTDIR}/lisp/emacs-lisp:${DISTDIR}/leim"
|
|
fi
|
|
|
|
# End variable setup.
|
|
###############################################################################
|
|
|
|
# Prepare a clean slate
|
|
rm -fr build/Emacs.app
|
|
|
|
# Configure if needed
|
|
cd ..
|
|
if [ ! -f Makefile ]; then
|
|
echo "./configure ${NS_CFG_OPTS}"
|
|
./configure <<EOF ${NS_CFG_OPTS}
|
|
EOF
|
|
# ./configure ${NS_CFG_OPTS}
|
|
if [ $? != 0 ]; then
|
|
echo "*** Configure run failed. ***"
|
|
echo "Please examine the above output to determine what went wrong,"
|
|
echo "edit this script (\'compile\') to fix it, and rerun."
|
|
# These are written BEFORE the job is compete, then it won't get done
|
|
# next time, causing errors about CTLau-b5, tsang-b5, PY, etc..
|
|
rm -f leim/changed.misc leim/changed.tit
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Pete's addition for local lisp load-path
|
|
if [ "x$locallisppath" != "x" ]; then
|
|
echo " * Local lisp path is being enabled"
|
|
(cd src
|
|
if [ -r epaths.h-orig ]; then
|
|
# mv ../src/epaths.h-orig ../src/epaths.h
|
|
echo "### src/epaths.h-orig already exists, no further change ###"
|
|
else
|
|
mv epaths.h epaths.h-orig
|
|
printf "s,\(#define PATH_LOADSEARCH \"\),\\\1%s:,\n" "$
|
|
{locallisppath}" > locallisppath.sed
|
|
cat epaths.h-orig | sed -f locallisppath.sed > epaths.h
|
|
rm locallisppath.sed
|
|
fi)
|
|
fi
|
|
|
|
# Clean up to avoid DOC-xxx and emacs-xxx out-of-controlness
|
|
rm -f ../etc/DOC-* ../src/emacs-*
|
|
|
|
|
|
# Go (installs binaries to ./build/Emacs.app, lisp to there or PREFIX)
|
|
echo "make install"
|
|
$MAKE
|
|
status=$?
|
|
|
|
if [ -f src/epaths.h-orig ]; then
|
|
mv src/epaths.h-orig src/epaths.h
|
|
fi
|
|
|
|
if [ $status != 0 ]; then
|
|
echo "*** Compilation failed. ***"
|
|
echo "Please examine the above output to determine what went wrong,"
|
|
echo "edit the configure options in this script (\'compile\') to fix it, and rerun."
|
|
# rm -f leim/changed.misc leim/changed.tit
|
|
exit 1
|
|
fi
|
|
|
|
$MAKE install
|
|
if [ $? != 0 ]; then
|
|
echo "*** Compilation succeeded, but .app assembly failed. ***"
|
|
echo "Please examine the above output to determine what went wrong,"
|
|
echo "edit the configure options in this script (\'compile\') to fix it, and rerun."
|
|
# rm -f leim/changed.misc leim/changed.tit
|
|
exit 1
|
|
fi
|
|
|
|
# Move version stuff up to Resources
|
|
cd ${BASEDIR}/Resources
|
|
if [ -d share/emacs ]; then
|
|
# clean up self-contained build
|
|
mv -f share/emacs/*/* .
|
|
fi
|
|
|
|
if [ ! -d info ]; then
|
|
# happens on GNUstep, not OS X
|
|
mv -f share/info .
|
|
fi
|
|
rm -fr share
|
|
|
|
# Get rid of .el.gz when .elc is present.. purists will complain, but this
|
|
# knocks the app size down substantially.
|
|
cd lisp
|
|
#for f in `find . -name '*.elc' -print | sed -e s/.elc/.{el,el.gz}/`
|
|
#do
|
|
# rm -f $f
|
|
#done
|
|
|
|
# Bin cleanup
|
|
cd $BINDIR/bin
|
|
rm -f emacs emacs-23*
|
|
|
|
# Move libexec stuff up, and link it from bin
|
|
cd ../libexec
|
|
mv -f emacs/*/*/* .
|
|
rm -fr emacs
|
|
cd ../bin
|
|
ln -sf ../libexec/* .
|
|
|
|
# On OS X, install the bundled ispell
|
|
#if [ `uname` == "Darwin" ]; then
|
|
# cd $DISTDIR
|
|
# cp ispell-3.3.01/bin/ispell* ${BINDIR}/libexec
|
|
# cp -R ispell-3.3.01/lib ${BINDIR}/libexec
|
|
#fi
|
|
|
|
echo ""
|
|
echo "Build successful."
|
|
echo ""
|
|
|
|
# arch-tag: 1fda51a1-d908-4e60-ad5e-47ffbb39f18d
|