-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
299 lines (241 loc) · 9.42 KB
/
Makefile
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
ifneq (,$(realpath /usr/bin/dpkg))
OS=Debianish
INSTALL_CMD=sudo apt install -y
else ifneq (,$(realpath /usr/bin/dnf))
OS=Fedora
INSTALL_CMD=sudo dnf install -y
else
$(error Could not find dpkg or dnf)
endif
EXECUTABLE_NAMES = /tmux /seafile-applet /git /fish /pass /vlc /htop /kitty /compton /dunst /nitrogen /offlineimap /lollypop /flac /oggenc /picard /gimp /npm /chromium-browser /jq /ledger /curl /sqlite3 /stalonetray /i3lock /psql /javac /rg /virtualenv /syncthing /pip3 /dot /latex /xelatex /dvipng /scrot /biber /R /black /stellarium /pipenv /anki /inkscape /mvn /nmap /weechat /calibre /meson /hugin
SBIN_EXECUTABLE_NAMES = /tlp
EXECUTABLES = $(EXECUTABLE_NAMES:/%=/usr/bin/%)
SBIN_EXECUTABES = $(SBIN_EXECUTABLE_NAMES:/%=/usr/sbin/%)
NPM_EXECUTABLES = /tsc /eslint /prettier
NPM_BINARIES = $(NPM_EXECUTABLES:/%=${HOME}/.local/bin/%)
X_TOUCHPAD_CONFIGURATION = /etc/X11/xorg.conf.d/50-touchpad.conf
LOCAL = ${HOME}/.local
CARGO_LOCAL = ${HOME}/.cargo
XMONAD = ${LOCAL}/bin/xmonad
XMONAD_REPO = xmonad/xmonad
XMOBAR_REPO = xmonad/xmobar
XMONAD_CONTRIB_REPO = xmonad/xmonad-contrib
XMOBAR_CONFIG = ~/.xmobarrc
EMACS_CONFIG = ~/.emacs.d
FISH_CONFIG = ~/.config/fish/config.fish
GIT_CONFIG = ~/.gitconfig
OFFLINEIMAPRC = ~/.offlineimaprc
OFFLINEIMAPPY = ~/.offlineimap.py
KITTY_CONFIG = ~/.config/kitty/kitty.conf
DUNST_CONFIG = ~/.config/dunst/dunstrc
XMONAD_CONFIG = ~/.xmonad
STACK = /usr/local/bin/stack
FOREIGN_SOURCE = ~/var/src
MU = ${LOCAL}/bin/mu
MU_REPOSITORY = ${FOREIGN_SOURCE}/mu
EMACS = ${LOCAL}/bin/emacs
EMACS_REPOSITORY = ${FOREIGN_SOURCE}/emacs
XMONAD_XSESSION = /usr/share/xsessions/xmonad.desktop
XMONAD_START_FILE = ${LOCAL}/bin/start-xmonad
RUST = ${HOME}/.cargo/bin/rustc
WASM_PACK = ${HOME}/.cargo/bin/wasm-pack
CARGO_GENERATE = ${HOME}/.cargo/bin/cargo-generate
RUST_ANALYZER = ${HOME}/.local/bin/rust-analyzer
FONTS = ${HOME}/.fonts
FIRA_CODE = ${FONTS}/FiraCode
FIRA_GO = ${FONTS}/FiraGo
BITTER = ${FONTS}/Bitter
HLEDGER = ${LOCAL}/bin/hledger
NPM_PREFIX = npm set prefix ${LOCAL}
ALACRITTY = ${CARGO_LOCAL}/bin/alacritty
FD = ${CARGO_LOCAL}/bin/fd
CASK = ${LOCAL}/bin/cask
.PHONY: install
install: links ${EXECUTABLES} ${SBIN_EXECUTABLES} ${FOREIGN_SOURCE} ${XMONAD} ${EMACS} ${MU} ${XMONAD_XSESSION} ${XMONAD_START_FILE} ${X_TOUCHPAD_CONFIGURATION} ${RUST} ${WASM_PACK} ${CARGO_GENERATE} ${RUST_ANALYZER} ${FIRA_CODE} ${FIRA_GO} ${NPM_BINARIES} ${BITTER} ${HLEDGER} ${ALACRITTY} ${FD}
${X_TOUCHPAD_CONFIGURATION}:
sudo mkdir -p $$(dirname ${X_TOUCHPAD_CONFIGURATION})
sudo cp 50-touchpad.conf ${X_TOUCHPAD_CONFIGURATION}
ifeq (${OS},Fedora)
CHROMIUM_PACKAGE=chromium
else
CHROMIUM_PACKAGE=chromium-browser
endif
/usr/bin/chromium-browser:
${INSTALL_CMD} ${CHROMIUM_BROWSER}
/usr/bin/oggenc:
${INSTALL_CMD} vorbis-tools
ifeq (${OS},Fedora)
SEAFILE_PACKAGE=chromium
else
SEAFILE_PACKAGE=chromium-browser
endif
/usr/bin/seafile-applet:
${INSTALL_CMD} ${SEAFILE_PACKAGE}
/usr/bin/psql:
${INSTALL_CMD} postgresql-client
/usr/bin/javac:
${INSTALL_CMD} openjdk-14-jdk
/usr/bin/rg:
${INSTALL_CMD} ripgrep
/usr/bin/virtualenv:
${INSTALL_CMD} python3-virtualenv
/usr/bin/syncthing:
ifeq (${OS},Fedora)
else
sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
printf "Package: *\nPin: origin apt.syncthing.net\nPin-Priority: 990\n" | sudo tee /etc/apt/preferences.d/syncthing
sudo apt update
endif
${INSTALL_CMD} syncthing
/usr/bin/pip3:
${INSTALL_CMD} python3-pip python3-dev
/usr/bin/dot:
${INSTALL_CMD} graphviz
/usr/bin/latex:
${INSTALL_CMD} texlive
/usr/bin/xelatex:
${INSTALL_CMD} texlive-xetex texlive-fonts-extra
/usr/bin/R:
${INSTALL_CMD} r-base r-cran-ggplot2
/usr/bin/mvn:
${INSTALL_CMD} maven
/usr/bin/%:
${INSTALL_CMD} $*
${XMONAD_XSESSION}:
sudo cp xmonad/xmonad.desktop ${XMONAD_XSESSION}
${XMONAD_START_FILE}:
ln -s ${PWD}/xmonad/start-xmonad ${XMONAD_START_FILE}
${EMACS_CONFIG}:
ln -s ${PWD}/newmacs ${EMACS_CONFIG}
${FISH_CONFIG}:
mkdir -p ${HOME}/.config/fish
ln -s ${PWD}/config.fish ${FISH_CONFIG}
${GIT_CONFIG}:
ln -s ${PWD}/gitconfig ${GIT_CONFIG}
${DUNST_CONFIG}:
mkdir -p ${HOME}/.config/dunst
ln -s ${PWD}/dunstrc ${DUNST_CONFIG}
${KITTY_CONFIG}:
mkdir -p ${HOME}/.config/kitty
ln -s ${PWD}/kitty.conf ${KITTY_CONFIG}
${XMONAD_CONFIG}:
ln -s ${PWD}/xmonad ${XMONAD_CONFIG}
.PHONY: links
links: ${EMACS_CONFIG} ${FISH_CONFIG} ${GIT_CONFIG} ${DUNST_CONFIG} ${KITTY_CONFIG} ${XMONAD_CONFIG} ${OFFLINEIMAPRC} ${OFFLINEIMAPPY} ${XMOBAR_CONFIG}
${XMOBAR_CONFIG}:
ln -s ${PWD}/xmonad/xmobarrc ${XMOBAR_CONFIG}
${OFFLINEIMAPRC}:
ln -s ${PWD}/offlineimaprc ${OFFLINEIMAPRC}
${OFFLINEIMAPPY}:
ln -s ${PWD}/offlineimap.py ${OFFLINEIMAPPY}
${XMONAD_REPO}:
cd xmonad && test -d xmonad || git clone "[email protected]:xmonad/xmonad"
${XMONAD_CONTRIB_REPO}: ${XMONAD_REPO}
cd xmonad && test -d xmonad-contrib || git clone "[email protected]:xmonad/xmonad-contrib"
${XMOBAR_REPO}: ${XMONAD_REPO}
cd xmonad && test -d xmobar || git clone "[email protected]:jaor/xmobar"
${HLEDGER}: ${STACK}
stack install hledger hledger-web
${CASK}:
cd /var/tmp && git clone "https://github.com/cask/cask" && cd cask && make install
ifeq (${OS},Fedora)
XMONAD_DEPENDENCIES=libX11-devel libXrandr-devel libXinerama-devel libXScrnSaver-devel libXft-devel libXpm-devel
else
XMONAD_DEPENDENCIES=libx11-dev libxrandr-dev libxinerama-dev libxss-dev libxft-dev libasound2-dev libxpm-dev
endif
${XMONAD}: ${STACK} ${XMONAD_REPO} ${XMONAD_CONTRIB_REPO} ${XMOBAR_REPO}
${INSTALL_CMD} ${XMONAD_DEPENDENCIES}
cd xmonad && stack install
${STACK}:
curl -sSL https://get.haskellstack.org/ | sh
ifeq (${OS},Fedora)
MU_DEPENDENCIES=guile-devel texinfo html2text xdg-utils guile22-devel gmime30-devel xapian-core-devel webkit2gtk3-devel
else
MU_DEPENDENCIES=guile-3.0-dev texinfo html2text xdg-utils guile-2.2-dev libgmime-3.0-dev libxapian-dev libwebkit2gtk-4.0-dev
endif
${MU}: ${MU_REPOSITORY}
${INSTALL_CMD} ${MU_DEPENDENCIES}
cd ${MU_REPOSITORY} && \
./autogen.sh --prefix=${LOCAL} && \
make -j5 && \
make install
${MU_REPOSITORY}:
cd ${FOREIGN_SOURCE} && git clone https://github.com/djcb/mu.git
${EMACS_REPOSITORY}:
cd ${FOREIGN_SOURCE} && git clone https://git.savannah.gnu.org/git/emacs.git
ifeq (${OS},Fedora)
EMACS_DEPENDENCIES=jansson-devel
else
EMACS_DEPENDENCIES=libjansson-dev libxpm-dev libgif-dev libjpeg-dev libpng-dev libtiff-dev libx11-dev libncurses5-dev automake autoconf texinfo libgtk2.0-dev libwebkit2gtk-4.0-dev libgccjit-10-dev gcc-10 g++-10 libgccjit0 libgccjit-10-dev libjansson4 libjansson-dev libgtk-3-dev libmagick++-dev fonts-symbola fonts-noto-color-emoji
endif
${EMACS}: ${EMACS_REPOSITORY}
ifeq (${OS},Fedora)
sudo dnf builddep -y emacs
else
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
sudo apt build-dep -y emacs
endif
${INSTALL_CMD} ${EMACS_DEPENDENCIES}
cd ${EMACS_REPOSITORY} && ./autogen.sh && ( CC=/usr/bin/gcc-10 CXX=/usr/bin/gcc-10 ./configure --prefix=${LOCAL} --with-xwidgets --with-cairo --with-modules --without-compress-install --with-x-toolkit=yes --with-gnutls --without-gconf --without-toolkit-scroll-bars --without-xaw3d --without-gsettings --with-mailutils --with-native-compilation --with-json --with-harfbuzz --with-imagemagick --with-jpeg --with-png --with-rsvg --with-tiff --with-wide-int --without-xft --with-xml2 --with-xpm CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" && make -j5 && make install)
${FOREIGN_SOURCE}:
mkdir -p ~/var/src
~/bin:
mkdir -p ~/bin
${RUST}:
curl --proto '=https' --tlsv1.2 -sSf 'https://sh.rustup.rs' > /tmp/install_rust.sh && sh /tmp/install_rust.sh -y && rm -f /tmp/install_rust.sh
${WASM_PACK}:
curl 'https://rustwasm.github.io/wasm-pack/installer/init.sh' -sSf | PATH=$$HOME/.cargo/bin:$$PATH sh
ifeq (${OS},Fedora)
CARGO_DEPENDENCIES=openssl-devel
else
CARGO_DEPENDENCIES=libssl-dev
endif
${CARGO_GENERATE}:
${INSTALL_CMD} ${CARGO_DEPENDENCIES}
( PATH=$$HOME/.cargo/bin:$$PATH cargo install cargo-generate )
${RUST_ANALYZER}:
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-linux -o ${RUST_ANALYZER}
chmod +x ${RUST_ANALYZER}
${FONTS}:
mkdir -p ${FONTS}
FONT_TMP_FILE = /tmp/fonts.zip
${FIRA_CODE}:
curl -L 'https://github.com/tonsky/FiraCode/releases/download/5.2/Fira_Code_v5.2.zip' -o ${FONT_TMP_FILE}
mkdir -p ${FIRA_CODE}
unzip ${FONT_TMP_FILE} -d ${FIRA_CODE}
rm -f ${FONT_TMP_FILE}
fc-cache -fv ${FONTS}
${FIRA_GO}:
curl -L 'https://bboxtype.com/downloads/FiraGO/Download_Folder_FiraGO_1001.zip' -o ${FONT_TMP_FILE}
mkdir -p ${FIRA_GO}
unzip ${FONT_TMP_FILE} -d ${FIRA_GO}
rm -f ${FONT_TMP_FILE}
fc-cache -fv ${FONTS}
${BITTER}:
curl -L 'https://fonts.google.com/download?family=Bitter' -o ${FONT_TMP_FILE}
mkdir -p ${BITTER}
unzip ${FONT_TMP_FILE} -d ${BITTER}
rm -f ${FONT_TMP_FILE}
fc-cache -fv
${LOCAL}/bin/tsc:
${NPM_PREFIX}
npm i -g typescript
${LOCAL}/bin/eslint:
${NPM_PREFIX}
npm i -g eslint
${LOCAL}/bin/prettier:
${NPM_PREFIX}
npm i -g prettier
/etc/default/keyboard:
sudo cp keyboard /etc/default/keyboard
ifeq (${OS},Fedora)
DEPENDENCIES=cmake freetype-devel fontconfig-devel libxcb-devel libxkbcommon-devel g++
else
DEPENDENCIES=cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3
endif
${ALACRITTY}:
${INSTALL_CMD} ${DEPENDENCIES}
( PATH=$$HOME/.cargo/bin:$$PATH cargo install alacritty )
${FD}:
( PATH=$$HOME/.cargo/bin:$$PATH cargo install fd-find )