-
Notifications
You must be signed in to change notification settings - Fork 8
/
ppbuild.sh
executable file
·1274 lines (1197 loc) · 38 KB
/
ppbuild.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
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#CONSTANTS/КОНСТАНТЫ
home=${HOME:-/home/$USER} #домашний каталог
psi_version="0.16" #не менять без необходимости, нужно для пакетирования
bindirs="/usr/bin
/usr/local/bin
${home}/bin" #список каталогов где могут быть найдены бинарники
qconf_cmds="qconf
qconf-qt4
qt-qconf" #список возможных имён бинарника qconf
def_prefix="/usr" #префикс для сборки пси+
libpsibuild_url="https://raw.github.com/psi-plus/maintenance/master/scripts/posix/libpsibuild.sh"
#DEFAULT OPTIONS/ОПЦИИ ПО УМОЛЧАНИЮ
no_enchant="--disable-enchant"
iswebkit=""
use_iconsets="system clients activities moods affiliations roster"
isoffline=0
skip_invalid=0
use_plugins="*"
#
#VARIABLES/ПЕРЕМЕННЫЕ
#каталог где будет лежать скрипт libpsibuild.sh и каталог buildpsi(по умолчанию)
workdir=${home}/github
#значение переменной buildpsi по умолчанию
default_buildpsi=${workdir}/psi
#имя временного каталога для пакетирования
inst_suffix=tmp
#префикс CMAKE по умолчанию
DEF_CMAKE_INST_PREFIX="${home}/.local"
#каталог плагинов в префиксе по умолчанию
DEF_CMAKE_INST_SUFFIX="share/psi+/plugins"
#список плагинов для сборки через ";" (otrplugin;cleanerplugin и.т.д.)
DEF_PLUG_LIST="ALL"
#тип сборки плагинов
DEF_CMAKE_BUILD_TYPE="Release"
#WARNING: следующие переменные будут изменены в процессе работы скрипта автоматически
buildpsi=${default_buildpsi} #инициализация переменной
orig_src=${buildpsi}/build #рабочий каталог для компиляции psi+
patches=${buildpsi}/git-plus/patches #путь к патчам psi+, необходим для разработки
inst_path=${buildpsi}/${inst_suffix} #только для пакетирования
cmake_files_dir=${buildpsi}/psi-plus-plugins-cmake #файлы CMAKE для сборки плагинов
#
#ENVIRONMENT VARIABLES/ПЕРЕМЕННЫЕ СРЕДЫ
psi_datadir=${home}/.local/share/psi+
psi_cachedir=${home}/.cache/psi+
psi_homeplugdir=${psi_datadir}/plugins
#
#CONFIG FILE PATH/ПУТЬ К ФАЙЛУ НАСТРОЕК
config_file=${home}/.config/psibuild.cfg
#PLUGINS_BUILD_LOG/ЛОГ ФАЙЛ СБОРКИ ПЛАГИНОВ
plugbuild_log=${orig_src}/plugins.log
#
#RPM_VARIABLES/ПЕРЕМЕННЫЕ ДЛЯ СБОРКИ RPM ПАКЕТОВ
rpmbuilddir=${home}/rpmbuild
rpmspec=${rpmbuilddir}/SPECS
rpmsrc=${rpmbuilddir}/SOURCES
#
#значения по умолчанию для поиска утилиты qconf
qconf_bin="qconf"
qconf_dir="/usr/bin"
#
find_qconf ()
{
local isfound=0
for cmd_item in ${qconf_cmds}; do
for bin_path in ${bindirs}; do
if [ -f "${bin_path}/${cmd_item}" ]; then
qconf_dir="${bin_path}"
qconf_bin="${bin_path}/${cmd_item}"
isfound=1
break
fi
done
if [ ${isfound} -eq 1 ]; then
echo "QConf utility found: ${qconf_bin}"; echo ""
break
fi
done
if [ ${isfound} -eq 0 ] || [ -z "${qconf_bin}" ]; then
echo "Enter the absolute path to qconf binary (Example: /home/me/qconf):"
read qconf_bin
fi
}
#
quit ()
{
break
}
#
read_options ()
{
local pluginlist=""
if [ -f ${config_file} ]; then
local inc=0
while read -r line; do
case ${inc} in
"0" ) iswebkit=$(echo ${line});;
"1" ) use_iconsets=$(echo ${line});;
"2" ) isoffline=$(echo ${line});;
"3" ) skip_invalid=$(echo ${line});;
"4" ) pluginlist=$(echo ${line});;
"5" ) no_enchant=$(echo ${line});;
"6" ) buildpsi=$(echo ${line});;
esac
let "inc+=1"
done < ${config_file}
if [ "$pluginlist" == "all" ]; then
use_plugins="*"
else
use_plugins=${pluginlist}
fi
if [ -z "${buildpsi}" ]; then
buildpsi=${default_buildpsi}
fi
if [ "${buildpsi:0:5}" == "\$HOME" ]; then
buildpsi=${home}/${buildpsi:6}
fi
fi
update_variables
}
#
set_options ()
{
PSI_DIR="${buildpsi}"
ICONSETS=${use_iconsets}
WORK_OFFLINE=${WORK_OFFLINE:-$isoffline}
PATCH_LOG=""
SKIP_INVALID_PATCH="${SKIP_INVALID_PATCH:-$skip_invalid}"
CONF_OPTS="${iswebkit} ${no_enchant}"
INSTALL_ROOT="${INSTALL_ROOT:-$def_prefix}"
QCONFDIR=${qconf_dir}
PLUGINS="${PLUGINS:-$use_plugins}"
}
#
update_variables ()
{
orig_src=${buildpsi}/build
patches=${buildpsi}/git-plus/patches
inst_path=${buildpsi}/${inst_suffix}
cmake_files_dir=${buildpsi}/psi-plus-plugins-cmake
}
#
check_libpsibuild ()
{
die() { echo "$@"; exit 1; }
cd ${workdir}
if [ "$isoffline" = 0 ]; then
echo "**libpsibuild.sh library updates check**"; echo ""
wget --output-document="libpsibuild.sh.new" --no-check-certificate ${libpsibuild_url};
if [ "$(diff -q libpsibuild.sh libpsibuild.sh.new)" ] || [ ! -f "${workdir}/libpsibuild.sh" ]
then
echo "**libpsibuild.sh library has been updated**"; echo ""
mv -f ${workdir}/libpsibuild.sh.new ${workdir}/libpsibuild.sh
else
echo "**you have the last version of libpsibuild.sh library**"; echo ""
rm -f ${workdir}/libpsibuild.sh.new
fi
chmod u+x ${workdir}/libpsibuild.sh
fi
}
#
run_libpsibuild ()
{
if [ ! -z "$1" ]; then
cd ${workdir}
. ./libpsibuild.sh
check_env $CONF_OPTS
$1
fi
}
#
check_dir ()
{
if [ ! -z "$1" ]; then
if [ ! -d "$1" ]; then
mkdir -pv "$1"
fi
fi
}
#
down_all ()
{
check_dir ${buildpsi}/git
check_dir ${buildpsi}/git-plus
check_dir ${buildpsi}/plugins
run_libpsibuild fetch_all
}
#
prepare_src ()
{
down_all
run_libpsibuild prepare_workspace
run_libpsibuild prepare_all
echo "Do you want to apply psi-new-history.patch [y/n(default)]"
read ispatch
if [ "${ispatch}" == "y" ]; then
cd ${orig_src}
patch -p1 < ${patches}/dev/psi-new-history.patch
cd ${workdir}
fi
}
#
backup_tar ()
{
echo "Backup ${buildpsi##*/} into ${buildpsi%/*}/${buildpsi##*/}.tar.gz started..."
cd ${buildpsi%/*}
tar -pczf ${buildpsi##*/}.tar.gz ${buildpsi##*/}
echo "Backup finished..."; echo " "
}
#
prepare_tar ()
{
check_dir ${rpmbuilddir}
check_dir ${rpmsrc}
check_dir ${rpmspec}
echo "Preparing Psi+ source package to build RPM..."
local rev=$(cd ${buildpsi}/git-plus/; echo $(($(git describe --tags | cut -d - -f 2))))
local tar_name=psi-plus-${psi_version}.${rev}
local new_src=${buildpsi}/${tar_name}
cp -r ${orig_src} ${new_src}
if [ -d ${new_src} ]; then
cd ${buildpsi}
tar -sczf ${tar_name}.tar.gz ${tar_name}
rm -r -f ${new_src}
if [ -d ${rpmsrc} ]; then
if [ -f "${rpmsrc}/${tar_name}.tar.gz" ]; then
rm -f ${rpmsrc}/${tar_name}.tar.gz
fi
cp -f ${buildpsi}/${tar_name}.tar.gz ${rpmsrc}
fi
echo "Preparing completed"
fi
}
#
prepare_win ()
{
echo "Preparing Psi+ source package to build in OS Windows..."
prepare_src
local rev=$(cd ${buildpsi}/git-plus/; echo $(($(git describe --tags | cut -d - -f 2))))
local tar_name=psi-plus-${psi_version}.${rev}-win
local new_src=${buildpsi}/${tar_name}
local mainicon=${buildpsi}/git-plus/app.ico
local file_pro=${new_src}/src/src.pro
local ver_file=${new_src}/version
cp -r ${orig_src} ${new_src}
if [ -d ${new_src} ]; then
cd ${buildpsi}
sed "s/#CONFIG += psi_plugins/CONFIG += psi_plugins/" -i "${file_pro}"
sed "s/\(@@DATE@@\)/"$(date +"%Y-%m-%d")"/" -i "${ver_file}"
cp -f ${mainicon} ${new_src}/win32/
local makepsi='@ECHO off
@ECHO:PSI-PLUS BUILD SCRIPT
@ECHO.
set /p HISTYPE="Do you want to build psi+ with new history [y/n(default)]"
@ECHO.
set /p BINTYPE="Do you want to build psi+ debug binary [y/n(default)]"
@ECHO.
set PARENT_DIR=%CD%
set BUILDLOG=%PARENT_DIR%\build.log
@ECHO:Logging started>%BUILDLOG%
@ECHO:_>>%BUILDLOG%
set SEVENZIP="C:\Program files\7-Zip"
set QMAKESPEC=win32-g++
set MAKE=mingw32-make -j5
set BUILDDIR=C:\build
set MINGWPREFIX=C:\mingw
set QTDIRPREFIX=C:\Qt\4.8.6
set PLUGBUILDDIR=%BUILDDIR%\PluginsBuilder
set PSIDEPSPREFIX=%BUILDDIR%\psideps
set nHistoryTemplate=new_history
set HISTORYLIBS=
set HISTORYINC=
set bin32Template=win32
set bin64Template=win64
set CONFDEFAULTS=--enable-plugins --enable-whiteboarding
set ISDEBUG=--release
set PSI_DATE=%date:~6,4%-%date:~3,2%-%date:~0,2%
set SEVENZFLAGS=-mx=9 -m0=LZMA -mmt=on
set /p revision=< %PARENT_DIR%\revision
set /p psiver=< %PARENT_DIR%\psiver
REM win64 specific variables
set ARCH64=x86_64
set QTDIR64=%QTDIRPREFIX%\%ARCH64%
set MINGW64=%MINGWPREFIX%\mingw64
set QCONF64=%BUILDDIR%\qconf\%ARCH64%\qconf.exe
REM win32 specific variables
set ARCH32=i386
set QTDIR32=%QTDIRPREFIX%\%ARCH32%
set MINGW32=%MINGWPREFIX%\mingw32
set QCONF32=%BUILDDIR%\qconf\%ARCH32%\qconf.exe
IF /I "%BINTYPE%" == "y" (
@goto debug
) ELSE (
@goto mainloop
)
:mainloop
set ISWEBKIT=NO
IF /I NOT "%BUILT32%" == "OK" @goto set32vars
IF /I NOT "%BUILT64%" == "OK" @goto set64vars
set ISWEBKIT=OK
IF /I NOT "%BUILTW32%" == "OK" @goto set32vars
IF /I NOT "%BUILTW64%" == "OK" @goto set64vars
IF /I NOT "%ISPLUGINS%" == "OK" @goto plugins
@goto goyandex
:debug
COPY /Y %PARENT_DIR%\src\src.pro %PARENT_DIR%\src\src.pro.orig
set ISDEBUG=--debug
@ECHO:CONFIG+=console>%PARENT_DIR%\src\src.pro
TYPE %PARENT_DIR%\src\src.pro.orig>>%PARENT_DIR%\src\src.pro
@ECHO:Building debug binaries with console>>%BUILDLOG%
@goto mainloop
:set32vars
set ARCH=%ARCH32%
set MINGWDIR=%MINGW32%
set QTDIR=%QTDIR32%
set BTYPE=W32
@ECHO:* Building %BTYPE%-webkit^=%ISWEBKIT% psi+ binary *>>%BUILDLOG%
@ECHO:_>>%BUILDLOG%
@ECHO:%BTYPE% variables^:>>%BUILDLOG%
@ECHO:QT4 in %QTDIR%>>%BUILDLOG%
@ECHO:MINGW in %MINGWDIR%>>%BUILDLOG%
@goto setcommonvars
:set64vars
set ARCH=%ARCH64%
set MINGWDIR=%MINGW64%
set QTDIR=%QTDIR64%
set BTYPE=W64
@ECHO:* Building %BTYPE%-webkit^=%ISWEBKIT% psi+ binary *>>%BUILDLOG%
@ECHO:_>>%BUILDLOG%
@ECHO:%BTYPE% variables^:>>%BUILDLOG%
@ECHO:QT4 in %QTDIR%>>%BUILDLOG%
@ECHO:MINGW in %MINGWDIR%>>%BUILDLOG%
@goto setcommonvars
:setcommonvars
set JSONPATH=%PSIDEPSPREFIX%\qjson\%ARCH%
@ECHO:QJSON library in %JSONPATH%>>%BUILDLOG%
set QCADIR=%PSIDEPSPREFIX%\qca\%ARCH%
@ECHO:QCA library in %QCADIR%>>%BUILDLOG%
set ZLIBDIR=%PSIDEPSPREFIX%\zlib\%ARCH%
@ECHO:ZLIB library in %ZLIBDIR%>>%BUILDLOG%
set ASPELLDIR=%PSIDEPSPREFIX%\aspell\%ARCH%
@ECHO:ASPELL library in %ASPELLDIR%>>%BUILDLOG%
set LIBIDNDIR=%PSIDEPSPREFIX%\libidn\%ARCH%
@ECHO:LIBIDN library in %LIBIDNDIR%>>%BUILDLOG%
IF "%ISWEBKIT%" == "OK" SET WEBKITFLAG=--enable-webkit
IF "%ISWEBKIT%" == "NO" SET WEBKITFLAG=
set PATH=%MINGWDIR%;%MINGWDIR%\bin;%QTDIR%;%QTDIR%\bin
IF /I "%HISTYPE%" == "y" @goto setnewhis
@goto makeit
:setnewhis
set HISTORYLIBS=--with-qjson-lib=%JSONPATH%\lib
set HISTORYINC=--with-qjson-inc=%JSONPATH%\include
@ECHO:%BTYPE% with new history>>%BUILDLOG%
@goto makeit
:archivate
IF /I "%HISTYPE%" == "y" SET isNHis=-%nHistoryTemplate%
IF "%ISWEBKIT%" == "OK" SET wbkPref=-webkit
IF /I "%BTYPE%" == "W32" SET sysType=-win32
IF /I "%BTYPE%" == "W64" SET sysType=-win64
set INARCH=%PARENT_DIR%\psi-plus.exe
IF NOT EXIST "%INARCH%" (
@ECHO:ERROR NO %INARCH% BINARY FOUND
@ECHO:ERROR NO %INARCH% BINARY FOUND>>%BUILDLOG%
@goto exit
)
set EXITARCH=%BUILDDIR%\psi-plus-%psiver%.%revision%%wbkPref%%isNHis%%sysType%.7z
%SEVENZIP%\7z.exe a -t7z %EXITARCH% %INARCH% %SEVENZFLAGS%
@ECHO:Archive file %EXITARCH% created>>%BUILDLOG%
@ECHO:_>>%BUILDLOG%
@goto mainloop
:makeit
IF EXIST "%PARENT_DIR%\Makefile" (
%MINGWDIR%\bin\mingw32-make clean
%MINGWDIR%\bin\mingw32-make distclean
@ECHO:Sources was cleaned>>%BUILDLOG%
)
IF /I "%BTYPE%%ISWEBKIT%" == "W64NO" @ECHO %psiver%.%revision%-64 ^(%PSI_DATE%^)>%PARENT_DIR%\version
IF /I "%BTYPE%%ISWEBKIT%" == "W64OK" @ECHO %psiver%.%revision%-webkit-64 ^(%PSI_DATE%^)>%PARENT_DIR%\version
IF /I "%BTYPE%%ISWEBKIT%" == "W32NO" @ECHO %psiver%.%revision% ^(%PSI_DATE%^)>%PARENT_DIR%\version
IF /I "%BTYPE%%ISWEBKIT%" == "W32OK" @ECHO %psiver%.%revision%-webkit ^(%PSI_DATE%^)>%PARENT_DIR%\version
IF /I "%BTYPE%" == "W32" %QCONF32%
IF /I "%BTYPE%" == "W64" %QCONF64%
configure %ISDEBUG% %CONFDEFAULTS% %WEBKITFLAG% --qtdir=%QTDIR% --with-zlib-inc=%ZLIBDIR%\include --with-zlib-lib=%ZLIBDIR%\lib --with-qca-inc=%QCADIR%\include --with-qca-lib=%QCADIR%\lib --disable-xss --disable-qdbus --with-aspell-inc=%ASPELLDIR%\include --with-aspell-lib=%ASPELLDIR%\lib --with-idn-inc=%LIBIDNDIR%\include --with-idn-lib=%LIBIDNDIR%\lib %HISTORYLIBS% %HISTORYINC%
@ECHO:%BTYPE% webkit^=%ISWEBKIT% configured>>%BUILDLOG%
mingw32-make -j5
@ECHO:%BTYPE% webkit^=%ISWEBKIT% compiled>>%BUILDLOG%
IF /I "%BTYPE%%ISWEBKIT%" == "W64NO" SET BUILT64=OK
IF /I "%BTYPE%%ISWEBKIT%" == "W64OK" SET BUILTW64=OK
IF /I "%BTYPE%%ISWEBKIT%" == "W32NO" SET BUILT32=OK
IF /I "%BTYPE%%ISWEBKIT%" == "W32OK" SET BUILTW32=OK
@goto archivate
:plugins
setlocal EnableDelayedExpansion
set /p ANS2="Do you want to build psi+ plugins [y/n(default)]"
IF /I "%ANS2%" == "y" (
@ECHO:_>>%BUILDLOG%
@ECHO:* Building psi+ W32-plugins *>>%BUILDLOG%
set PATH=%MINGW32%;%MINGW32%\bin;%QTDIR32%;%QTDIR32%\bin
%PLUGBUILDDIR%\compile-plugins -j 5
set INPL=%PARENT_DIR%\*.dll
set EXPL=%BUILDDIR%\psi-plus-%psiver%.%revision%-plugins-%bin32Template%.7z
%SEVENZIP%\7z.exe a -t7z !EXPL! !INPL! %SEVENZFLAGS%
@ECHO:Archive file !EXPL! created>>%BUILDLOG%
@ECHO:_>>%BUILDLOG%
@ECHO:* Building psi+ W64-plugins *>>%BUILDLOG%
set PATH=%MINGW64%;%MINGW64%\bin;%QTDIR64%;%QTDIR64%\bin
%PLUGBUILDDIR%\compile-plugins -j 5
set EXPL=%BUILDDIR%\psi-plus-%psiver%.%revision%-plugins-%bin64Template%.7z
%SEVENZIP%\7z.exe a -t7z !EXPL! !INPL! %SEVENZFLAGS%
@ECHO:Archive file !EXPL! created>>%BUILDLOG%
)
set ISPLUGINS=OK
@goto mainloop
:goyandex
setlocal EnableDelayedExpansion
set /p ANS4="Do you want to copy build data to YandexDisk [y/n(default)]"
IF /I "%ANS4%" == "y" (
set YADISKPATH=%USERPROFILE%\YandexDisk\psi-plus
COPY /Y %BUILDDIR%\psi-plus-plugins-%bin32Template%.7z !YADISKPATH!\%bin32Template%
COPY /Y %BUILDDIR%\psi-plus-%psiver%.%revision%*%bin32Template%.7z !YADISKPATH!\%bin32Template%
COPY /Y %BUILDDIR%\psi-plus-plugins-%bin64Template%.7z !YADISKPATH!\%bin64Template%
COPY /Y %BUILDDIR%\psi-plus-%psiver%.%revision%*%bin64Template%.7z !YADISKPATH!\%bin64Template%
)
IF /I "%BINTYPE%" == "y" COPY /Y %PARENT_DIR%\src\src.pro.orig %PARENT_DIR%\src\src.pro
@goto exit
:exit
pause
'
echo "${makepsi}" > ${new_src}/make-psiplus.cmd
tar -pczf ${tar_name}.tar.gz ${tar_name}
rm -rf ${new_src}
fi
}
#
compile_psiplus ()
{
prepare_src
run_libpsibuild compile_psi 2>${buildpsi}/errors.txt
}
#
qmakecmd ()
{
if [ -f "/usr/bin/qmake" ] || [ -f "/usr/local/bin/qmake" ]; then
qmake
else
if [ -f "/usr/bin/qmake-qt4" ] || [ -f "/usr/local/bin/qmake-qt4" ]; then
qmake-qt4
else
echo "ERROR qmake not found"
fi
fi
}
#
build_plugins ()
{
if [ ! -f "${orig_src}/psi.pro" ]; then
prepare_src
fi
local tmpplugs=${orig_src}/plugins
check_dir ${tmpplugs}
local plugins=$(find ${orig_src}/src/plugins -name '*plugin.pro' -print0 | xargs -0 -n1 dirname)
for pplugin in ${plugins}; do
make_plugin ${pplugin} 2>>${plugbuild_log}
done
echo "*******************************"
echo "Plugins compiled succesfully!!!"
echo "*******************************"
echo "Do you want to install psi+ plugins into ${psi_homeplugdir} [y/n(default)]"
read isinstall
if [ "${isinstall}" == "y" ]; then
check_dir ${psi_homeplugdir}
cp -vf ${buildpsi}/build/plugins/*.so ${psi_homeplugdir}/
fi
echo "********************************"
echo "Plugins installed succesfully!!!"
echo "********************************"
cd ${workdir}
}
#
make_plugin ()
{
if [ ! -z "$1" ]; then
local currdir=$(pwd)
cd "$1"
if [ -d "/usr/lib/ccache/bin" ] || [ -d "/usr/lib64/ccache/bin" ]; then
QMAKE_CCACHE_CMD="QMAKE_CXX=ccache g++"
fi
if [ ! -z "$(ls .obj | grep -e '.o$')" ]; then make && make distclean; fi
qmakecmd -t ${QMAKE_CCACHE_CMD} && make && cp -f *.so ${tmpplugs}/
cd ${currdir}
fi
}
#
fetch_cmake_files ()
{
local repo_url="https://github.com/Vitozz/psi-plus-plugins-cmake.git"
cd ${buildpsi}
if [ ! -d "${cmake_files_dir}" ]; then
check_dir ${cmake_files_dir}
git clone ${repo_url} ${cmake_files_dir}
else
cd ${cmake_files_dir}
git reset --hard
git pull
fi
}
#
build_cmake_plugins ()
{
echo_done() {
echo " "
echo "********************************"
echo "Plugins installed succesfully!!!"
echo "********************************"
echo " "
}
local pl_preffix=${DEF_CMAKE_INST_PREFIX}
local pl_suffix=${DEF_CMAKE_INST_SUFFIX}
fetch_cmake_files
if [ ! -f "${orig_src}/psi.pro" ]; then
prepare_src
fi
check_dir ${orig_src}
cp -rf ${cmake_files_dir}/* ${orig_src}/
cd ${orig_src}
local b_dir=${orig_src}/build
check_dir ${b_dir}
cd ${b_dir}
echo "Do you want to install psi+ plugins into ${psi_homeplugdir} [y/n(default)]"
read isinstall
if [ "${isinstall}" != "y" ]; then
pl_preffix=${orig_src}
pl_suffix="plugins"
fi
local cmake_flags="-DCMAKE_BUILD_TYPE=${DEF_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${pl_preffix} -DPLUGINS_PATH=${pl_suffix} -DBUILD_PLUGINS=${DEF_PLUG_LIST}"
echo " "; echo "Build psi+ plugins using CMAKE started..."; echo " "
cmake ${cmake_flags} ..
make && make install && echo_done
cd ${orig_src}
rm -rf ${b_dir}
}
#
build_deb_package ()
{
if [ ! -f "${orig_src}/psi.pro" ]; then
compile_psiplus
fi
echo "Building Psi+ DEB package with checkinstall"
local rev=$(cd ${buildpsi}/git-plus/; echo $(($(git describe --tags | cut -d - -f 2))))
local desc='Psi is a cross-platform powerful Jabber client (Qt, C++) designed for the Jabber power users.
Psi+ - Psi IM Mod by psi-dev@conference.jabber.ru.'
cd ${orig_src}
echo "${desc}" > description-pak
local requires=' "libaspell15 (>=0.60)", "libc6 (>=2.7-1)", "libgcc1 (>=1:4.1.1)", "libqca2", "libqt4-dbus (>=4.4.3)", "libqt4-network (>=4.4.3)", "libqt4-qt3support (>=4.4.3)", "libqt4-xml (>=4.4.3)", "libqtcore4 (>=4.4.3)", "libqtgui4 (>=4.4.3)", "libstdc++6 (>=4.1.1)", "libx11-6", "libxext6", "libxss1", "zlib1g (>=1:1.1.4)" '
sudo checkinstall -D --nodoc --pkgname=psi-plus --pkggroup=net --pkgversion=${psi_version}.${rev} --pkgsource=${orig_src} --maintainer="thetvg@gmail.com" --requires="${requires}"
cp -f ${orig_src}/*.deb ${buildpsi}
}
#
prepare_spec ()
{
local rev=$(cd ${buildpsi}/git-plus/; echo $(($(git describe --tags | cut -d - -f 2))))
if [ ! -z ${iswebkit} ]; then
webkit="--enable-webkit"
fi
if [ ! -z ${qconf_bin} ] && [ -f "${qconf_bin}" ]; then
qconfcmd=${qconf_bin}
fi
echo "Creating psi.spec file..."
local specfile="Summary: Client application for the Jabber network
Name: psi-plus
Version: ${psi_version}.${rev}
Release: 1
License: GPL
Group: Applications/Internet
URL: http://code.google.com/p/psi-dev/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: openssl-devel, gcc-c++, zlib-devel
%{!?_without_freedesktop:BuildRequires: desktop-file-utils}
%description
Psi is the premiere Instant Messaging application designed for Microsoft Windows,
Apple Mac OS X and GNU/Linux. Built upon an open protocol named Jabber,
si is a fast and lightweight messaging client that utilises the best in open
source technologies. The goal of the Psi project is to create a powerful, yet
easy-to-use Jabber/XMPP client that tries to strictly adhere to the XMPP drafts.
and Jabber JEPs. This means that in most cases, Psi will not implement a feature
unless there is an accepted standard for it in the Jabber community. Doing so
ensures that Psi will be compatible, stable, and predictable, both from an end-user
and developer standpoint.
Psi+ - Psi IM Mod by psi-dev@conference.jabber.ru
%prep
%setup
%build
${qconfcmd}
./configure --prefix=\"%{_prefix}\" --bindir=\"%{_bindir}\" --datadir=\"%{_datadir}\" --qtdir=$QTDIR --enable-plugins ${webkit} --release --no-separate-debug-info
%{__make} %{?_smp_mflags}
%install
%{__rm} -rf %{buildroot}
%{__make} install INSTALL_ROOT=\"%{buildroot}\"
# Install the pixmap for the menu entry
%{__install} -Dp -m0644 iconsets/system/default/logo_128.png \
%{buildroot}%{_datadir}/pixmaps/psi-plus.png ||:
%post
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
%postun
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-, root, root, 0755)
%doc COPYING README TODO
%{_bindir}/psi-plus
#%{_bindir}/psi-plus.debug
%{_datadir}/psi-plus/
%{_datadir}/pixmaps/psi-plus.png
%{_datadir}/applications/psi-plus.desktop
%{_datadir}/icons/hicolor/*/apps/psi-plus.png
%exclude %{_datadir}/psi-plus/COPYING
%exclude %{_datadir}/psi-plus/README
"
local tmp_spec=${buildpsi}/test.spec
usr_spec=${rpmspec}/psi-plus.spec
echo "${specfile}" > ${tmp_spec}
cp -f ${tmp_spec} ${usr_spec}
}
#
build_rpm_package ()
{
prepare_src
prepare_tar
local rev=$(cd ${buildpsi}/git-plus/; echo $(($(git describe --tags | cut -d - -f 2))))
local tar_name=psi-plus-${psi_version}.${rev}
local sources=${rpmsrc}
if [ -f "${sources}/${tar_name}.tar.gz" ]; then
prepare_spec
echo "Building Psi+ RPM package"
cd ${rpmspec}
rpmbuild -ba --clean --rmspec --rmsource ${usr_spec}
local rpm_ready=$(find $HOME/rpmbuild/RPMS | grep psi-plus)
local rpm_src_ready=$(find $HOME/rpmbuild/SRPMS | grep psi-plus)
cp -f ${rpm_ready} ${buildpsi}
cp -f ${rpm_src_ready} ${buildpsi}
fi
}
#
prepare_dev ()
{
local psidev=$buildpsi/psidev
local orig=$psidev/git.orig
local new=$psidev/git
rm -rf $orig
rm -rf $new
cd ${buildpsi}
echo ${psidev}
check_dir ${psidev}
check_dir ${orig}
check_dir ${new}
if [ ! -d ${buildpsi}/git ]; then
down_all
fi
cp -r git/* ${orig}
cp -r git/* ${new}
cd ${psidev}
if [ ! -f deploy ]; then
wget --no-check-certificate "https://raw.github.com/psi-plus/maintenance/master/scripts/posix/deploy" || die "Failed to update deploy";
fi
if [ ! -f mkpatch ]; then
wget --no-check-certificate "https://raw.github.com/psi-plus/maintenance/master/scripts/posix/mkpatch" || die "Failed to update mkpatch";
fi
if [ ! -f psidiff.ignore ]; then
wget --no-check-certificate "https://raw.github.com/psi-plus/maintenance/master/scripts/posix/psidiff.ignore" || die "Failed to update psidiff.ignore";
fi
local patchlist=$(ls ${buildpsi}/git-plus/patches/ | grep diff)
cd ${orig}
echo "Enter maximum patch number to patch orig src"
read patchnumber
for patchfile in ${patchlist}; do
if [ ${patchfile:0:4} -lt ${patchnumber} ]; then
echo ${patchfile}
patch -p1 < ${buildpsi}/git-plus/patches/${patchfile}
fi
done
cd ${new}
echo "Enter maximum patch number to patch work src"
read patchnumber
for patchfile in ${patchlist}; do
if [ ${patchfile:0:4} -lt ${patchnumber} ]; then
echo ${patchfile}
patch -p1 < ${buildpsi}/git-plus/patches/${patchfile}
fi
done
}
#
otr_deb ()
{
prepare_src
cd ${buildpsi}
local otrorigdir=${buildpsi}/plugins/generic/otrplugin
cd ${buildpsi}/plugins/generic
cp -r ${otrorigdir} ${orig_src}/src/plugins/generic
local otrdebdir=${orig_src}/src/plugins/generic/otrplugin
cd ${otrdebdir}
local PREFIX=/usr
local user="Vitaly Tonkacheyev"
local email="thetvg@gmail.com"
local data=$(LANG=en date +'%a, %d %b %Y %T %z')
local year=$(date +'%Y')
cd ${otrdebdir}
local debver=$(grep -Po '\d\.\d\.\d+' src/psiotrplugin.cpp)
#
local control='Source: psi-plus-otrplugin
Section: libs
Priority: optional
Maintainer: Vitaly Tonkacheyev <thetvg@gmail.com>
Build-Depends: debhelper (>= 7), cdbs, libqt4-dev, libtidy-dev, libotr2-dev, libgcrypt11-dev
Standards-Version: 3.8.3
Homepage: https://github.com/psi-plus/plugins
Package: psi-plus-otrplugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libc6 (>=2.7-1), libgcc1 (>=1:4.1.1), libqtcore4 (>=4.6), libqtgui4 (>=4.6), libqt4-xml (>=4.6), libotr2, libgcrypt11, libtidy-0.99-0, libstdc++6 (>=4.1.1), libx11-6, zlib1g (>=1:1.1.4)
Description: Off-The-Record-Messaging plugin for Psi
This is a Off-The-Record-Messaging plugin for the Psi+ instant messenger. Psi+ (aka Psi-dev) is a collection of patches for Psi. Psi+ is available from http://code.google.com/p/psi-dev/.'
local copyright="This work was packaged for Debian by:
${user} <${email}> on ${data}
It was downloaded from:
https://github.com/psi-plus/plugins
Upstream Author(s):
Timo Engel <timo-e@freenet.de>
Copyright:
<Copyright (C) 2007 Timo Engel>
License:
### SELECT: ###
This package 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 2 of the License, or
(at your option) any later version.
### OR ###
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
##########
This package 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 package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in \"/usr/share/common-licenses/GPL-2\".
The Debian packaging is:
Copyright (C) ${year} $user <$email>
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 2 of the License, or
(at your option) any later version.
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here."
local dirs='usr/lib/psi-plus/plugins'
local compat='7'
local rules='#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
config.status: configure
dh_testdir
# Add here commands to configure the package.
./configure --host=$(DEB_HOST_GNU_TYPE)
--build=$(DEB_BUILD_GNU_TYPE)
--prefix=/usr
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/qmake.mk
# Add here any variable or target overrides you need.
QMAKE=qmake-qt4
CFLAGS=-O3
CXXFLAGS=-O3'
local package_sh="#!/bin/bash
set -e
debuild -us -uc
debuild -S -us -uc
su -c pbuilder build ../psi-plus-otrplugin-${debver}.dsc"
local changelog_template="psi-plus-otrplugin (${debver}-1) unstable; urgency=low
* New upstream release see README for details
-- ${user} <${email}> ${data}"
local docs='COPYING
INSTALL
README'
#
builddeb=${orig_src}/src/plugins/generic/psi-plus-otrplugin-${debver}
check_dir ${builddeb}/debian
cp -r ${otrdebdir}/* ${builddeb}
local changefile=${builddeb}/debian/changelog
local rulesfile=${builddeb}/debian/rules
local controlfile=${builddeb}/debian/control
local dirsfile=${builddeb}/debian/dirs
local compatfile=${builddeb}/debian/compat
local copyrightfile=${builddeb}/debian/copyright
local docsfile=${builddeb}/debian/docs
local package_sh_file=${builddeb}/package.sh
echo "${changelog_template}" > ${changefile}
echo "${package_sh}" > ${package_sh_file}
echo "${rules}" > ${rulesfile}
echo "${control}" > ${controlfile}
echo "${dirs}" > ${dirsfile}
echo "${docs}" > ${docsfile}
echo "${compat}" > ${compatfile}
echo "${copyright}" > ${copyrightfile}
#
cd ${builddeb}
qmakecmd
dpkg-buildpackage -rfakeroot
cp -f ../psi-plus-otrplugin_${debver}*.deb $buildpsi
}
#
prepare_plugins_spec ()
{
local specfile="
Summary: ${summary}
Name: ${progname}
Version: ${rpmver}
Release: 1
License: GPL-2
Group: ${group}
URL: ${urlpath}
Source0: ${package_name}
BuildRequires: ${breq}
Requires: psi-plus
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
%description
${desc}
%prep
%setup
%build
cd ${plugdir}
qmake
%{__make} %{?_smp_mflags}
%install
cd ${plugdir}
[ \"%{buildroot}\" != \"/\"] && rm -rf %{buildroot}
%{__make} install INSTALL_ROOT=\"%{buildroot}\"
%clean
[ \"%{buildroot}\" != \"/\" ] && rm -rf %{buildroot}
%files
%defattr(-, root, root, 0755)
%{_libdir}/psi-plus/plugins/${libfile}
${docfiles}
"
echo "${specfile}" > ${rpmspec}/${progname}.spec
}
#
otr_rpm ()
{
local progname="psi-plus-otrplugin"
prepare_src
cd ${buildpsi}
local otrorigdir=${buildpsi}/plugins/generic/otrplugin
local PREFIX="/usr"
local rpmver=$(grep -Po '\d\.\d\.\d+' ${otrorigdir}/src/psiotrplugin.cpp)
local package_name="${progname}-${rpmver}.tar.gz"
local summary="Off-The-Record-Messaging plugin for Psi"
local breq="libotr-devel, libtidy-devel, libgcrypt-devel"
local urlpath="https://github.com/psi-plus/plugins"
local group="Applications/Internet"
local desc="This is a Off-The-Record-Messaging plugin for the Psi+ instant messenger.
Psi+ (aka Psi-dev) is a collection of patches for Psi. Psi+ is available from
http://code.google.com/p/psi-dev/"
local plugdir="generic/otrplugin"
local libfile="libotrplugin.so"
local docfiles="%doc ${plugdir}/README ${plugdir}/COPYING"
#
check_dir ${inst_path}/${progname}-${rpmver}/generic/otrplugin
cp -r ${orig_src}/src/plugins/*.pri ${inst_path}/${progname}-${rpmver}/
cp -r ${orig_src}/src/plugins/include ${inst_path}/${progname}-${rpmver}/
cp -r ${otrorigdir}/* ${inst_path}/${progname}-${rpmver}/generic/otrplugin/
cd ${inst_path}
tar -pczf $package_name ${progname}-${rpmver}
#
prepare_plugins_spec
cp -rf ${package_name} ${rpmsrc}/
rpmbuild -ba --clean --rmspec --rmsource ${rpmspec}/${progname}.spec
echo "Cleaning..."
cd $buildpsi
rm -rf ${inst_suffix}
}
#
get_resources ()
{
cd ${buildpsi}
git clone git://github.com/psi-plus/resources.git
}
#
install_resources ()
{
cd ${buildpsi}
check_dir ${psi_datadir}
if [ ! -d "resources" ]; then
get_resources
fi
cp -rf ${buildpsi}/resources/* ${psi_datadir}/
}
#
install_iconsets ()
{
cd ${buildpsi}
check_dir ${psi_datadir}
if [ -d "resources" ]; then
get_resources
fi
cp -rf ${buildpsi}/resources/iconsets ${psi_datadir}/
}
#
install_skins ()
{
cd ${buildpsi}
check_dir ${psi_datadir}
if [ -d "resources" ]; then