add script to update all
[buildscripts] / emacs
1 #!/bin/bash -l
2 # Copyright (C) 2016 Ian Kelling
3
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
7
8 # http://www.apache.org/licenses/LICENSE-2.0
9
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.
15
16 set -eE -o pipefail
17 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
18
19 set -x
20 # arg = git commit to check out
21 # -r = don't recompile from scratch
22 # -u = update sources
23
24 # stop if any the command fails
25 update=false
26 recompile=true
27
28 while [[ $1 == -* ]]; do
29 case $1 in
30 -r) recompile=false; shift ;;
31 -u) update=true; shift ;;
32 --) break ;;
33 esac
34 done
35
36 export CFLAGS="-Og -g3"
37
38 # gawk and attr were no longer automatically installed in stretch
39 logq pi texlive hunspell git gawk attr
40 case $(distro-name) in
41 fedora )
42 # before i learned the builddep command, i identified these
43 # dependencies. Not sure if the builddep took care of them all
44 # gtk3-devel libXpm-devel libjpeg-turbo-devel libtiff-devel giflib-devel ncurses-devel gnutls-devel libxml2-devel libotf-devel GConf2-devel gpm-devel librsvg2-devel ImageMagick-devel m17n-lib-devel libselinux-devel
45
46 logq s yum-builddep -y emacs
47 logq pi texlive-dvipng
48 ;;&
49 debian|ubuntu)
50 # oddly, on ubuntu 14.04 this installs postfix, but I dun care
51 # ubuntu 14.04 gave this error message
52 # Unable to satisfy the build-depends: Build-Depends: libpng-dev
53 # this is satisfied by dvipng. the build-dep is just wrong
54 # minor bug I'm not going to bother reporting
55 logq p -y build-dep emacs
56 # fyi libmagick is broken right now because it uses a fork which is waiting for emacs to support it
57 # not sure how many of these are satisfied by the prev command,
58 # but from the log, it looks like none of them
59 logq pi libacl1-dev libselinux-dev libm17n-dev libgtk-3-dev \
60 librsvg2-dev libgpm-dev libgconf2-dev libotf-dev libxml2-dev \
61 automake1.11 libgnutls28-dev libncurses-dev libxpm-dev libjpeg-dev \
62 libgif-dev libtiff-dev texinfo dvipng
63 ;;&
64 debian)
65 # included in dependencies on other distros, todo, check on ubuntu
66 logq pi suckless-tools
67 ;;
68 esac
69
70
71
72 #building emacs, INSTALL.BZR
73
74 #git repo
75 dir=/a/opt/emacs-`distro-name``debian-archive`
76
77 if [[ ! -e $dir ]]; then
78 cp -r /a/opt/emacs $dir
79 recompile=true
80 fi
81 cd $dir
82
83 if $recompile; then
84 # todo, consider when this should be uncommented
85 #logq s make uninstall
86 find ~/.emacs.d/ -name '*.elc' -delete
87
88 # git version
89 if [[ $1 ]]; then
90 i clean -xxxfd
91 elif $update; then
92 i fetch
93 i clean -xxxffd
94 i reset --hard origin/master
95 i clean -xxxffd
96 fi
97
98 # autogen is usually only for the first build, assume it works
99 logq ./autogen.sh
100 # I tried changing O2 to O3, don't know if it made it faster or slower so I went back to 02.
101 # Also, link-time-optimization based on ./INSTALL
102
103 # for debugging, use -Og, or -O0 to make debug really correspond to sources
104 # dunno why I have had -std=gnu99 in the past
105 #CFLAGS='-std=gnu99 -g3 -Og'
106 export CFLAGS='-g3 -Og'
107 #CFLAGS='-std=gnu99 -g3 -O2' logq ./configure --enable-link-time-optimization
108 # on ubuntu 12.04, the above fails, says my c compiler won't work, so intead, just use defaults
109 logq ./configure
110 logq make -j `nproc` bootstrap
111 fi
112
113 # temporarily for testing multiple versions
114
115 logq sudo make install
116
117 # make emacs always work for root
118 s lnf /usr/local/bin/emacs /usr/bin
119
120
121
122 logq emacs --batch -l ~/.emacs.d/init.el -l ~/.emacs.d/compile-init-dir.el
123
124 # not keeping up with the latest org-mode development
125 #~/bin/buildscripts/org-mode
126
127 if $update; then
128 logq pi bzr
129 cd ~/.emacs.d/src/mediawiki-el
130 bzr pull
131 fi
132
133
134 # not keeping up with the latest gnus development.
135 # # instructions from the README
136 # # the byte-recompile-directory seems to compile gnus,
137 # # but gnus complains that it should be compiled when it starts
138 # cd ~/.emacs.d/src/gnus
139 # if [[ $1 == *u* ]]; then
140 # i pull
141 # fi
142 # logq ./configure
143 # logq make