-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPKGBUILD-qt4
307 lines (254 loc) · 10.3 KB
/
PKGBUILD-qt4
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# PKGBUILD for MinGW-w64 derived from archlinux PKGBUILD - Philippe Joyez
# archlinux Maintainer: Ronald van Haren <ronald.archlinux.org>
# Contributor: Damir Perisa <damir.perisa@bluewin.ch> # Contributor: Christopher Reimer <c.reimer1993@gmail.com>
# Contributor: wangjiezhe <wangjiezhe AT yandex DOT com>
_realname=texmacs
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
_pkgname=texmacs
pkgver=r1
pkgrel=1
pkgdesc="Free scientific text editor, inspired by TeX and GNU Emacs. WYSIWYG editor and CAS-interface. (mingw-w64)"
arch=('any')
url="http://www.texmacs.org/"
license=('GPL')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-pkg-config"
p7zip
)
depends=(
"${MINGW_PACKAGE_PREFIX}-hunspell"
"${MINGW_PACKAGE_PREFIX}-wget"
"${MINGW_PACKAGE_PREFIX}-gc"
"${MINGW_PACKAGE_PREFIX}-ghostscript"
"${MINGW_PACKAGE_PREFIX}-imagemagick"
"${MINGW_PACKAGE_PREFIX}-librsvg"
"${MINGW_PACKAGE_PREFIX}-lcms2"
"${MINGW_PACKAGE_PREFIX}-freetype"
"${MINGW_PACKAGE_PREFIX}-iconv"
"${MINGW_PACKAGE_PREFIX}-qt4"
"${MINGW_PACKAGE_PREFIX}-guile1.8"
"${MINGW_PACKAGE_PREFIX}-poppler-qt4"
)
#source=("${_pkgname}::svn://svn.savannah.gnu.org/texmacs/trunk/src#revision=11260" for a specific rev, otherwise latest
source=("${_pkgname}::svn://svn.savannah.gnu.org/texmacs/trunk/src"
)
sha1sums=('SKIP'
)
options=('!emptydirs' '!ccache' 'strip')
provides=('texmacs')
conflicts=('texmacs')
# the function pkgver() does not seem to work. disabling.
#pkgver() {
# cd "${srcdir}/../${_pkgname}"
# svn info | awk '/Revision/{r=$2}/Date/{gsub(/-/,"");d=$4}END{print d"."r}'
#}
prepare() {
export TM_BUILD_DIR="${srcdir}/${_pkgname}-build"
export BUNDLE_DIR="${srcdir}/distr/TeXmacs-Windows"
cd "${srcdir}/../${_pkgname}"
pkgver="svn$(svnversion)+extras"
echo ${pkgver}
echo ${pkgver} > SVNREV
if [ -d $TM_BUILD_DIR ]; then
rm -rf $TM_BUILD_DIR
fi
mv "${srcdir}/${_pkgname}" $TM_BUILD_DIR
# svn export "${srcdir}/${_pkgname}" $TM_BUILD_DIR
cd $TM_BUILD_DIR
patch -i ../../winsparkle_config.patch -p1
# patch -i ../../equation-editor-plugin.patch -p1
git --work-tree=. apply ../../my_current.patch #needed for binary file oxt
if test ! -d TeXmacs/misc/updater_key ; then
mkdir -p TeXmacs/misc/updater_key
fi
cp ../../slowphil_github_texmacs_updates_dsa_pub.pem packages/windows/dsa_pub.pem
#sed -i 's|^SVNREV=\${SVNREV/:/_}|SVNREV='${pkgver}'|' configure.in
sed -i 's|^DEVEL_RELEASE="1" # I think we should use|DEVEL_RELEASE=$SVNREV # actually using|' configure.in
autoreconf
sed -i 's|#! /bin/sh|#! /bin/bash|' configure
# get exes that are no longer in current svn but still needed
wget "https://svn.savannah.gnu.org/viewvc/*checkout*/texmacs/trunk/src/packages/windows/FullName.exe?revision=10795&pathrev=10795" -O packages/windows/FullName.exe
wget "https://svn.savannah.gnu.org/viewvc/*checkout*/texmacs/trunk/src/packages/windows/winwallet.exe?revision=10795&pathrev=10795" -O packages/windows/winwallet.exe
}
build() {
export GUILE_LOAD_PATH="${MINGW_PREFIX}/share/guile/1.8"
cd $TM_BUILD_DIR
./configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--with-guile="/mingw32/bin/guile-config" \
--with-qt="/mingw32/bin/" \
--with-sparkle="/build/winsparkle/WinSparkle*" \
#--enable-console \
#--enable-debug # must not strip in this case (line 37 and 159) !!
echo "#define GS_EXE \"bin/gs.exe\"" >> src/System/tm_configure.hpp
make -j$(nproc)
}
package() {
export TM_BUILD_DIR="${srcdir}/${_pkgname}-build"
export BUNDLE_DIR="${srcdir}/distr/TeXmacs-Windows"
###############################################################################
# Make a Windows installer
# here we mimick what would do "make WINDOWS_BUNDLE", plus our own extras
###############################################################################
dlls_for_exes () {
# Add DLLs' transitive dependencies (taken from git for windows)
dlls=
todo="$* "
while test -n "$todo"
do
path=${todo%% *}
todo=${todo#* }
case "$path" in ''|' ') continue;; esac
for dll in $(objdump -p "$path" |
sed -n 's/^\tDLL Name: /mingw32\/bin\//p')
do
if test -f "/"$dll ; then
# since all the dependencies have been resolved for
# building, if we do not find a dll in /mingw32/bin/
# it must be a Windows-provided dll and then we ignore it
# otherwise we add it to the dlls to scan
case "$dlls" in
*"$dll"*) ;; # already found
*) dlls="$dlls $dll"; todo="$todo /$dll ";;
esac
fi
done
done
echo "$dlls"
}
# the additional programs we bundle with TeXmacs
DEPS="/mingw32/bin/pdftocairo.exe \
/mingw32/bin/rsvg-convert.exe \
/mingw32/bin/hunspell.exe \
/mingw32/bin/gswin32c.exe \
/mingw32/bin/wget.exe \
/build/winsparkle/WinSparkle.dll \
/build/SumatraPDF/SumatraPDF.exe \
/mingw32/bin/magick.exe"
PROGS="$DEPS $TM_BUILD_DIR/TeXmacs/bin/texmacs.bin"
# lookup all the Mingw32 ddls needed by Texmacs + additional programs
MINGW_DLLs_NEEDED=$(dlls_for_exes $PROGS)
echo $MINGW_DLLs_NEEDED
# Qt plugins TeXmacs presently uses
QT_NEEDED_PLUGINS_LIST="accessible imageformats"
rm -r -f $BUNDLE_DIR
if test ! -d $BUNDLE_DIR ; then
mkdir -p $BUNDLE_DIR
fi
cd $TM_BUILD_DIR
if test -f $BUNDLE_DIR/bin/texmacs.exe ; then
rm $BUNDLE_DIR/bin/texmacs.*
fi
cp -r -f -u TeXmacs/* $BUNDLE_DIR/
mv -f $BUNDLE_DIR/bin/texmacs.bin $BUNDLE_DIR/bin/texmacs.exe
strip -s $BUNDLE_DIR/bin/texmacs.exe
rm -f -r $BUNDLE_DIR/bin/texmacs
cp -r -f packages/windows/*.exe $BUNDLE_DIR/bin
cd /
for DLL in $MINGW_DLLs_NEEDED ; do
cp -u $DLL $BUNDLE_DIR/bin
done
for prog in "$DEPS" ; do
cp -u $prog $BUNDLE_DIR/bin
done
mv $BUNDLE_DIR/bin/gswin32c.exe $BUNDLE_DIR/bin/gs.exe
for PLUGIN in $QT_NEEDED_PLUGINS_LIST ; do
cp -r -f -u /mingw32/share/qt4/plugins/$PLUGIN $BUNDLE_DIR/bin
done
# pick up ice-9 for guile
export GUILE_LOAD_PATH="${MINGW_PREFIX}/share/guile/1.8"
find `guile-config info pkgdatadir` -type d -name ice-9 -exec cp -r -f {} $BUNDLE_DIR/progs/ \;
# create dir where hunspell looks for dictionaries
mkdir $BUNDLE_DIR/share
mkdir $BUNDLE_DIR/share/hunspell
# list of dictionaries languages that will be packaged
# Add as many as you want separated by spaces : dicts="en_US fr_FR en_GB"
# (the language of the current session is automatically added to the list)
dicts="en_US"
local_lang=$(echo $LANG | cut -d'.' -f1)
if [[ $local_lang = "" ]]; then
local_lang=$(echo $LC_CTYPE | cut -d'.' -f1)
fi
if [[ $dicts != *"$local_lang"* ]]; then
dicts="$dicts $local_lang"
fi
echo $dicts
# now fetch dictionaries.
# We use Lyx Repo's because they are all nicely and systematically organized in a single location
# (unlike LibreOffice dictionaries https://github.com/LibreOffice/dictionaries)
cd $BUNDLE_DIR/share/hunspell
lang_list=
for dic in $dicts ; do
if test "$(svn export --force svn://svn.lyx.org/lyx/dictionaries/trunk/dicts/${dic}.dic ./ )"; then
lang_list="$lang_list $(locale -av | grep -A2 -m1 $dic | sed -n -e 's/^ language | //p' | tr '[A-Z]' '[a-z]')"
svn export --force svn://svn.lyx.org/lyx/dictionaries/trunk/dicts/${dic}.aff ./
else
echo "Cannot download dictionary $dic , sorry"
fi
done
lang_list=$(echo $lang_list | sed -n -e 's/english/american/p')
# now fetch dictionaries' licences and doc.
# if the dictionary documentation & licence is not included properly
# then define the language list ($lang_list) manually (not much work anyway)
echo "$lang_list"
for language in $lang_list ; do
svn export --force "svn://svn.lyx.org/lyx/dictionaries/trunk/dicts/info/${language}" ./$language
done
#pull additional plugins from tm-forge and slowphil
#mkdir -p $BUNDLE_DIR/plugins
cd $BUNDLE_DIR/plugins
svn export https://github.com/texmacs/tm-forge/trunk/miscellanea/komments komments
svn export https://github.com/texmacs/tm-forge/trunk/miscellanea/outline outline
svn export https://github.com/texmacs/tm-forge/trunk/miscellanea/fontawesome fontawesome
svn export https://github.com/slowphil/zotexmacs/trunk/plugin/zotexmacs zotexmacs
if test -f /build/inno/inno_setup/ISCC.exe ; then
rm -rf ${srcdir}/distr/windows
/build/inno/inno_setup/ISCC.exe $TM_BUILD_DIR/packages/windows/TeXmacs.iss
TARGET="/texmacs_installer.exe"
if test -f ${srcdir}/distr/windows/TeXmacs-*.exe ; then
cp ${srcdir}/distr/windows/TeXmacs-*.exe ${srcdir}/distr/windows$TARGET
mv ${srcdir}/distr/windows$TARGET /
echo "Success! You will find the new installer at \"$(cygpath -aw $TARGET)\"." &&
echo "It is an InnoSetup installer."
fi
fi
#else #if the inno installer is all we want, uncomment (and adjust the 'fi's)
#make a 7z installer
OPTS7="-m0=lzma -mx=9 -md=64M"
TMPPACK="${srcdir}/tmp.7z"
TARGET="/texmacs_installer.7z.exe"
fileList="$(ls -dp -1 $BUNDLE_DIR/*)"
echo "Creating archive" &&
(cd / && 7za a $OPTS7 "$TMPPACK" $fileList) &&
(cat "/7zSD.sfx" &&
echo ';!@Install@!UTF-8!' &&
echo 'Title="TeXmacs for Windows"' &&
echo 'BeginPrompt="This archive extracts TeXmacs for Windows"' &&
echo 'CancelPrompt="Do you want to cancel TeXmacs installation?"' &&
echo 'ExtractDialogText="Please, wait..."' &&
echo 'ExtractPathText="Where do you want to install TeXmacs?"' &&
echo 'ExtractTitle="Extracting..."' &&
# the new "modified sfx" no longer handles these options https://github.com/git-for-windows/7-Zip/blob/v19.00-VS2019-sfx/README.md
#echo 'GUIFlags="8+32+64+256+4096"' &&
#echo 'GUIMode="1"' &&
#echo 'InstallPath="%PROGRAMFILES%\\TeXmacs"' &&
echo 'InstallPath="%%S\\TeXmacs"' &&
#if RunProgram is empty, the sfx tries to run setup.exe
#so we run a do-nothing program
echo 'RunProgram="cmd.exe /q /c exit"' &&
# where to find the program https://github.com/chrislake/7zsfxmm/wiki/Parameters#RunProgram
# Note: the new modified sfx does not seem to expand environment variables...
echo 'Directory="C:\\Windows\\system32\\"' &&
#echo 'executeFile="cmd"' &&
#echo 'executeParameters="exit"' &&
#echo 'OverwriteMode="2"' &&
echo ';!@InstallEnd@!' &&
cat "$TMPPACK") > "$TARGET" &&
echo "Success! You will find the new installer at \"$(cygpath -aw $TARGET)\"." &&
echo "It is a self-extracting .7z archive." &&
rm $TMPPACK
#fi
}