emacs.build 1.14 KB
Newer Older
gsell's avatar
gsell committed
1 2
#!/bin/bash

3
source "$(dirname $0)/../../lib/libem.bash"
gsell's avatar
gsell committed
4

5 6
module use 'Libraries'

7
build_dependencies="${COMPILER} libungif tiff"
gsell's avatar
gsell committed
8 9 10 11

case ${OS} in
Darwin )
	configure_args='--with-ns'
12
	build_dependencies="libungif tiff"
gsell's avatar
gsell committed
13 14 15 16 17 18
	CC=''
	CXX=''
	COMPILER=''
	COMPILER_VERSION=''
	function em.post_install() {
		mkdir -p "${PREFIX}"
19
		cp -rv "${MODULE_BUILDDIR}"/nextstep/Emacs.app "${PREFIX}"
gsell's avatar
gsell committed
20 21 22 23 24 25 26
	}
	;;
*)
	;;
esac

function em.configure() {
27
	"${MODULE_SRCDIR}"/configure \
gsell's avatar
gsell committed
28 29 30 31 32
		--prefix="${PREFIX}" \
		${configure_args} \
		|| exit 1
}

33
function em.post_install() {
34
	mkdir "${PREFIX}/bin"
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
	cat > "${PREFIX}/bin/Emacs" <<\EOF
#!/bin/bash

declare -r OS=$(uname -s)

if [[ "${OS}" == "Darwin" ]]; then
	open "${EMACS_DIR}/Emacs.app" --args "$@"
else
	"${EMACS_DIR}/bin/emacs" "$@"
fi
EOF

	cat > "${PREFIX}/bin/Emacsclient" <<\EOF
#!/bin/bash

declare -r OS=$(uname -s)

if [[ "${OS}" == "Darwin" ]]; then
	"${EMACS_DIR}/Emacs.app/Contents/MacOS/bin/emacsclient" -c "$@"
else
	"${EMACS_DIR}/bin/emacsclient" -c "$@" &
fi
EOF

	chmod 0755 "${PREFIX}/bin/Emacs"
	chmod 0755 "${PREFIX}/bin/Emacsclient"
}

gsell's avatar
gsell committed
63
em.add_to_family 'Tools'
gsell's avatar
gsell committed
64 65 66
em.set_build_dependencies ${build_dependencies}
em.make_all