2 # Copyright (C) 2016 Ian Kelling
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 if [[ -s ~
/.bashrc
]];then . ~
/.bashrc
;fi
19 # arg = git commit to check out
26 while [[ $1 == -* ]]; do
28 -b) bootstrap
=true
; recompile
=true
;;
30 --no-r) recompile
=false
;;
34 *) echo "$0: error: bad arg: $1" >&2; exit 1 ;;
40 # Og = optmize, but keep gdb working
41 export CFLAGS
="-Og -g3"
43 export DEBIAN_FRONTEND
=noninteractive
46 if apt-cache showsrc emacs
$x 2>/dev
/null |
grep .
&>/dev
/null
; then
53 pkgs
=(gawk attr autoconf-archive git install-info
)
54 ##### warning, apt-rdepends seems to look at the newest version of the package,
55 ##### not the one that build-dep would install.
58 for x
in $latest_emacs maildir-utils
; do
59 # todo, this gives fake provided packages like mailx, and then
61 # https://askubuntu.com/questions/21379/how-do-i-find-the-build-dependencies-of-a-package
62 if ! type -p apt-rdepends
&>/dev
/null
; then
63 sudo apt-get
-y install --purge --auto-remove apt-rdepends
65 apt-rdepends
-p --build-depends --follow=DEPENDS
$x/$
(debian-codename
)|
sed -rn 's/^\s*Build-Depends: (\S+).*/\1/p'
71 #building emacs, INSTALL.BZR
75 dir
=/a
/opt
/emacs-$
(distro-name
)$
(distro-num
)
76 last_build
=$dir/iank-emacs-build
78 # e/e because autofs failing to mount will make it so
79 # you cant ls whatever directory it is in, so we
80 # need an extra directory
81 dirs=($dir $dir-nox/.iank
/e
/e
)
85 rev=$
(cat $last_build 2>/dev
/null
) ||
:
86 head=$
(git rev-parse HEAD
)
88 if ! $recompile && [[ $rev == "$head" ]]; then
89 echo "already compiled, exiting"
93 if [[ ! -e $dir ||
$rev != "$head" ]]; then
94 m
cp -ar /a
/opt
/emacs
$dir
99 # gawk and attr were no longer automatically installed in stretch,
100 # looking back, i assume i got some error.
101 # autoconf-archive due to come error
105 case $
(distro-name
) in
107 logq s yum-builddep
-y emacs
108 logq pi texlive-dvipng
110 debian|ubuntu|trisquel
)
111 # todo: unknown for other distros, this will fail
112 logq p
-y build-dep maildir-utils
/$
(debian-codename
)
113 # oddly, on ubuntu 14.04 this installs postfix, but I dun care
114 # ubuntu 14.04 gave this error message
115 # Unable to satisfy the build-depends: Build-Depends: libpng-dev
116 # this is satisfied by dvipng. the build-dep is just wrong
117 # minor bug I'm not going to bother reporting.
119 # note, useful command to see build dep packagages:
120 # apt-rdepends --build-depends --follow=DEPENDS emacs25
121 logq p
-y build-dep
$latest_emacs
127 for d
in ${dirs[@]}; do
133 m rsync
--delete -ra $dir/ $d
135 if mountpoint
$mp &>/dev
/null
; then
139 m sudo mount
-o bind $d $mp
140 m sudo chown
$USER:$USER $mp
143 if $recompile ||
[[ ! -e configure
]]; then
144 # todo, consider when this should be uncommented
145 #logq s make uninstall
146 m
find ~
/.emacs.d
/ -name '*.elc' -delete
154 m i
reset --hard origin
/master
157 # autogen is usually only for the first build, assume it works
158 logq .
/autogen.sh all
159 # I tried changing O2 to O3, don't know if it made it faster or slower so I went back to 02.
160 # Also, link-time-optimization based on ./INSTALL
162 # for debugging, use -Og, or -O0 to make debug really correspond to sources
163 # dunno why I have had -std=gnu99 in the past
164 #CFLAGS='-std=gnu99 -g3 -Og'
165 export CFLAGS
='-g3 -Og'
166 #CFLAGS='-std=gnu99 -g3 -O2' logq ./configure --enable-link-time-optimization
167 # on ubuntu 12.04, the above fails, says my c compiler won't work, so intead, just use defaults
170 # mix of flags from arch and debians build flags
171 # note, youd think we could just run make again, but the
172 # build system isnt smart enough, we have to recompile
174 logq .
/configure
--without-x --without-sound --without-gsettings --without-gconf
180 logq
make -j `nproc` bootstrap
185 logq sudo
make install
186 # make emacs always work for root
187 sudo
/a
/exe
/lnf
/usr
/local
/bin
/emacs
/usr
/bin
189 echo $head >$last_build
194 #git clone https://github.com/djcb/mu
195 # note: master failed on t8, i moved back to the commit before a bug
196 # https://github.com/djcb/mu/issues/1400
197 # from its HACKING file
202 last_build
=$PWD/iank-mu-build
204 rev=$
(cat $last_build 2>/dev
/null
) ||
:
205 head=$
(git rev-parse HEAD
)
206 if $recompile ||
[[ $rev != "$head" ]]; then
208 if [[ $
(debian-codename
) == flidas
]]; then
209 # use the flidas branch, stuck behind because
210 # needs newer crypt libraries that are too troublesome.
213 # newer version than build-dep installs for buster
214 sudo apt-get
-y install --purge --auto-remove libgmime-3.0
-dev
220 echo $head >~
/.local
/mu-build-git-revision
221 # note uninstall is implemented
225 # note, not totally sure its right to put this within recompile, but its taking up most of the time, so going for it.
226 logq emacs
--batch -l ~
/.emacs.d
/compile-init-dir.el
229 # as of 01-2017, built-in org mode has a bug that
230 # org-edit-src-exit does not get bound, so using latest
231 #/a/bin/buildscripts/org-mode
233 # disabled as i haven't used it in a while
236 # cd ~/.emacs.d/src/mediawiki-el
241 # not keeping up with the latest gnus development.
242 # # instructions from the README
243 # # the byte-recompile-directory seems to compile gnus,
244 # # but gnus complains that it should be compiled when it starts
245 # cd ~/.emacs.d/src/gnus
246 # if [[ $1 == *u* ]]; then