-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 lines (43 loc) · 1.73 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
# Makefile
# Gap Tech Dictionary Build System
#
###########################
export DICT_DEV_KIT_OBJ_DIR = ./objects
###########################
# Generate data.json
data.json: signals.json
cat signals.json | jq '{entries: . | map({ entry: . })}' > data.json
# Generate data.xml
data.xml: data.json
json2xml -o data.xml -i data.json
echo '<?xml version="1.0" encoding="utf-8"?>' | cat - data.xml > /tmp/out && mv /tmp/out data.xml
# Generate dictionary xml
dictionary.xml: data.xml
xsltproc DicionarioLibras.xsl data.xml | xmllint --format - > dictionary.xml
# Compile dictionary file
./objects/Libras.dictionary: dictionary.xml
./DictionaryDevelopmentKit/bin/build_dict.sh Libras dictionary.xml dictionary.css DicionarioLibrasInfo.plist
echo "Done."
# Delete dictionary
clean:
rm -rf {./objects,data.json,data.xml,dictionary.xml,Libras.dictionary}
# Clean System cache
cache:
rm -rf ~/Library/Preferences/com.apple.DictionaryServices.plist
rm -rf ~/Library/Preferences/com.apple.Dictionary.plist
rm -rf ~/Library/Caches/com.apple.DictionaryApp
rm -rf ~/Library/Caches/com.apple.DictionaryManager
rm -rf ~/Library/Caches/com.apple.Dictionary
rm -rf ~/Library/Caches/com.apple.DictionaryServices
Libras.dictionary: ./objects/Libras.dictionary
echo "Creating Libras.dictionary".
ditto --noextattr --norsrc ./objects/Libras.dictionary Libras.dictionary
# Install the Dictionary on the System
install: Libras.dictionary cache
echo "Installing into ~/Library/Dictionaries".
mkdir -p ~/Library/Dictionaries
cp -r Libras.dictionary ~/Library/Dictionaries/Libras.dictionary
touch ~/Library/Dictionaries
echo "Done."
echo "To test the new dictionary, try Dictionary.app."
echo "Make sure the 'Libras' dictionary is enabled on Dictionary.app->Preferences"