File: tarball.sh

package info (click to toggle)
bibledit 5.0.764-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 230,136 kB
  • sloc: xml: 863,336; ansic: 164,208; cpp: 81,648; sh: 4,684; makefile: 406; php: 69
file content (170 lines) | stat: -rwxr-xr-x 5,050 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

# Copyright (©) 2003-2018 Teus Benschop.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# This script runs in a Terminal on macOS.
# It refreshes and updates the bibledit sources.
# It generates a tarball for a Linux Bibledit client.


LINUXSOURCE=`dirname $0`
cd $LINUXSOURCE
if [ $? -ne 0 ]; then exit; fi
LINUXSOURCE=`pwd`
echo Using source at $LINUXSOURCE
BUILDDIR=/tmp/bibledit-linux
echo Build directory at $BUILDDIR


# Synchronize source code.
cd $LINUXSOURCE
if [ $? -ne 0 ]; then exit; fi
echo Synchronizing relevant source code to $BUILDDIR
rm -rf $BUILDDIR
if [ $? -ne 0 ]; then exit; fi
mkdir -p $BUILDDIR
if [ $? -ne 0 ]; then exit; fi
rsync --archive ../cloud/ $BUILDDIR/
if [ $? -ne 0 ]; then exit; fi
rsync --archive . $BUILDDIR/
if [ $? -ne 0 ]; then exit; fi
echo Done


echo Working in $BUILDDIR
cd $BUILDDIR
if [ $? -ne 0 ]; then exit; fi


# Move the Bibledit Linux GUI sources into place.
mv bibledit.h executable
if [ $? -ne 0 ]; then exit; fi
mv bibledit.cpp executable
if [ $? -ne 0 ]; then exit; fi


# Remove unwanted files.
rm valgrind
rm bibledit
rm dev
rm -rf unittests
find . -name .DS_Store -delete
rm -rf .git
find . -name "*.Po" -delete
rm -rf autom4te.cache
rm -rf *.xcodeproj
rm -rf xcode
echo Remove macOS extended attributes.
echo The attributes would make their way into the tarball,
echo get unpacked within Debian,
echo and would cause lintian errors.
xattr -r -c *


# Clean source.
./configure
if [ $? -ne 0 ]; then exit; fi
make distclean
if [ $? -ne 0 ]; then exit; fi


# Enable the Linux configuration in config.h.
sed -i.bak 's/ENABLELINUX=no/ENABLELINUX=yes/g' configure.ac
if [ $? -ne 0 ]; then exit; fi
sed -i.bak 's/# linux //g' configure.ac
if [ $? -ne 0 ]; then exit; fi
sed -i.bak 's/.*Tag8.*/AC_DEFINE([HAVE_LINUX], [1], [Enable installation on Linux])/g' configure.ac
if [ $? -ne 0 ]; then exit; fi
# A client does not use the mimetic library.
sed -i.bak '/mimetic/d' configure.ac
if [ $? -ne 0 ]; then exit; fi
# A client does not need the cURL library.
sed -i.bak '/curl/d' configure.ac
if [ $? -ne 0 ]; then exit; fi
sed -i.bak '/CURL/d' configure.ac
if [ $? -ne 0 ]; then exit; fi
# A client does not need the OpenSSL library.
sed -i.bak '/OPENSSL/d' configure.ac
if [ $? -ne 0 ]; then exit; fi


# Do not build the unit tests and the generator.
# Rename binary 'server' to 'bibledit'.
sed -i.bak 's/server unittest generate/bibledit/g' Makefile.am
if [ $? -ne 0 ]; then exit; fi
sed -i.bak 's/server_/bibledit_/g' Makefile.am
if [ $? -ne 0 ]; then exit; fi
sed -i.bak '/unittest/d' Makefile.am
if [ $? -ne 0 ]; then exit; fi
sed -i.bak '/generate_/d' Makefile.am
if [ $? -ne 0 ]; then exit; fi
# Update what to distribute.
sed -i.bak 's/bible bibledit/bible/g' Makefile.am
if [ $? -ne 0 ]; then exit; fi
sed -i.bak '/EXTRA_DIST/ s/$/ *.desktop *.xpm *.png/' Makefile.am
if [ $? -ne 0 ]; then exit; fi
# Do not link with cURL and OpenSSL.
# Both are not used.
# As a result, a Debian package finds itself having unsatisfied dependencies.
# Removing the flags fixes that.
sed -i.bak '/CURL/d' Makefile.am
if [ $? -ne 0 ]; then exit; fi
sed -i.bak '/OPENSSL/d' Makefile.am
if [ $? -ne 0 ]; then exit; fi
# Add the additional Makefile.mk fragment for the Linux app.
echo '' >> Makefile.am
cat Makefile.mk >> Makefile.am
# Remove the consecutive blank lines introduced by the above edit operations.
sed -i.bak '/./,/^$/!d' Makefile.am
if [ $? -ne 0 ]; then exit; fi
# A client does not require the mimetic library.
sed -i.bak '/mimetic/d' Makefile.am
if [ $? -ne 0 ]; then exit; fi
# Do not include "bibledit" in the distribution tarball.
sed -i.bak '/^EXTRA_DIST/ s/bibledit//' Makefile.am
if [ $? -ne 0 ]; then exit; fi

# Remove bibledit-cloud man file.
rm man/bibledit-cloud.1
if [ $? -ne 0 ]; then exit; fi
sed -i.bak 's/man\/bibledit-cloud\.1//g' Makefile.am


# Update the network port number to a value different from 8080.
# This enables running Bibledit (client) and Bibledit Cloud simultaneously.
sed -i.bak 's/8080/9876/g' config/logic.cpp
if [ $? -ne 0 ]; then exit; fi


# Remove .bak files.
find . -name "*.bak" -delete


# Create distribution tarball.
./reconfigure
if [ $? -ne 0 ]; then exit; fi
./configure
if [ $? -ne 0 ]; then exit; fi
make dist --jobs=12
if [ $? -ne 0 ]; then exit; fi


# Copy the tarball to the Desktop
rm -f ~/Desktop/bibledit*gz
cp *.gz ~/Desktop
if [ $? -ne 0 ]; then exit; fi