-
Notifications
You must be signed in to change notification settings - Fork 0
/
1refresh.sh
executable file
·147 lines (114 loc) · 3.73 KB
/
1refresh.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
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
#!/bin/bash
# This script runs on Linux or macOS.
# It takes the source code of the Bibledit library,
# and puts it in the Windows project.
# Visual Studio can then build Bibledit for Windows.
# Work in the directory with Windows source, separate from Bibledit library source.
WINDOWSDIR=`dirname $0 | realpath`
echo Build the core library once more
# The purpose of this is to make sure
# that the autoconf and automake systems
# are in a consistent state.
# There were cases that an inconsistent system
# led to this script failing.
cd $WINDOWSDIR
if [ $? != 0 ]; then exit; fi
cd ../cloud
if [ $? != 0 ]; then exit; fi
make --jobs=4
if [ $? != 0 ]; then exit; fi
echo Remove all existing code.
# The point of doing this is to remove code
# that still is in the Windows port
# but no longer in the core library.
cd $WINDOWSDIR
if [ $? != 0 ]; then exit; fi
cd server
if [ $? != 0 ]; then exit; fi
find . -name "*.h" -delete
find . -name "*.c" -delete
find . -name "*.cpp" -delete
cd $WINDOWSDIR
if [ $? != 0 ]; then exit; fi
echo Pulling in the relevant Bibledit library source code.
rsync --archive --exclude '*.o' --exclude '*.a' --exclude '.dirstamp' --exclude 'server' --exclude 'unittest' --exclude '.DS_Store' --exclude 'autom4te.cache' --exclude 'bibledit' --exclude '*~' --exclude 'dev' --exclude 'generate' --exclude 'valgrind' --exclude 'AUTHORS' --exclude 'NEWS' --exclude 'README' --exclude 'ChangeLog' --exclude 'reconfigure' --exclude 'xcode' --exclude 'DEVELOP' --exclude '*.Po' ../cloud/* server
if [ $? != 0 ]; then exit; fi
echo Change directory to the core library.
cd server
if [ $? != 0 ]; then exit; fi
echo Prepare the sample Bible.
./configure
if [ $? != 0 ]; then exit; fi
make --jobs=4
if [ $? != 0 ]; then exit; fi
./generate . samplebible
if [ $? != 0 ]; then exit; fi
rm logbook/1*
make distclean
if [ $? != 0 ]; then exit; fi
echo Remove code that is no longer needed.
rm -rf unittests
rm -rf sources
rm -rf cloud.xcodeproj
# Configure the Bibledit source.
./configure --enable-windows
if [ $? != 0 ]; then exit; fi
# echo Set the network port it listens on.
# echo 9876 > config/network-port
# Remove some Linux related definitions as they don't work on Windows.
sed -i.bak '/HAVE_LIBPROC/d' config.h
if [ $? != 0 ]; then exit; fi
sed -i.bak '/HAVE_EXECINFO/d' config.h
if [ $? != 0 ]; then exit; fi
sed -i.bak '/HAVE_ICU/d' config.h
if [ $? != 0 ]; then exit; fi
sed -i.bak '/HAVE_PUGIXML/d' config.h
if [ $? != 0 ]; then exit; fi
sed -i.bak '/HAVE_UTF8PROC/d' config.h
if [ $? != 0 ]; then exit; fi
# Windows now uses mbedTLS 3.x.
# Remove mbedTLS 2.x.
rm -rf mbedtls2
if [ $? != 0 ]; then exit; fi
# Disable threading in mbedTLS on Windows.
sed -i.bak '/#define MBEDTLS_THREADING_C/d' mbedtls/mbedtls_config.h
if [ $? != 0 ]; then exit; fi
sed -i.bak '/#define MBEDTLS_THREADING_PTHREAD/d' mbedtls/mbedtls_config.h
if [ $? != 0 ]; then exit; fi
# Remove files and folders no longer needed after configure.
find . -name ".deps" -type d -prune -exec rm -rf '{}' '+'
rm aclocal.m4
rm compile
rm config.guess
rm *.bak
rm mbedtls/*.bak
rm config.h.in
rm config.log
rm config.status
rm config.sub
rm configure
rm configure.ac
rm depcomp
rm INSTALL
rm install-sh
rm Makefile*
rm missing
rm stamp-h1
rmdir unittests
rmdir sources
rm -rf autom4te.cache
# Clean stuff out.
cd $WINDOWSDIR
if [ $? != 0 ]; then exit; fi
find . -name .DS_Store -delete
# Update Inno Setup script.
cd $WINDOWSDIR
if [ $? != 0 ]; then exit; fi
VERSION=`sed -n -e 's/^.* PACKAGE_VERSION //p' server/config.h | tr -d '"'`
echo Version $VERSION
sed -i.bak "s/AppVersion=.*/AppVersion=$VERSION/" package.iss
if [ $? != 0 ]; then exit; fi
sed -i.bak "s/OutputBaseFilename=.*/OutputBaseFilename=bibledit-$VERSION/" package.iss
if [ $? != 0 ]; then exit; fi
rm package.iss.bak
echo Ready