-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·90 lines (86 loc) · 5.23 KB
/
build.sh
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
#!/bin/bash
# Get the most recent webview.h
curl -O https://raw.githubusercontent.com/webview/webview/master/webview.h
# get the most recent sortable js and css
# Strip comments as // comments break sthings
curl https://raw.githubusercontent.com/tofsjonas/sortable/main/sortable.js | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > sortable.js
curl https://raw.githubusercontent.com/tofsjonas/sortable/main/sortable.css | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > sortable.css
# I had to get these once and then remove // style comments as this breaks webview.h
curl https://raw.githubusercontent.com/kueblc/LDT/master/lib/Keybinder.js | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > Keybinder.js
curl https://raw.githubusercontent.com/kueblc/LDT/master/lib/Parser.js | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > Parser.js
curl https://raw.githubusercontent.com/kueblc/LDT/master/lib/SelectHelper.js | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > SelectHelper.js
curl https://raw.githubusercontent.com/kueblc/LDT/master/lib/TextareaDecorator.css | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > TextareaDecorator.css
curl https://raw.githubusercontent.com/kueblc/LDT/master/lib/TextareaDecorator.js | awk '{ if ($0 ~ /\/\/[[:space:]]/){ print substr($0, 0, index($0, "//") - 1) } else { print $0 }}' > TextareaDecorator.js
# Convert main HTML into a header file
xxd -i DBApp.html DBApp.h
# Compile
if [ "$(uname)" == "Darwin" ]; then
mkdir -p DBApp.app/Contents/MacOS
mkdir -p DBApp.app/Contents/Resources
# security find-identity -v -p codesigning
DEV_ID="7SQZL2Q9TC" # <-- Put your Apple Developer ID in here if you wish to codesign
rm -f DBApp.app/Contents/MacOS/DBApp
# Statically compile in mysql client, ssl and crypto stuff
# -arch x86_64 -arch arm64 ... at some point
if test -f /usr/local/lib/libmysqlclient.a
then
c++ DBApp.cc -mmacosx-version-min=13.0 -std=c++11 -framework WebKit -I/usr/local/include -I/usr/local/include/mysql -W -L/usr/local/lib -lz /usr/local/lib/libzstd.a /usr/local/lib/libmysqlclient.a /usr/local/Cellar/openssl@3/3.2.1/lib/libcrypto.a /usr/local/Cellar/openssl@3/3.2.1/lib/libssl.a -o DBApp.app/Contents/MacOS/DBApp
fi
if test -f /opt/homebrew/lib/libmysqlclient.a
then
c++ -v -arch arm64 DBApp.cc -mmacosx-version-min=13.0 -std=c++11 -framework WebKit -I/opt/homebrew/include -I/opt/homebrew/include/mysql -W -L/opt/homebrew/lib -lz /opt/homebrew/lib/libzstd.dylib /opt/homebrew/lib/libmysqlclient.a /opt/homebrew/Cellar/openssl@3/3.2.1/lib/libcrypto.a /opt/homebrew/Cellar/openssl@3/3.2.1/lib/libssl.a -o DBApp.app/Contents/MacOS/DBApp
fi
# Dynamic version
# c++ DBApp.cc -std=c++11 -framework WebKit -I/usr/local/include -I/usr/local/include/mysql -W -L/usr/local/lib -lmysqlclient -o DBApp.app/Contents/MacOS/DBApp
if [ $? -eq 0 ]
then
xattr -cr DBApp.app
ls -lah DBApp.app/Contents/MacOS/DBApp
ibtool --compile DBApp.app/Contents/Resources/MainMenu.nib DBApp.app/Contents/Resources/MainMenu.xib
cp sortable.js DBApp.app/Contents/Resources/
cp sortable.css DBApp.app/Contents/Resources/
cp DBApp.js DBApp.app/Contents/Resources/
cp DBApp.css DBApp.app/Contents/Resources/
cp DBApp.html DBApp.app/Contents/Resources/
cp Keybinder.js DBApp.app/Contents/Resources/
cp Parser.js DBApp.app/Contents/Resources/
cp SelectHelper.js DBApp.app/Contents/Resources/
cp TextareaDecorator.css DBApp.app/Contents/Resources/
cp TextareaDecorator.js DBApp.app/Contents/Resources/
if [ $? -eq 0 ]
then
if [ "$DEV_ID" != "" ]
then
codesign -s "$DEV_ID" DBApp.app
fi
DBApp.app/Contents/MacOS/DBApp # good for testing to look at outputs
#open DBApp.app
fi
fi
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
rm -f DBApp
c++ DBApp.cc `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` -W -lmysqlclient -o DBApp
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
DEL DBApp.exe
curl -O https://github.com/webview/webview/blob/master/dll/x32/WebView2Loader.dll
curl -O https://github.com/webview/webview/blob/master/dll/x32/webview.dll
c++ DBApp.cc -mwindows -L./dll/x32 -lwebview -lWebView2Loader -o DBApp.exe
if [ $? -eq 0 ]
then
DIR "DBApp.exe"
DBApp.exe
fi
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
DEL DBApp.exe
MKDIR dll\x64
CD dll\x64
curl -O https://github.com/webview/webview/blob/master/dll/x64/WebView2Loader.dll
curl -O https://github.com/webview/webview/blob/master/dll/x64/webview.dll
CD ..\..
c++ DBApp.cc -mwindows -L./dll/x64 -lwebview -lWebView2Loader -o DBApp.exe
if [ $? -eq 0 ]
then
DIR "DBApp.exe"
DBApp.exe
fi
fi