forked from d12frosted/homebrew-emacs-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·103 lines (82 loc) · 2.22 KB
/
build
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
#!/usr/bin/env bash
#
# Script for testing Formula locally without the need to uninstall Emacs.
#
# Usage example:
# $ ./build 25 --without-spacemacs-icon --HEAD
#
SOURCE_FILE_26=Formula/emacs-plus@26.rb
SOURCE_NAME_26=EmacsPlusAT26
SOURCE_FILE_27=Formula/emacs-plus@27.rb
SOURCE_NAME_27=EmacsPlusAT27
SOURCE_FILE_28=Formula/emacs-plus@28.rb
SOURCE_NAME_28=EmacsPlusAT28
SOURCE_FILE_29=Formula/emacs-plus@29.rb
SOURCE_NAME_29=EmacsPlusAT29
SOURCE_FILE_30=Formula/emacs-plus@30.rb
SOURCE_NAME_30=EmacsPlusAT30
TARGET_FILE=Formula/emacs-plus-local.rb
TARGET_NAME=EmacsPlusLocal
PACKAGE=emacs-plus-local
function cleanup {
rm -f "$TARGET_FILE"
}
trap cleanup INT TERM EXIT
function usage {
echo "Usage:
build VERSION [OPTIONS]
Versions:
26 Emacs 26 - emacs-plus@26 - previous release
27 Emacs 27 - emacs-plus@27 - previous release
28 Emacs 28 - emacs-plus@28 - current release
29 Emacs 29 - emacs-plus@29 - next release
30 Emacs 30 - emacs-plus@30 - development (master)
Consult each formula for the list of available options.
"
}
VERSION=$1
shift
case $VERSION in
26)
SOURCE_FILE=$SOURCE_FILE_26
SOURCE_NAME=$SOURCE_NAME_26
;;
27)
SOURCE_FILE=$SOURCE_FILE_27
SOURCE_NAME=$SOURCE_NAME_27
;;
28)
SOURCE_FILE=$SOURCE_FILE_28
SOURCE_NAME=$SOURCE_NAME_28
;;
29)
SOURCE_FILE=$SOURCE_FILE_29
SOURCE_NAME=$SOURCE_NAME_29
;;
30)
SOURCE_FILE=$SOURCE_FILE_30
SOURCE_NAME=$SOURCE_NAME_30
;;
*)
usage
exit 1
;;
esac
cp "$SOURCE_FILE" "$TARGET_FILE"
sed -i -e "s/class $SOURCE_NAME/class $TARGET_NAME/g" "$TARGET_FILE"
case $VERSION in
26)
SOURCE_FILE=$SOURCE_FILE_26
SOURCE_NAME=$SOURCE_NAME_26
old_sha=cb589861c8a697869107d1cbacc9cc920a8e7257b5c371b7e590b05e7e04c92c
new_sha=1e056907643ab81b340cd5c65832c2a3d9066116606bc822da1c08cf34913c38
sed -i -e "s/$old_sha/$new_sha/g" "$TARGET_FILE"
;;
esac
export HOMEBREW_EMACS_PLUS_MODE
HOMEBREW_EMACS_PLUS_MODE=local
export HOMEBREW_NO_INSTALL_UPGRADE=true
export HOMEBREW_NO_AUTO_UPDATE=true
brew uninstall $PACKAGE 2>/dev/null
# shellcheck disable=SC2068
brew install --formula ./$TARGET_FILE $@