-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-emacs.sh
executable file
·109 lines (92 loc) · 2.8 KB
/
build-emacs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env bash
# -*- mode: shell-script; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# Copyright (C) 2020 coldnew's personal project
# Authored-by: Yen-Chin, Lee <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Get where is this script
SDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Configration
INSDIR="${SDIR}/build"
SRCDIR="${SDIR}/emacs"
################################################################################
# Any subsequent(*) commands which fail will cause the shell script to exit immediately
set -e
################################################################################
do_autogen () {
./autogen.sh
}
do_configure_cli () {
./configure --prefix=${INSDIR} --with-modules --with-libgmp \
--without-x \
--without-ns \
--with-nativecomp
}
do_configure_linux () {
./configure --prefix=${INSDIR} --with-modules --with-libgmp \
--without-ns --disable-ns-self-contained \
--with-x --with-x-toolkit=gtk3 \
--with-nativecomp
}
do_make () {
# make bootstrap
make -j9
}
do_install () {
make install
}
do_clean () {
make distclean
make mantainer-clean
}
################################################################################
# check if submodule already exist
if [ ! -d $SRCDIR/src ]; then
git submodule init
git submodule update
fi
# building emacs
cd $SRCDIR
# check commit id, if already build, it's no need to rebuild
if [ -f "$INSDIR/commit-id" ]; then
OLD_ID=$(cat "$INSDIR/commit-id")
NEW_ID=$(git rev-parse --short HEAD)
if [ $OLD_ID == $NEW_ID ]; then
echo "Your emacs is match to commit-id, no need to rebuild."
exit 0 # quit
else
echo -ne "$NEW_ID" > "$INSDIR/commit-id"
echo "Start rebuilding emacs..."
fi
fi
do_autogen
# configure according to platform
if [[ $CI == "true" ]]; then
do_configure_cli
else
case $(uname) in
"Linux")
do_configure_linux
;;
*)
echo "This building script only support Linux"
exit -1
;;
esac
fi
# You need to set --with-modules to enable dynamic modules feature
do_make
do_install