-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.sh
executable file
·871 lines (773 loc) · 28.4 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
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
#!/bin/bash
DIR="$( cd -P "$( dirname "$0" )" && pwd )"
cd "$DIR"
VER="2.5.0"
REBUILD_QT=auto
OPT_PREFIX=""
OPT_QMAKESPEC=""
OPT_DEBUG=yes
OPT_SQLLOG=no
OPT_FLFCGI=no
OPT_HOARD=no
# Hoard se desactiva por defecto. Eneboo funciona principalmente con un
# único hilo y hoard es un "memory allocator" orientado a mejorar la
# velocidad de malloc/free para multihilo, en sistemas con más de un
# núcleo.
OPT_QWT=yes
OPT_NEBULA=no
OPT_DIGIDOC=yes
OPT_WIN64=no
OPT_QWS=no
OPT_MULTICORE=yes
OPT_AQ_DEBUG=no
OPT_QUICK_CLIENT=no
OPT_MAKE_SILENT=yes
OPT_DEBUGGER=no
OPT_NEBULA_BUILD=no
OPT_FIXXP=no
OPT_CONSOLE=no
QT_CHECK=" -DQT_CHECK_NULL"
QT_DEBUG=""
QT_DEBUG_OPT="-release"
QSADIR=qsa
QT_CONFIG_VERBOSE=""
if [ -e ".svn" -a "$BUILD_NUMBER" == "" ]; then
BUILD_NUMBER="$(svnversion . -n)"
fi
if [ -e ".git" -a "$BUILD_NUMBER" == "" ]; then
APPEND="$(git diff --quiet -- src/flbase || echo '-dev')"
BUILD_NUMBER="$(git describe --tags)$APPEND"
fi
if [ "$BUILD_NUMBER" == "" ]; then
SRC_VERSION="${DIR##*/eneboo-}"
if [ "$SRC_VERSION" != "$DIR" -a "$SRC_VERSION" != "" ]; then
BUILD_NUMBER=$SRC_VERSION
fi
fi
if [ "$BUILD_NUMBER" == "" ]; then
BUILD_NUMBER="unknown-$(date +%Y-%m-%d)"
fi
for a in "$@"; do
case "$a" in
-nebula)
OPT_NEBULA_BUILD=yes
;;
-verbose)
OPT_MAKE_SILENT=no
;;
-silent)
OPT_MAKE_SILENT=yes
;;
-static)
QT_DEBUG="$QT_DEBUG -static"
;;
-quick)
OPT_QUICK_CLIENT=yes
;;
-dbadmin)
OPT_QUICK_CLIENT=no
OPT_DEBUGGER=yes
;;
-single)
OPT_MULTICORE=no
;;
-rebuild-qt)
REBUILD_QT=yes
;;
-no-debugger)
OPT_DEBUGGER=no
;;
-debug)
OPT_DEBUG=yes
;;
-no-debug)
OPT_DEBUG=no
BUILD_NUMBER="$BUILD_NUMBER-nodbg"
;;
-debugger)
OPT_DEBUGGER=yes
BUILD_NUMBER="$BUILD_NUMBER-debugger"
;;
-aqdebug)
OPT_AQ_DEBUG=yes
;;
-no-check)
QT_CHECK="-DQT_NO_CHECK "
;;
-check)
QT_CHECK="-DQT_CHECK_STATE -DQT_CHECK_RANGE -DQT_CHECK_NULL -DQT_CHECK_MATH "
;;
-thread)
QT_DEBUG="$QT_DEBUG -DQT_THREAD_SUPPORT "
;;
-qtdebug)
QT_DEBUG_OPT="-debug"
BUILD_NUMBER="$BUILD_NUMBER-qtdebug"
;;
-sqllog)
OPT_SQLLOG=yes
;;
-hoard)
OPT_HOARD=yes
;;
-no-hoard)
OPT_HOARD=no
;;
-console)
OPT_CONSOLE=yes
;;
-qwt)
OPT_QWT=yes
;;
-nebula)
OPT_NEBULA=yes
OPT_QUICK=yes
VERSION="$VER-Nebula Build $BUILD_NUMBER"
;;
-digidoc)
OPT_DIGIDOC=yes
;;
-no-digidoc)
OPT_DIGIDOC=no
;;
-win64)
OPT_WIN64=yes
;;
-flfcgi)
OPT_FLFCGI=yes
;;
-fixxp)
OPT_FIXXP=yes
;;
-qws)
OPT_QWS=yes
OPT_QMAKESPEC="qws/linux-generic-g++"
export QMAKESPEC=$OPT_QMAKESPEC
;;
-prefix|-platform)
VAR=`echo $a | sed "s,^-\(.*\),\1,"`
shift
VAL="yes"
;;
*)
if [ "$VAL" == "yes" ];then
VAL=$a
fi
;;
esac
case "$VAR" in
prefix)
if [ $VAL != "yes" ];then
OPT_PREFIX=$VAL
fi
;;
platform)
if [ $VAL != "yes" ];then
OPT_QMAKESPEC=$VAL
export QMAKESPEC=$OPT_QMAKESPEC
fi
;;
esac
done
QT_DEBUG="$QT_DEBUG $QT_CHECK"
CMD_MAKE="make"
if [ "$OPT_MAKE_SILENT" == "yes" ]; then
CMD_MAKE="$CMD_MAKE -s "
else
QT_CONFIG_VERBOSE="-v"
fi
MAKE_INSTALL=""
QT_DEBUG="$QT_DEBUG $QT_DEBUG_OPT"
BUILD_MACX="no"
if [ "$OPT_QMAKESPEC" == "macx-g++" ]; then
BUILD_MACX="yes"
OPT_MULTICORE="no"
OPT_DIGIDOC="no"
fi
if [ "$OPT_QMAKESPEC" == "macx-g++-cross" ]; then
BUILD_MACX="yes"
fi
if [ "$OPT_QUICK_CLIENT" == "yes" ]; then
QT_DEBUG="$QT_DEBUG -DFL_QUICK_CLIENT"
BUILD_NUMBER="$BUILD_NUMBER-quick"
else
BUILD_NUMBER="$BUILD_NUMBER-dba"
fi
if [ "$OPT_NEBULA_BUILD" == "yes" ]; then
QT_DEBUG="$QT_DEBUG -DAQ_NEBULA_BUILD"
BUILD_NUMBER="$BUILD_NUMBER-nebula"
fi
if [ "$OPT_MULTICORE" == "yes" ]; then
PROCESSORS=$(expr $(cat /proc/cpuinfo | grep processor | tail -n 1 | sed "s/.*:\(.*\)/\1/") + 1)
# CMD_MAKE="make -k -j $PROCESSORS -s "
CMD_MAKE="$CMD_MAKE -k -j $PROCESSORS "
fi
unlink src/libmysql 2>/dev/null
if [ "$BUILD_MACX" == "no" ]; then
if [ "$OPT_QWS" = "no" ]; then
QT_DEBUG="$QT_DEBUG -DQT_NO_COMPAT"
fi
ln -s libmysql_std src/libmysql
else
ln -s libmysql_macosx src/libmysql
fi
if [ "$OPT_QMAKESPEC" == "" ]; then
case `uname -m` in
amd64 | x86_64)
OPT_QMAKESPEC="linux-g++-64"
export QMAKESPEC=$OPT_QMAKESPEC
;;
*)
OPT_QMAKESPEC="linux-g++"
export QMAKESPEC=$OPT_QMAKESPEC
;;
esac
fi
VERSION="$VER (Build $BUILD_NUMBER)"
BUILD_KEY="$VER-Build"
echo -e "\nUtilidad de compilación e instalación de Eneboo $VERSION ( - ESTABLE - )"
echo -e "(C) 2003-2013 InfoSiAL, S.L. http://infosial.com - http://abanq.org\n"
echo -e "(C) 2012 Gestiweb Integración de Soluciones Web S.L. http://www.gestiweb.com \n"
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" -o "$OPT_QMAKESPEC" == "macx-g++-cross" ];then
export CC=${CROSS}gcc
export CXX=${CROSS}g++
export LD=${CROSS}ld
export AR=${CROSS}ar
export AS=${CROSS}as
export NM=${CROSS}nm
export STRIP=${CROSS}strip
export RANLIB=${CROSS}ranlib
export DLLTOOL=${CROSS}dlltool
export OBJDUMP=${CROSS}objdump
export RESCOMP=${CROSS}windres
export WINDRES=${CROSS}windres
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
OPT_PREFIX="$PWD/src/qt"
BUILD_KEY="$VER-Build-mingw32-4.2"
else
OPT_PREFIX="$PWD/src/qt"
BUILD_KEY="$VER-$CROSS"
fi
else
MAKE_INSTALL="install"
fi
if [ "$OPT_PREFIX" == "" ]
then
echo -e "AVISO : No se ha especificado directorio de instalación"
echo -e "Uso : $0 directorio_de_instalacion\n"
DIRINST=$PWD/eneboo-build
echo -e "Utilizando por defecto el directorio $DIRINST\n"
else
DIRINST=$OPT_PREFIX
fi
mkdir -p $DIRINST
if [ ! -w $DIRINST ]
then
echo -e "ERROR : Actualmente no tienes permisos de escritura en el directorio de instalación ($DIRINST)."
echo -e "Solución : Cambia los permisos o ejecuta este script como un usuario que tenga permisos de escritura en ese directorio.\n"
exit 1
fi
BASEDIR=$PWD
PREFIX=$DIRINST
echo -e "Directorio de instalación : $PREFIX\n"
echo -e "El comando MAKE es: $CMD_MAKE\n"
echo -e "Estableciendo configuración...\n"
cd $BASEDIR/src/libdigidoc/openssl/crypto
rm -f opensslconf.h
if [ "$OPT_QMAKESPEC" == "linux-g++-64" ]; then
ln -s opensslconf.h.64 opensslconf.h
else
ln -s opensslconf.h.32 opensslconf.h
fi
cd $BASEDIR
rm -f $HOME/.qmake.cache
export QTDIR=$BASEDIR/src/qt
mkdir $QTDIR/bin 2>/dev/null
if [ ! -f $QTDIR/include/qglobal.h ]
then
cd $QTDIR
$CMD_MAKE -f Makefile.cvs
cd $BASEDIR
fi
version=$(cat $QTDIR/include/qglobal.h | grep "QT_VERSION_STR" | sed "s/.*\"\(.*\)\"/\1/g")
echo -e "Versión de Qt... $version\n"
echo -e "Compilando qmake y moc...\n"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QTDIR/lib:../lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$QTDIR/lib:../lib
cd $QTDIR
if [ "$OPT_HOARD" = "yes" ]
then
echo "CONFIG *= enable_hoard" >> tools/designer/app/hoard.pri
fi
if [ "$REBUILD_QT" = "auto" ]
then
if $CMD_MAKE qmake-install 2>/dev/null
then
REBUILD_QT=no
else
REBUILD_QT=yes
fi
fi
export ORIGIN=\\\$\$ORIGIN
if [ "$REBUILD_QT" = "yes" ]
then
$CMD_MAKE confclean 2>/dev/null
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
cd $BASEDIR
TMP_QTDIR=$(echo $QTDIR | sed "s/\//\\\\\\\\\\\\\\//g")
cat qconfig/qconfig.h.in | sed "s/@BKEY@/$BUILD_KEY/" > qconfig/qconfig.h
cp -fv qconfig/qconfig.h src/qt/include
cp -fv qconfig/qmodules.h src/qt/include
cd $QTDIR
if [ "$OPT_WIN64" = "yes" ]
then
cp -fv mkspecs/win32-g++-cross/qmake.conf-w64 mkspecs/win32-g++-cross/qmake.conf
cp -fv mkspecs/win32-g++-cross/qtcrtentrypoint.cpp-w64 mkspecs/win32-g++-cross/qtcrtentrypoint.cpp
else
cp -fv mkspecs/win32-g++-cross/qmake.conf-w32 mkspecs/win32-g++-cross/qmake.conf
cp -fv mkspecs/win32-g++-cross/qtcrtentrypoint.cpp-w32 mkspecs/win32-g++-cross/qtcrtentrypoint.cpp
fi
./configure --win32 $QT_CONFIG_VERBOSE -prefix $PREFIX -L$PREFIX/lib $QT_DEBUG -thread -stl -no-pch -no-exceptions -platform linux-g++ \
-xplatform win32-g++-cross -buildkey $BUILD_KEY -disable-opengl -no-cups -no-nas-sound \
-no-nis -qt-libjpeg -qt-gif -qt-libmng -qt-libpng -qt-imgfmt-png -qt-imgfmt-jpeg -qt-imgfmt-mng
else
cp -vf Makefile.qt Makefile
if [ "$BUILD_MACX" == "yes" ]; then
mkdir -p $DIRINST/lib
if [ "$OPT_QMAKESPEC" == "macx-g++" ]; then
./configure $QT_CONFIG_VERBOSE -platform $OPT_QMAKESPEC $QT_DEBUG -prefix $PREFIX -thread -stl -no-pch -no-exceptions \
-buildkey $BUILD_KEY -disable-opengl -no-cups -no-ipv6 -no-nas-sound -no-nis -qt-libjpeg \
-qt-gif -qt-libmng -qt-libpng -qt-imgfmt-png -qt-imgfmt-jpeg -qt-imgfmt-mng || exit 1
else
./configure $QT_CONFIG_VERBOSE -platform linux-g++ -xplatform $OPT_QMAKESPEC $QT_DEBUG -prefix $PREFIX -thread -stl -no-pch \
-no-exceptions -buildkey $BUILD_KEY -disable-opengl -no-cups -no-ipv6 -no-nas-sound -no-nis -qt-libjpeg \
-qt-gif -qt-libmng -qt-libpng -qt-imgfmt-png -qt-imgfmt-jpeg -qt-imgfmt-mng || exit 1
fi
else
# Configure informa de que no se encuentra MySQL o PostgreSQL, pero si se agrega:
# -I/usr/include/mysql/ -I/usr/include/postgresql/
# , se incluyen, pero luego aparece un error para libpg: LOCALEDIR undefined.
# rpath: -R $ORIGIN/../lib , sirve para que en Linux busque las librerías (también) de forma relativa al ejecutable del programa.
# ... pero el símbolo dólar ($) da problemas tanto en bash como en make. En bash hay que escaparlo, y en make hay que duplicar el símbolo dolar.
# ... hacer uso del flag "-continue" puede desembocar en que no se aplique el -rpath.
if [ "$OPT_QWS" = "no" ]; then
./configure $QT_CONFIG_VERBOSE --x11 -platform $OPT_QMAKESPEC -prefix $PREFIX -R'$$(ORIGIN)/../lib' -R'$$(ORIGIN)/../../lib' -L$PREFIX/lib $QT_DEBUG -thread -stl -L/usr/lib/i386-linux-gnu -L/usr/lib/x86_64-linux-gnu \
-no-pch -no-exceptions -xinerama -buildkey $BUILD_KEY -disable-opengl -no-cups \
-no-nas-sound -no-nis -qt-libjpeg -qt-gif -qt-libmng -qt-libpng -qt-imgfmt-png -qt-imgfmt-jpeg -qt-imgfmt-mng || exit 1
else
./configure $QT_CONFIG_VERBOSE -depths 8,16,32 -qvfb -qt-gfx-vnc -platform $OPT_QMAKESPEC -prefix $PREFIX -R'$$(ORIGIN)/../lib' -R'$$(ORIGIN)/../../lib' -L$PREFIX/lib $QT_DEBUG -thread -stl -L/usr/lib/i386-linux-gnu -L/usr/lib/x86_64-linux-gnu \
-no-pch -no-exceptions -buildkey $BUILD_KEY -disable-opengl -no-cups \
-no-nas-sound -no-nis -qt-libjpeg -qt-gif -qt-libmng -qt-libpng -qt-imgfmt-png -qt-imgfmt-jpeg -qt-imgfmt-mng || exit 1
fi
fi
fi
fi
$CMD_MAKE qmake-install || exit 1
$CMD_MAKE moc-install || exit 1
cd $BASEDIR
export PATH=$PREFIX/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PREFIX/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib
echo -e "\nComprobando qmake...\n"
$QTDIR/bin/qmake -v > /dev/null
if [ $? = 154 ]
then
echo -e "OK : qmake encontrado\n"
else
echo -e "ERROR : No se encuentra qmake, esta utilidad se proporciona con las Qt."
echo -e " Comprueba que se encuentra en la ruta de búsqueda (variable $PATH).\n"
exit 1
fi
cd $BASEDIR
mkdir -p $PREFIX/share/eneboo/images
mkdir -p $PREFIX/share/eneboo/forms
mkdir -p $PREFIX/share/eneboo/tables
mkdir -p $PREFIX/share/eneboo/translations
mkdir -p $PREFIX/share/eneboo/scripts
mkdir -p $PREFIX/share/eneboo/queries
mkdir -p $PREFIX/share/eneboo/reports
mkdir -p $PREFIX/share/eneboo/tmp
mkdir -p $PREFIX/share/eneboo/doc
mkdir -p $PREFIX/share/eneboo/packages
mkdir -p $PREFIX/lib
mkdir -p $PREFIX/bin
if [ "$AQ_CIN" == "" ]; then
AQ_CIN="C = C"
fi
if [ "$AQ_PACK_VER" == "" ]; then
AQ_PACK_VER="(qstrlen(V) > 0 && qstrcmp(AQPACKAGER_VERSION, V) == 0)"
fi
echo -e "\n\nRecopilando datos de la compilación \n"
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" -o "$OPT_QMAKESPEC" == "macx-g++-cross" ];then
DATOS_CROSS="Versión CROSS-GCC: $CC ( $(${CROSS}gcc -v 2> temp && cat temp | grep 'gcc ver' | cut -f3 -d ' ') ) \n"
fi
DATOS_COMPILACION="\n Versión eneboo: $VERSION \n Mkspecs: $OPT_QMAKESPEC \n $DATOS_CROSS Make: $CMD_MAKE \n Versión GCC: $(gcc -v 2> temp && cat temp | grep 'gcc ver' | cut -f3 -d ' ') \n\n Opciones de Compilación : \n QWT: $OPT_QWT \n DIGIDOC: $OPT_DIGIDOC \n MULTICORE: $OPT_MULTICORE \n HOARD: $OPT_HOARD \n REBUILD_QT: $REBUILD_QT \n QT_DEBUG_OPT: $QT_DEBUG_OPT"
cat > AQConfig.h <<EOF
// ** $(date +%d%m%Y):$PREFIX -> AQConfig.h
// ** AQConfig.h Generated by $0
// ** WARNING! All changes made in this file will be lost!
#ifndef AQCONFIG_H_
#define AQCONFIG_H_
#include "qplatformdefs.h"
#include "AQGlobal.h"
#define AQ_DIRAPP AQConfig::aqDirApp
#define AQ_PREFIX AQ_DIRAPP
#define AQ_QTDIR AQ_DIRAPP
#define AQ_KEYBASE AQConfig::aqKeyBase
#define AQ_DATA AQConfig::aqData
#define AQ_LIB AQConfig::aqLib
#define AQ_BIN AQConfig::aqBin
#define AQ_USRHOME AQConfig::aqUsrHome
#define AQ_VERSION "$VERSION"
#define AQ_CIN(C) $AQ_CIN
#define AQPACKAGER_VERSION_CHECK(V) $AQ_PACK_VER
#define ENB_DATOS_COMP "$DATOS_COMPILACION"
class QApplication;
class FLApplication;
class AQ_EXPORT AQConfig
{
public:
static QString aqDirApp;
static QString aqKeyBase;
static QString aqData;
static QString aqLib;
static QString aqBin;
static QString aqUsrHome;
private:
static void init(QApplication *);
friend class FLApplication;
};
#endif /*AQCONFIG_H_*/
EOF
cat > AQConfig.cpp <<EOF
// ** $(date +%d%m%Y):$PREFIX -> AQConfig.cpp
// ** AQConfig.cpp Generated by $0
// ** WARNING! All changes made in this file will be lost!
#include <qapplication.h>
#include <qdir.h>
#include "AQConfig.h"
AQ_EXPORT QString AQConfig::aqDirApp;
AQ_EXPORT QString AQConfig::aqKeyBase;
AQ_EXPORT QString AQConfig::aqData;
AQ_EXPORT QString AQConfig::aqLib;
AQ_EXPORT QString AQConfig::aqBin;
AQ_EXPORT QString AQConfig::aqUsrHome;
void AQConfig::init(QApplication *aqApp)
{
#if defined(Q_OS_MACX)
aqDirApp = QDir::cleanDirPath(aqApp->applicationDirPath() + QString::fromLatin1("/../../../.."));
#else
aqDirApp = QDir::cleanDirPath(aqApp->applicationDirPath() + QString::fromLatin1("/.."));
#endif
aqKeyBase = QString::fromLatin1("Eneboo/");
aqData = aqDirApp + QString::fromLatin1("/share/eneboo");
aqLib = aqDirApp + QString::fromLatin1("/lib");
aqBin = aqDirApp + QString::fromLatin1("/bin");
aqUsrHome = QDir::cleanDirPath(QDir::home().absPath());
}
EOF
echo "include(./includes.pri)" > settings.pro
echo "PREFIX = $PREFIX" >> settings.pro
echo "ROOT = $BASEDIR" >> settings.pro
echo "INCLUDEPATH *= $PREFIX/include" >> settings.pro
echo "INCLUDEPATH *= $BASEDIR/src/qt/src/tmp" >> settings.pro
echo "CONFIG += warn_off" >> settings.pro
echo "AQSSLVERSION = 0.9.8" >> settings.pro
echo "DEFINES *= AQSTRSSLVERSION=\\\"098\\\"" >> settings.pro
#echo "DEFINES *= AQ_NO_PRINT_FUN" >> settings.pro
#echo "DEFINES *= AQ_NO_DEBUG_FUN" >> settings.pro
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
if [ "$OPT_DEBUG" == "yes" ];then
echo "OBJECTS_DIR = .o/debug-shared-mt/" >> settings.pro
echo "MOC_DIR = .moc/debug-shared-mt/" >> settings.pro
else
echo "OBJECTS_DIR = .o/release-shared-mt/" >> settings.pro
echo "MOC_DIR = .moc/release-shared-mt/" >> settings.pro
fi
fi
if [ "$CROSS" == "i686-apple-darwin8-" -o "$CROSS" == "powerpc-apple-darwin8-" ];then
echo "DEFINES *= SQLITE_WITHOUT_ZONEMALLOC" >> settings.pro
fi
if [ "$OPT_DEBUG" = "yes" ]
then
echo "CONFIG *= debug" >> settings.pro
echo "DEFINES *= FL_DEBUG" >> settings.pro
fi
if [ "$OPT_DEBUGGER" = "yes" ]
then
if [ "$OPT_DEBUG" = "no" ]
then
echo "DEFINES *= FL_DEBUG" >> settings.pro
fi
echo "DEFINES *= QSDEBUGGER QSDEBUGGER_VISUAL AQ_DEBUGGER FL_DEBUGGER" >> settings.pro
fi
if [ "$OPT_AQ_DEBUG" = "yes" ]
then
echo "DEFINES *= AQ_DEBUG" >> settings.pro
fi
if [ "$OPT_NEBULA" = "yes" ]
then
echo "DEFINES *= AQ_NEBULA_BUILD" >> settings.pro
echo "CONFIG *= aq_nebula_build" >> settings.pro
echo "exists(../../../nebula_settings.pro):include(../../../nebula_settings.pro)" >> settings.pro
fi
if [ "$OPT_SQLLOG" = "yes" ]
then
echo "DEFINES *= FL_SQL_LOG" >> settings.pro
fi
if [ "$OPT_QWT" = "yes" ]
then
echo "CONFIG *= enable_qwt" >> settings.pro
echo "DEFINES *= FL_QWT" >> settings.pro
fi
if [ "$OPT_DIGIDOC" = "yes" ]
then
echo "CONFIG *= enable_digidoc" >> settings.pro
echo "DEFINES *= FL_DIGIDOC" >> settings.pro
fi
if [ "$OPT_WIN64" = "yes" ]
then
echo "CONFIG *= enable_win64" >> settings.pro
echo "DEFINES *= AQ_WIN64" >> settings.pro
fi
if [ "$OPT_FIXXP" = "yes" ]
then
echo "DEFINES *= ENEBOO_FIXXP" >> settings.pro
fi
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
# pthread
cd $BASEDIR/src/pthreads
$QTDIR/bin/qmake pthreads.pro
$CMD_MAKE || exit 1
mkdir -p $BASEDIR/src/qt/src/tmp/
cp -fv pthread.h $BASEDIR/src/qt/src/tmp/
cp -fv semaphore.h $BASEDIR/src/qt/src/tmp/
cp -fv sched.h $BASEDIR/src/qt/src/tmp/
cd $BASEDIR
# flfcgi para windows
if [ ! -f /opt/mac/cross/flfastcgi_includes/fastcgi.h -a "$OPT_FLFCGI" = "yes" ]; then
OPT_FLFCGI=no
else
cp -fv /opt/mac/cross/flfastcgi_includes/* $BASEDIR/src/qt/include
cp -fv /opt/mac/cross/spawn-fcgi.exe $BASEDIR/src/qt/bin/spawn-fcgi.exe
if [ "$OPT_WIN64" = "yes" ];then
cp -fv /opt/mac/cross/libfcgi_64.dll $BASEDIR/src/qt/lib/libfcgi.dll
cp -fv /opt/mac/cross/libfcgi_64.dll $BASEDIR/src/qt/bin/libfcgi.dll
else
cp -fv /opt/mac/cross/libfcgi_32.dll $BASEDIR/src/qt/lib/libfcgi.dll
cp -fv /opt/mac/cross/libfcgi_32.dll $BASEDIR/src/qt/bin/libfcgi.dll
fi
fi
fi
if [ "$OPT_FLFCGI" = "yes" ]
then
echo "CONFIG *= enable_flfcgi" >> settings.pro
fi
if [ "$OPT_CONSOLE" = "yes" ]
then
echo "CONFIG *= enable_console" >> settings.pro
fi
if [ "$OPT_HOARD" = "yes" ]
then
echo "CONFIG *= enable_hoard" >> settings.pro
echo "DEFINES *= FL_HOARD" >> settings.pro
echo -e "\nCompilando Hoard...\n"
cd $BASEDIR/src/hoard
$QTDIR/bin/qmake hoard.pro
$CMD_MAKE || exit 1
cd $BASEDIR
fi
echo -e "\nCompilando Qt ($QTDIR) ...\n"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QTDIR/lib:$PREFIX/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$QTDIR/lib:$PREFIX/lib
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
export QTDIR=$BASEDIR/src/qt
cd $QTDIR/src
$QTDIR/bin/qmake -spec $QTDIR/mkspecs/win32-g++-cross -o Makefile.main qtmain.pro
$CMD_MAKE -f Makefile.main || exit 1
fi
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
cd $QTDIR/tools/designer/uic
$CMD_MAKE || exit 1
fi
if [ "$OPT_QMAKESPEC" == "macx-g++-cross" ];then
case `uname -m` in
amd64 | x86_64)
ln -s /opt/mac/cross/uic_64 $PWD/src/qt/bin/uic
;;
*)
ln -s /opt/mac/cross/uic_32 $PWD/src/qt/bin/uic
;;
esac
ln -s /opt/mac/SDKs/MacOSX10.4u.sdk/usr/lib/libiconv.dylib $PWD/src/qt/lib/libiconv.dylib
if [ "$CROSS" == "i686-apple-darwin8-" ];then
ln -s /opt/mac/cross/libz_i686.dylib $PWD/src/qt/lib/libz.dylib
else
ln -s /opt/mac/cross/libz.1.2.7_ppc.dylib $PWD/src/qt/lib/libz.dylib
fi
fi
cd $QTDIR
$CMD_MAKE $MAKE_INSTALL || exit 1
export QTDIR=$PREFIX
echo "Compilando QSA..."
cd $BASEDIR/src/$QSADIR
cp -fv ../qt/.qmake.cache .qmake.cache
cp -fv ../qt/.qmake.cache src/$QSADIR/
cp -fv ../qt/.qmake.cache src/plugin/
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" -o "$OPT_QMAKESPEC" == "macx-g++-cross" ];then
cd configure2
export QTDIR=/usr/share/qt3
/usr/bin/qmake-qt3 -nocache -spec linux-g++ configure2.pro
$CMD_MAKE || exit 1
export QTDIR=$PREFIX
cd $BASEDIR/src/qt
for license in LICENSE.*
do
mv "$license" "old_license${license#LICENSE}"
done
rm -fr LICENSE.*
touch LICENSE
# svn up 2> /dev/null
cd $BASEDIR/src/$QSADIR
rm -fr $BASEDIR/src/qt/LICENSE
for license in $BASEDIR/src/qt/old_license.*
do
mv "$license" "LICENSE${license#$BASEDIR/src/qt/old_license}"
done
./configure2/configure2
$QTDIR/bin/qmake CONFIG+="shared"
else
./configure
fi
$CMD_MAKE || exit 1
$CMD_MAKE $MAKE_INSTALL || exit 1
# ----> para que sirve tanto make?
#$CMD_MAKE
#$CMD_MAKE $MAKE_INSTALL
#$CMD_MAKE
#$CMD_MAKE $MAKE_INSTALL
# <----------------------
cd $BASEDIR
echo ""
echo -e "Creando Makefiles con qmake...\n"
cp -f src/qt/.qmake.cache .qmake.cache
cp -f src/qt/.qmake.cache src/advance/
cp -f src/qt/.qmake.cache src/qwt/
cp -f src/qt/.qmake.cache src/qwt/designer
cp -f src/qt/.qmake.cache src/barcode/
cp -f src/qt/.qmake.cache src/flbase/
cp -f src/qt/.qmake.cache src/fllite/
cp -f src/qt/.qmake.cache src/flbase/
cp -f src/qt/.qmake.cache src/kugar/
cp -f src/qt/.qmake.cache src/sqlite/
cp -f src/qt/.qmake.cache src/libpq/
cp -f src/qt/.qmake.cache src/dbf/
cp -f src/qt/.qmake.cache src/plugins/designer/flfielddb/
cp -f src/qt/.qmake.cache src/plugins/designer/fltabledb/
cp -f src/qt/.qmake.cache src/plugins/sqldrivers/sqlite/
cp -f src/qt/.qmake.cache src/plugins/sqldrivers/psql/
cp -f src/qt/.qmake.cache src/plugins/styles/bluecurve/
echo $QTDIR/bin/qmake user.pro
$QTDIR/bin/qmake user.pro
#echo $QTDIR/bin/qmake src/src.pro
#$QTDIR/bin/qmake src.pro
echo -e " * * * Compilando Eneboo ...\n"
cd src/flbase
$QTDIR/bin/qmake flbase.pro
if [ "$OPT_QMAKESPEC" == "win32-g++-cross" ];then
$CMD_MAKE mocables || exit 1
else
$CMD_MAKE uicables || exit 1
fi
cd $BASEDIR
# A veces (en win32) no compila correctamente qwt, porque compila antes el designer plugin de qwt que la propia librería.
# , por eso, esperamos que el make falle y lo re-ejecutamos, para que complete.
$CMD_MAKE || { $CMD_MAKE || exit 1; }
$CMD_MAKE $MAKE_INSTALL
make -s $MAKE_INSTALL
cd $BASEDIR/src/libdigidoc/openssl/crypto
rm -f opensslconf.h
ln -s opensslconf.h.32 opensslconf.h
cd $BASEDIR
if [ "$BUILD_MACX" == "yes" ];then
echo -e "\nConfigurando packete app ...\n"
CMD_INST_NAME_TOOL=${CROSS}install_name_tool
${CROSS}install_name_tool -change libqsa.1.dylib @executable_path/../../../../lib/libqsa.1.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libqwt.5.dylib @executable_path/../../../../lib/libqwt.5.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libflbase.2.dylib @executable_path/../../../../lib/libflbase.2.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libadvance.0.dylib @executable_path/../../../../lib/libadvance.0.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libflmail.1.dylib @executable_path/../../../../lib/libflmail.1.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libhoard.3.dylib @executable_path/../../../../lib/libhoard.3.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libcrypto.0.dylib @executable_path/../../../../lib/libcrypto.0.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change liblibdigidoc.2.dylib @executable_path/../../../../lib/liblibdigidoc.2.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libssl.0.dylib @executable_path/../../../../lib/libssl.0.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libxml2.2.dylib @executable_path/../../../../lib/libxml2.2.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libxslt.1.dylib @executable_path/../../../../lib/libxslt.1.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $PREFIX/bin/designer.app/Contents/MacOS/designer
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $PREFIX/bin/linguist.app/Contents/MacOS/linguist
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $PREFIX/bin/lupdate
${CROSS}install_name_tool -change libexslt.0.dylib @executable_path/../../../../lib/libexslt.0.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libxsltproc.1.dylib @executable_path/../../../../lib/libxsltproc.1.dylib $PREFIX/bin/Eneboo.app/Contents/MacOS/Eneboo
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $PREFIX/bin/kudesigner.app/Contents/MacOS/kudesigner
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $PREFIX/bin/teddy.app/Contents/MacOS/teddy
mkdir -p $PREFIX/bin/designer.app/Contents/plugins/designer
cp -f $PREFIX/plugins/designer/*.dylib $PREFIX/bin/designer.app/Contents/plugins/designer 2> /dev/null
for i in $(find $PREFIX -type f -name "*.dylib" -print)
do
${CROSS}install_name_tool -change libqsa.1.dylib @executable_path/../../../../lib/libqsa.1.dylib $i
${CROSS}install_name_tool -change libqt-mt.3.dylib @executable_path/../../../../lib/libqt-mt.3.dylib $i
${CROSS}install_name_tool -change libqwt.5.dylib @executable_path/../../../../lib/libqwt.5.dylib $i
${CROSS}install_name_tool -change libflbase.2.dylib @executable_path/../../../../lib/libflbase.2.dylib $i
${CROSS}install_name_tool -change libadvance.0.dylib @executable_path/../../../../lib/libadvance.0.dylib $i
${CROSS}install_name_tool -change libkdefxx.1.dylib @executable_path/../../../../lib/libkdefxx.1.dylib $i
${CROSS}install_name_tool -change libpq.4.dylib @executable_path/../../../../lib/libpq.4.dylib $i
${CROSS}install_name_tool -change libsqlite.2.dylib @executable_path/../../../../lib/libsqlite.2.dylib $i
${CROSS}install_name_tool -change libmysqlclient.15.dylib @executable_path/../../../../lib/libmysqlclient.15.dylib $i
${CROSS}install_name_tool -change libflmail.1.dylib @executable_path/../../../../lib/libflmail.1.dylib $i
${CROSS}install_name_tool -change libcrypto.0.dylib @executable_path/../../../../lib/libcrypto.0.dylib $i
${CROSS}install_name_tool -change liblibdigidoc.2.dylib @executable_path/../../../../lib/liblibdigidoc.2.dylib $i
${CROSS}install_name_tool -change libssl.0.dylib @executable_path/../../../../lib/libssl.0.dylib $i
${CROSS}install_name_tool -change libxml2.2.dylib @executable_path/../../../../lib/libxml2.2.dylib $i
${CROSS}install_name_tool -change libxslt.1.dylib @executable_path/../../../../lib/libxslt.1.dylib $i
${CROSS}install_name_tool -change libexslt.0.dylib @executable_path/../../../../lib/libexslt.0.dylib $i
${CROSS}install_name_tool -change libxsltproc.1.dylib @executable_path/../../../../lib/libxsltproc.1.dylib $i
done
fi
if [ "$OPT_DEBUG" = "no" -a "$OPT_QMAKESPEC" == "win32-g++-cross" ]; then
${CROSS}strip --strip-unneeded $PREFIX/bin/* 2> /dev/null
${CROSS}strip --strip-unneeded $PREFIX/lib/* 2> /dev/null
${CROSS}strip --strip-unneeded $PREFIX/plugins/designer/* 2> /dev/null
${CROSS}strip --strip-unneeded $PREFIX/plugins/sqldrivers/* 2> /dev/null
${CROSS}strip --strip-unneeded $PREFIX/plugins/styles/* 2> /dev/null
fi
if [ "$OPT_DEBUG" = "no" -a "$OPT_QMAKESPEC" != "win32-g++-cross" -a "$BUILD_MACX" == "no" ]
then
strip --strip-unneeded $PREFIX/bin/* 2> /dev/null
strip --strip-unneeded $PREFIX/lib/* 2> /dev/null
strip --strip-unneeded $PREFIX/plugins/designer/* 2> /dev/null
strip --strip-unneeded $PREFIX/plugins/sqldrivers/* 2> /dev/null
strip --strip-unneeded $PREFIX/plugins/styles/* 2> /dev/null
if [ "$OPT_NEBULA" != "yes" ]
then
cd src/translations
./update.sh 2> /dev/null
cd ../..
fi
fi
echo -e "\nTerminando compilación...\n"
cp -f ./src/fllite/images/icon*.png $PREFIX/share/eneboo/images 2> /dev/null
cp -f ./src/forms/*.ui $PREFIX/share/eneboo/forms 2> /dev/null
cp -f ./src/tables/*.mtd $PREFIX/share/eneboo/tables 2> /dev/null
cp -f ./src/translations/*.ts $PREFIX/share/eneboo/translations 2> /dev/null
#cp -f ./src/scripts/*.qs $PREFIX/share/eneboo/scripts 2> /dev/null
rm $PREFIX/share/eneboo/scripts/* 2> /dev/null
cp -f ./src/scripts/*.qs $PREFIX/share/eneboo/scripts 2> /dev/null
if [ "$OPT_QWS" != "no" ]; then
cp -fr ./src/qt/lib/fonts $PREFIX/lib/ 2> /dev/null
fi
cp -f ./src/docs/*.html $PREFIX/share/eneboo/doc 2> /dev/null
cp -f ./src/*.xml $PREFIX/share/eneboo 2> /dev/null
cp -f ./src/*.xpm $PREFIX/share/eneboo 2> /dev/null
# cp -f ./packages/*.eneboo $PREFIX/share/eneboo/packages 2> /dev/null
echo -e "\n * Eneboo $VERSION - Compilación terminada. * \n"