-
Notifications
You must be signed in to change notification settings - Fork 102
/
build-webos-desktop.sh
executable file
·1652 lines (1402 loc) · 57.6 KB
/
build-webos-desktop.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
# @@@LICENSE
#
# Copyright (c) 2012 - 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# LICENSE@@@
VERSION=8.0
PROCS=`grep -c processor /proc/cpuinfo`
usage() {
cat <<EOF
Usage: ./build-webos-desktop.sh [OPTION]...
Builds the version of Open webOS for the Desktop.
The script loads about 500MB of source code from GitHub, as needed.
NOTE: This script creates files which use about 4GB of disk space
Optional arguments:
clean force a rebuild of components
-j N, --jobs=N run N simultaneous make jobs (default: ${PROCS})
--help display this help and exit
--version display version information and exit
EOF
}
if ! ARGS=`getopt -o j: -l jobs:,help,version -n build-webos-desktop.sh -- "$@"` ; then
exit 2
fi
eval set -- "$ARGS"
while true ; do
case "$1" in
-j|--jobs)
PROCS=$2
shift 2 ;;
--help)
usage
exit ;;
--version)
echo "Desktop build script for Open webOS #${VERSION}"
exit ;;
--)
shift
break ;;
*)
break ;;
esac
done
if [ "$1" = "clean" ] ; then
export SKIPSTUFF=0
set -e
shift
elif [ -n "$1" ] ; then
echo "Parameter $1 not recognized"
exit 1
else
export SKIPSTUFF=1
set -e
fi
export SCRIPT_DIR=$PWD
source ./webos-desktop-common.sh
if [ -d customize ] ; then
if [ ! -e customize/locations.sh ] ; then
cp -f locations.sh.default customize/locations.sh
fi
source ./customize/locations.sh
fi
mkdir -p ${BASE}/tarballs
mkdir -p ${LUNA_STAGING}
mkdir -p ${LUNA_STAGING}/usr/lib
export BEDLAM_ROOT="${BASE}/staging"
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JDKROOT=${JAVA_HOME}
# old builds put .pc files in lib/pkgconfig; cmake-modules-webos puts them in usr/share/pkgconfig
export PKG_CONFIG_PATH=$LUNA_STAGING/lib/pkgconfig:$LUNA_STAGING/usr/share/pkgconfig
export MAKEFILES_DIR=$BASE/pmmakefiles
# where's cmake? we prefer to use our own, and require the cmake-modules-webos module.
if [ -x "${BASE}/cmake/bin/cmake" ] ; then
export CMAKE="${BASE}/cmake/bin/cmake"
else
export CMAKE="cmake"
fi
[ $PROCS -gt 1 ] && JOBS="-j${PROCS}"
export WEBKIT_DIR="WebKit"
[ -t 1 ] && curl_progress_option='-#' || curl_progress_option='-s -S'
############################################
# Optimized fetch process.
# Parameters:
# $1 Specific component within repository, ex: openwebos/cjson
# $2 Tag of component, ex: 35
# $3 Name of destination folder, ex: cjson
# $4 (Optional) Prefix for tag
#
# If the ZIP file already exists in the tarballs folder, it will not be re-fetched
#
############################################
do_fetch() {
cd $BASE
if [ -n "$4" ] ; then
GIT_BRANCH="${4}${2}"
else
GIT_BRANCH="${2}"
fi
if [ -n "$3" -a -d "$3" ] ; then
rm -rf ./$3
fi
if [ "$1" = "isis-project/WebKit" ] ; then
GIT_SOURCE=https://github.com/downloads/isis-project/WebKit/WebKit_${2}s.zip
elif [ -n "${GITHUB_USER}" ]; then
GIT_SOURCE=https://${GITHUB_USER}:${GITHUB_PASS}@github.com/${1}/zipball/${GIT_BRANCH}
else
GIT_SOURCE=https://github.com/${1}/zipball/${GIT_BRANCH}
fi
ZIPFILE="${BASE}/tarballs/`basename ${1}`_${2}.zip"
# if building from a tag, remove any cached "master" zipball to force it to be re-fetched
if [ "${2}" != "master" ] ; then
rm -f "${BASE}/tarballs/`basename ${1}`_master.zip"
fi
if [ -e ${ZIPFILE} ] ; then
file_type=$(file -bi ${ZIPFILE})
if [ "${file_type}" != "application/zip; charset=binary" ] ; then
rm -f ${ZIPFILE}
fi
fi
if [ ! -e ${ZIPFILE} ] ; then
if [ -e ~/tarballs/`basename ${1}`_${2}.zip ] ; then
cp -f ~/tarballs/`basename ${1}`_${2}.zip ${ZIPFILE}
if [ $? != 0 ] ; then
echo error
rm -f ${ZIPFILE}
exit 1
fi
else
echo "About to fetch ${1}#${GIT_BRANCH} from github"
curl -L -R ${curl_progress_option} ${GIT_SOURCE} -o "${ZIPFILE}"
fi
fi
if [ -e ${ZIPFILE} ] ; then
file_type=$(file -bi ${ZIPFILE})
if [ "${file_type}" != "application/zip; charset=binary" ] ; then
echo "FAILED DOWNLOAD: ${ZIPFILE} is ${file_type}"
rm -f ${ZIPFILE}
exit 1
fi
fi
mkdir ./$3
pushd $3
unzip -q ${ZIPFILE}
mv $(ls |head -n1)/* ./
popd
}
####################################
# Change source dir to $2 if valid, otherwise to $1
#
# First parameter is the standard source location
# (mandatory parameter)
#
# Second parameter (if not empty) is the custom source location for the component.
# This is loaded from the "customize/locations.sh" file.
# Note: This file will be created when the build script is first run if not present
#
####################################
function set_source_dir
{
if [ -n "$2" ] ; then
if [ -d "$2" ] ; then
cd $2
else
echo "Folder $2 invalid or doesn't exist"
exit 1
fi
else
cd $1
fi
}
####################################
# Fetch and unpack (or build) cmake
####################################
function build_cmake
{
CMAKE_VER="2.8.7"
mkdir -p $BASE/cmake
cd $BASE/cmake
CMAKE_MACHINE="Linux-`uname -i`"
CMAKE_TARBALL="$BASE/tarballs/cmake-${CMAKE_VER}-${CMAKE_MACHINE}.tar.gz"
CMAKE_SRCBALL="$BASE/tarballs/cmake-${CMAKE_VER}.tar.gz"
if [ ! -f "${CMAKE_TARBALL}" ] && [ ! -f "${CMAKE_SRCBALL}" ] ; then
wget http://www.cmake.org/files/v2.8/cmake-${CMAKE_VER}-${CMAKE_MACHINE}.tar.gz -O ${CMAKE_TARBALL} || true
if [ ! -s ${CMAKE_TARBALL} ] ; then
# no pre-built binary for this machine (e.g. amd64); force source build
rm -f ${CMAKE_TARBALL}
fi
fi
if [ -f "${CMAKE_TARBALL}" ] ; then
# got pre-built binary (e.g. i386) so unpack it
tar zxf ${CMAKE_TARBALL} --strip-components=1
else
if [ ! -f "${CMAKE_SRCBALL}" ] ; then
wget http://www.cmake.org/files/v2.8/cmake-${CMAKE_VER}.tar.gz -O ${CMAKE_SRCBALL}
fi
# no pre-built binary for this machine; build from source instead
tar zxf ${CMAKE_SRCBALL} --strip-components=1
cd $BASE/cmake
./bootstrap --prefix=${BASE}/cmake
make
make install
fi
export CMAKE="${BASE}/cmake/bin/cmake"
}
######################################
# Fetch and build cmake-modules-webos
######################################
function build_cmake-modules-webos
{
do_fetch openwebos/cmake-modules-webos $1 cmake-modules-webos submissions/
cd $BASE/cmake-modules-webos
mkdir -p BUILD
cd BUILD
$CMAKE .. -DCMAKE_INSTALL_PREFIX=${BASE}/cmake
make
mkdir -p $BASE/cmake
make install
}
########################
# Fetch and build cjson
########################
function build_cjson
{
do_fetch openwebos/cjson $1 cjson submissions/
set_source_dir $BASE/cjson $CJSON_DIR
sh autogen.sh
mkdir -p build
cd build
PKG_CONFIG_PATH=$LUNA_STAGING/lib/pkgconfig \
../configure --prefix=$LUNA_STAGING --enable-shared --disable-static
make $JOBS all
make install
}
##########################
# Fetch and build pbnjson
##########################
function build_pbnjson
{
do_fetch openwebos/libpbnjson $1 pbnjson submissions/
set_source_dir $BASE/pbnjson $PBNJSON_DIR
mkdir -p build
cd build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} ..
make $JOBS
make install
# remove lib files from old location
cd ${LUNA_STAGING}
rm -f lib/libpbnjson*.so
# remove header files from old location
cd include
rm -rf pbnjson
rm -f pbnjson*.h*
}
###########################
# Fetch and build pmloglib
###########################
function build_pmloglib
{
do_fetch openwebos/pmloglib $1 pmloglib submissions/
set_source_dir $BASE/pmloglib $PMLOGLIB_DIR
mkdir -p build
cd build
$CMAKE .. -DNO_TESTS=True -DNO_UTILS=True -DCMAKE_INSTALL_PREFIX=${LUNA_STAGING} -DCMAKE_BUILD_TYPE=Release
make $JOBS
make install
}
##########################
# Fetch and build nyx-lib
##########################
function build_nyx-lib
{
do_fetch openwebos/nyx-lib $1 nyx-lib submissions/
set_source_dir $BASE/nyx-lib $NYX_LIB_DIR
mkdir -p build
cd $BASE/nyx-lib/build
$CMAKE .. -DNO_TESTS=True -DNO_UTILS=True -DCMAKE_INSTALL_PREFIX=${LUNA_STAGING} -DCMAKE_BUILD_TYPE=Release
make $JOBS
make install
}
######################
# Fetch and build qt4
######################
function build_qt4
{
do_fetch openwebos/qt $1 qt4 submissions/
export STAGING_DIR=${LUNA_STAGING}
if [ ! -f $BASE/qt-build-desktop/Makefile ] || [ ! -e $BASE/qt4/luna-desktop-build-$1.stamp ] ; then
rm -rf $BASE/qt-build-desktop
fi
if [ ! -d $BASE/qt-build-desktop ] ; then
mkdir -p $BASE/qt-build-desktop
cd $BASE/qt-build-desktop
if [ ! -e ../qt4/palm-desktop-configure.orig ] ; then
cp -f ../qt4/palm-desktop-configure ../qt4/palm-desktop-configure.orig
sed -i 's/-opensource/-opensource -qpa -fast -qconfig palm -no-dbus/' ../qt4/palm-desktop-configure
sed -i 's/libs tools/libs/' ../qt4/palm-desktop-configure
fi
# This export will be picked up by plugins/platforms/platforms.pro and xcb.pro
export WEBOS_CONFIG="webos desktop"
../qt4/palm-desktop-configure
fi
cd $BASE/qt-build-desktop
make $JOBS
make install
# Make alias to moc for BrowserServer build
# (Could also fix w/sed in BrowserServer build for Makefile.Ubuntu)
if [ ! -x ${LUNA_STAGING}/bin/moc ]; then
cd ${LUNA_STAGING}/bin
ln -sf moc-palm moc
fi
}
################################
# Fetch and build luna-service2
################################
function build_luna-service2
{
do_fetch openwebos/luna-service2 $1 luna-service2 submissions/
set_source_dir $BASE/luna-service2 $LUNA_SERVICE2_DIR
mkdir -p build
cd build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} ..
make $JOBS
make install
# TODO: Fix for luna-sysmgr, which doesn't know about staging/usr/include/luna-service2
cp -f ${LUNA_STAGING}/usr/include/luna-service2/lunaservice.h ${LUNA_STAGING}/include/
mkdir -p ${LUNA_STAGING}/include/luna-service2/
cp -f ${LUNA_STAGING}/usr/include/luna-service2/lunaservice-errors.h ${LUNA_STAGING}/include/luna-service2/
# TODO: Fix for activitymanager which includes MojLunaService.h which can't find lunaservice.h
cp -f ${LUNA_STAGING}/usr/include/luna-service2/lunaservice.h ${LUNA_STAGING}/usr/include/
# TODO: Fix for webkit tests which don't look in /usr/lib for luna-service library.
# (Figure out if we can pass -rpath into build for libQtWebKit.so to fix WebKit/qt/tests link.)
cd ${LUNA_STAGING}/lib
ln -sf ../usr/lib/libluna-service2.so libluna-service2.so
ln -sf ../usr/lib/libluna-service2.so libluna-service2.so.3
# TODO: This is for keyboard-efigs which links against lunaservice instead of luna-service2
ln -sf ../usr/lib/libluna-service2.so liblunaservice.so
}
################################
# Fetch and build npapi-headers
################################
function build_npapi-headers
{
do_fetch isis-project/npapi-headers $1 npapi-headers
set_source_dir $BASE/npapi-headers $NPAPI_HEADERS_DIR
mkdir -p $LUNA_STAGING/include/webkit/npapi
cp -f *.h $LUNA_STAGING/include/webkit/npapi
}
################################
# Fetch and build isis-fonts
################################
function build_isis-fonts
{
do_fetch isis-project/isis-fonts $1 isis-fonts
set_source_dir $BASE/isis-fonts $ISIS_FONTS_DIR
mkdir -p $ROOTFS/usr/share/fonts
cp -f *.xml $ROOTFS/usr/share/fonts
cp -f *.ttf $ROOTFS/usr/share/fonts
}
##################################
# Fetch and build luna-webkit-api
##################################
function build_luna-webkit-api
{
do_fetch openwebos/luna-webkit-api $1 luna-webkit-api submissions/
set_source_dir $BASE/luna-webkit-api $LUNA_WEBKIT_API_DIR
mkdir -p $LUNA_STAGING/include/ime
if [ -d include/public/ime ] ; then
cp -f include/public/ime/*.h $LUNA_STAGING/include/ime
else
cp -f *.h $LUNA_STAGING/include/ime
fi
}
##################################
# Fetch and build webkit
##################################
function build_webkit
{
#if [ ! -d $BASE/$WEBKIT_DIR ] ; then
do_fetch isis-project/WebKit $1 $WEBKIT_DIR
#fi
cd $BASE/$WEBKIT_DIR
if [ ! -e Tools/Tools.pro.prepatch ] ; then
cp -f Tools/Tools.pro Tools/Tools.pro.prepatch
sed -i '/PALM_DEVICE/s/:!contains(DEFINES, MACHINE_DESKTOP)//' Tools/Tools.pro
fi
if [ ! -e Source/WebCore/platform/webos/LunaServiceMgr.cpp.prepatch ] ; then
cp -f Source/WebCore/platform/webos/LunaServiceMgr.cpp \
Source/WebCore/platform/webos/LunaServiceMgr.cpp.prepatch
patch --directory=Source/WebCore/platform/webos < ${BASE}/luna-sysmgr/desktop-support/webkit-PALM_SERVICE_BRIDGE.patch
fi
# TODO: Can we pass -rpath linker flags to webkit build (for staging/usr/lib)?
# If not, then we might want/need to prevent webkit from building Source/WebKit/qt/tests, e.g.:
# sed -i '/SOURCES.*$/a LIBS += -Wl,-rpath $$(LUNA_STAGING)/usr/lib -L$$(LUNA_STAGING)/usr/lib' Source/WebKit/qt/tests.pri
# In the mean time, we can add symlinks to end of luna-service2 build to put libs in staging/lib.
# gcc 4.5.2 fails to compile WebCore module with "internal compiler error" when using -O2 or better
GCC_VERSION=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
if [ "$GCC_VERSION" == "4.5.2" ] ; then
sed -i 's/enable_fast_mobile_scrolling: DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1/enable_fast_mobile_scrolling: DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1\nQMAKE_CXXFLAGS_RELEASE-=-O2\nQMAKE_CXXFLAGS_RELEASE+=-O0\n/' Source/WebCore/WebCore.pri
fi
export QTDIR=$BASE/qt4
export QMAKE=$LUNA_STAGING/bin/qmake-palm
export QMAKEPATH=$WEBKIT_DIR/Tools/qmake
export WEBKITOUTPUTDIR="WebKitBuild/isis-x86"
./Tools/Scripts/build-webkit --qt \
--release \
--no-video \
--fullscreen-api \
--only-webkit \
--no-webkit2 \
--qmake="${QMAKE}" \
--makeargs="${JOBS}" \
--qmakearg="DEFINES+=MACHINE_DESKTOP" \
--qmakearg="DEFINES+=ENABLE_PALM_SERVICE_BRIDGE=1" \
--qmakearg="DEFINES+=PALM_DEVICE" \
--qmakearg="DEFINES+=XP_UNIX" \
--qmakearg="DEFINES+=XP_WEBOS" \
--qmakearg="DEFINES+=QT_WEBOS" \
--qmakearg="DEFINES+=WTF_USE_ZLIB=1"
### TODO: To support video in browser, change --no-video to --video and add these these two lines
#--qmakearg="DEFINES+=WTF_USE_GSTREAMER=1" \
#--qmakearg="DEFINES+=ENABLE_GLIB_SUPPORT=1"
if [ "$?" != "0" ] ; then
echo Failed to make $NAME
exit 1
fi
pushd $WEBKITOUTPUTDIR/Release
make install
if [ "$?" != "0" ] ; then
echo Failed to install $NAME
exit 1
fi
popd
}
##################################
# Fetch and build luna-sysmgr-ipc
##################################
function build_luna-sysmgr-ipc
{
do_fetch openwebos/luna-sysmgr-ipc $1 luna-sysmgr-ipc submissions/
set_source_dir $BASE/luna-sysmgr-ipc $LUNA_SYSMGR_IPC_DIR
mkdir -p build
cd build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} ..
make $JOBS
make install
## support components which don't use pkgconfig
mkdir -p $LUNA_STAGING/include/sysmgr-ipc
cp -f $LUNA_STAGING/usr/include/sysmgr-ipc/*.h $LUNA_STAGING/include/sysmgr-ipc/
}
###########################################
# Fetch and build luna-sysmgr-ipc-messages
###########################################
function build_luna-sysmgr-ipc-messages
{
do_fetch openwebos/luna-sysmgr-ipc-messages $1 luna-sysmgr-ipc-messages submissions/
set_source_dir $BASE/luna-sysmgr-ipc-messages $LUNA_SYSMGR_IPC_MESSAGES_DIR
mkdir -p build
cd build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} ..
make $JOBS
make install
## support components which don't use pkgconfig
mkdir -p $LUNA_STAGING/include/sysmgr-ipc
cp -f $LUNA_STAGING/usr/include/sysmgr-ipc/*.h $LUNA_STAGING/include/sysmgr-ipc/
}
#################################
# Fetch and build luna-prefs
#################################
function build_luna-prefs
{
do_fetch openwebos/luna-prefs $1 luna-prefs submissions/
set_source_dir $BASE/luna-prefs $LUNA_PREFS_DIR
mkdir -p $BASE/luna-prefs/build
cd $BASE/luna-prefs/build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} ..
make $JOBS
make install
}
#################################
# Fetch and build luna-init
#################################
function build_luna-init
{
do_fetch openwebos/luna-init $1 luna-init submissions/
set_source_dir $BASE/luna-init $LUNA_INIT_DIR
mkdir -p build
cd build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} -DCMAKE_INSTALL_PREFIX=${LUNA_STAGING} ..
make $JOBS
make install
cp -f ../files/conf/*.json $ROOTFS/usr/palm/
if [ -e ../files/conf/fonts/fonts.tgz ]; then
mkdir -p $ROOTFS/usr/share/fonts
tar xvzf ../files/conf/fonts/fonts.tgz --directory=${ROOTFS}/usr/share/fonts
cp -f ../files/conf/fonts/*.xml $ROOTFS/usr/share/fonts/
fi
}
#################################
# Fetch and build luna-sysservice
#################################
function build_luna-sysservice
{
do_fetch openwebos/luna-sysservice $1 luna-sysservice submissions/
set_source_dir $BASE/luna-sysservice $LUNA_SYSSERVICE_DIR
mkdir -p build
cd build
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} ..
make $JOBS
make install
# NOTE: Make binary findable in /usr/lib/luna so ls2 can match the role file
cp -f LunaSysService $ROOTFS/usr/lib/luna/
# TODO: cmake should do this for us (once we have configurable-for-desktop files)
cp -rf ../files/conf/* ${ROOTFS}/etc/palm
cp -f ../desktop-support/com.palm.systemservice.json.pub $ROOTFS/usr/share/ls2/roles/pub/com.palm.systemservice.json
cp -f ../desktop-support/com.palm.systemservice.json.prv $ROOTFS/usr/share/ls2/roles/prv/com.palm.systemservice.json
cp -f ../desktop-support/com.palm.systemservice.service.pub $ROOTFS/usr/share/ls2/services/com.palm.systemservice.service
cp -f ../desktop-support/com.palm.systemservice.service.prv $ROOTFS/usr/share/ls2/system-services/com.palm.systemservice.service
mkdir -p $ROOTFS/etc/palm/backup
cp -f ../desktop-support/com.palm.systemservice.backupRegistration.json $ROOTFS/etc/palm/backup/com.palm.systemservice
}
###########################################
# Fetch and build enyo 1.0
###########################################
function build_enyo-1.0
{
do_fetch enyojs/enyo-1.0 $1 enyo-1.0 submissions/
cd $BASE/enyo-1.0
mkdir -p $ROOTFS/usr/palm/frameworks/enyo/0.10/framework
cp -rf framework/* $ROOTFS/usr/palm/frameworks/enyo/0.10/framework
cd $ROOTFS/usr/palm/frameworks/enyo/
# add symlink for enyo version 1.0 (which was 0.10)
ln -sf -T 0.10 1.0
}
###########################################
# Fetch and build Core Apps
###########################################
function build_core-apps
{
do_fetch openwebos/core-apps $1 core-apps submissions/
set_source_dir $BASE/core-apps $CORE_APPS_DIR
mkdir -p $ROOTFS/usr/palm/applications
for APP in com.palm.app.* ; do
cp -rf ${APP} $ROOTFS/usr/palm/applications/
cp -rf ${APP}/configuration/db/kinds/* $ROOTFS/etc/palm/db/kinds/ 2>/dev/null || true
cp -rf ${APP}/configuration/db/permissions/* $ROOTFS/etc/palm/db/permissions/ 2>/dev/null || true
cp -rf ${APP}/configuration/activities/* $ROOTFS/etc/palm/activities/ 2>/dev/null || true
done
}
###########################################
# Fetch and build luna-applauncher
###########################################
function build_luna-applauncher
{
do_fetch openwebos/luna-applauncher $1 luna-applauncher submissions/
set_source_dir $BASE/luna-applauncher $LUNA_APPLAUNCHER_DIR
mkdir -p $ROOTFS/usr/lib/luna/system/luna-applauncher
cp -rf . $ROOTFS/usr/lib/luna/system/luna-applauncher
}
###########################################
# Fetch and build luna-systemui
###########################################
function build_luna-systemui
{
do_fetch openwebos/luna-systemui $1 luna-systemui submissions/
set_source_dir $BASE/luna-systemui $LUNA_SYSTEMUI_DIR
mkdir -p $ROOTFS/usr/lib/luna/system/luna-systemui
cp -rf . $ROOTFS/usr/lib/luna/system/luna-systemui
if [ -e images/wallpaper.tar ]; then
mkdir -p $ROOTFS/usr/lib/luna/system/luna-systemui/images
tar xf images/wallpaper.tar --directory=${ROOTFS}/usr/lib/luna/system/luna-systemui/images
fi
}
###########################################
# Fetch and build foundation-frameworks
###########################################
function build_foundation-frameworks
{
do_fetch openwebos/foundation-frameworks $1 foundation-frameworks
set_source_dir $BASE/foundation-frameworks $FOUNDATION_FRAMEWORKS_DIR
mkdir -p $ROOTFS/usr/palm/frameworks/
for FRAMEWORK in `ls -d1 foundations*` ; do
mkdir -p $ROOTFS/usr/palm/frameworks/$FRAMEWORK/version/1.0/
cp -rf $FRAMEWORK/* $ROOTFS/usr/palm/frameworks/$FRAMEWORK/version/1.0/
done
}
###########################################
# Fetch and build mojoservice-frameworks
###########################################
function build_mojoservice-frameworks
{
do_fetch openwebos/mojoservice-frameworks $1 mojoservice-frameworks
set_source_dir $BASE/mojoservice-frameworks $MOJOSERVICE_FRAMEWORKS_DIR
mkdir -p $ROOTFS/usr/palm/frameworks/
for FRAMEWORK in `ls -d1 mojoservice*` ; do
mkdir -p $ROOTFS/usr/palm/frameworks/$FRAMEWORK/version/1.0/
cp -rf $FRAMEWORK/* $ROOTFS/usr/palm/frameworks/$FRAMEWORK/version/1.0/
done
}
###########################################
# Fetch and build loadable-frameworks
###########################################
function build_loadable-frameworks
{
do_fetch openwebos/loadable-frameworks $1 loadable-frameworks
set_source_dir $BASE/loadable-frameworks $LOADABLE_FRAMEWORKS_DIR
mkdir -p $ROOTFS/usr/palm/frameworks/
for FRAMEWORK in `ls -d1 calendar* contacts globalization` ; do
mkdir -p $ROOTFS/usr/palm/frameworks/$FRAMEWORK/version/1.0/
cp -rf $FRAMEWORK/* $ROOTFS/usr/palm/frameworks/$FRAMEWORK/version/1.0/
done
}
###########################################
# Fetch and build underscore
###########################################
function build_underscore
{
do_fetch openwebos/underscore $1 underscore submissions/
mkdir -p $ROOTFS/usr/palm/frameworks/
mkdir -p $ROOTFS/usr/palm/frameworks/underscore/version/1.0/
cp -rf $BASE/underscore/* $ROOTFS/usr/palm/frameworks/underscore/version/1.0/
}
###########################################
# Fetch and build mojoloader
###########################################
function build_mojoloader
{
do_fetch openwebos/mojoloader $1 mojoloader submissions/
mkdir -p $ROOTFS/usr/palm/frameworks/
cp -rf $BASE/mojoloader/mojoloader.js $ROOTFS/usr/palm/frameworks/
}
###########################################
# Fetch and build mojoservicelauncher
###########################################
function build_mojoservicelauncher
{
do_fetch openwebos/mojoservicelauncher $1 mojoservicelauncher submissions/
mkdir -p $BASE/mojoservicelauncher/build
cd $BASE/mojoservicelauncher/build
sed -i 's!DESTINATION /!DESTINATION !' ../CMakeLists.txt
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} -DCMAKE_INSTALL_PREFIX=${LUNA_STAGING} ..
make $JOBS
make install
# copy mojoservicelauncher files from staging to rootfs
mkdir -p $ROOTFS/usr/palm/services/jsservicelauncher
cp -f $LUNA_STAGING/usr/palm/services/jsservicelauncher/* $ROOTFS/usr/palm/services/jsservicelauncher
# most services launch with run-js-service
chmod ugo+x ../desktop-support/run-js-service
cp -f ../desktop-support/run-js-service $ROOTFS/usr/lib/luna/
# jslauncher is used by com.palm.service.calendar.reminders
chmod ugo+x ../desktop-support/jslauncher
cp -f ../desktop-support/jslauncher $ROOTFS/usr/lib/luna/
}
###########################################
# Fetch and build mojolocation-stub
###########################################
function build_mojolocation-stub
{
do_fetch openwebos/mojolocation-stub $1 mojolocation-stub submissions/
set_source_dir $BASE/mojolocation-stub $MOJOLOCATION_DIR
mkdir -p $ROOTFS/usr/palm/services/com.palm.location
cp -rf *.json *.js $ROOTFS/usr/palm/services/com.palm.location
cp -rf files/sysbus/*.json $ROOTFS/usr/share/ls2/roles/prv
cp -rf files/sysbus/*.json $ROOTFS/usr/share/ls2/roles/pub
#NOTE: services go in $ROOTFS/usr/share/ls2/system-services, which is linked from /usr/share/ls2/system-services
cp -rf desktop-support/*.service $ROOTFS/usr/share/ls2/system-services
cp -rf desktop-support/*.service $ROOTFS/usr/share/ls2/services
}
###########################################
# Fetch and build pmnetconfigmanager-stub
###########################################
function build_pmnetconfigmanager-stub
{
do_fetch openwebos/pmnetconfigmanager-stub $1 pmnetconfigmanager-stub submissions/
set_source_dir $BASE/pmnetconfigmanager-stub $PMNETCONFIGMANAGER_DIR
mkdir -p $ROOTFS/usr/palm/services/com.palm.connectionmanager
cp -rf *.json *.js $ROOTFS/usr/palm/services/com.palm.connectionmanager
cp -rf files/sysbus/*.json $ROOTFS/usr/share/ls2/roles/prv
cp -rf files/sysbus/*.json $ROOTFS/usr/share/ls2/roles/pub
#NOTE: services go in $ROOTFS/usr/share/ls2/system-services, which is linked from /usr/share/ls2/system-services
cp -rf desktop-support/*.service $ROOTFS/usr/share/ls2/system-services
cp -rf desktop-support/*.service $ROOTFS/usr/share/ls2/services
}
###########################################
# Fetch and build app-services
###########################################
function build_app-services
{
do_fetch openwebos/app-services $1 app-services
set_source_dir $BASE/app-services $APP_SERVICES_DIR
rm -rf mojomail
mkdir -p $ROOTFS/usr/palm/services
for SERVICE in com.palm.service.* ; do
cp -rf ${SERVICE} $ROOTFS/usr/palm/services/
cp -rf ${SERVICE}/db/kinds/* $ROOTFS/etc/palm/db/kinds/ 2>/dev/null || true
cp -rf ${SERVICE}/db/permissions/* $ROOTFS/etc/palm/db/permissions/ 2>/dev/null || true
cp -rf ${SERVICE}/activities/* $ROOTFS/etc/palm/activities/ 2>/dev/null || true
cp -rf ${SERVICE}/files/sysbus/*.json $ROOTFS/usr/share/ls2/roles/prv 2>/dev/null || true
#NOTE: services go in $ROOTFS/usr/share/ls2/system-services, which is linked from /usr/share/ls2/system-services
cp -rf ${SERVICE}/desktop-support/*.service $ROOTFS/usr/share/ls2/system-services 2>/dev/null || true
done
# accounts service is public, so install its service file in public service dir
cp -rf com.palm.service.accounts/desktop-support/*.service $ROOTFS/usr/share/ls2/services
# install accounts service desktop credentials db kind
cp -rf com.palm.service.accounts/desktop/com.palm.account.credentials $ROOTFS/etc/palm/db/kinds
# install account-templates service
mkdir -p $ROOTFS/usr/palm/public/accounts
cp -rf account-templates/palmprofile/com.palm.palmprofile $ROOTFS/usr/palm/public/accounts/
# install tempdb kinds and permissions
mkdir -p $ROOTFS/etc/palm/tempdb/kinds
mkdir -p $ROOTFS/etc/palm/tempdb/permissions
cp -rf com.palm.service.accounts/tempdb/kinds/* $ROOTFS/etc/palm/tempdb/kinds/ 2>/dev/null || true
cp -rf com.palm.service.accounts/tempdb/permissions/* $ROOTFS/etc/palm/tempdb/permissions/ 2>/dev/null || true
}
###########################################
# Fetch and build mojomail
###########################################
function build_mojomail
{
do_fetch openwebos/mojomail $1 mojomail submissions/
set_source_dir $BASE/mojomail $MOJOMAIL_DIR
for SUBDIR in common imap pop smtp ; do
mkdir -p $BASE/mojomail/$SUBDIR/build
cd $BASE/mojomail/$SUBDIR/build
sed -i 's!DESTINATION /!DESTINATION !' ../CMakeLists.txt
$CMAKE -D WEBOS_INSTALL_ROOT:PATH=${LUNA_STAGING} -DCMAKE_INSTALL_PREFIX=${LUNA_STAGING} ..
#make $JOBS VERBOSE=1
make $JOBS
make install
mkdir -p $ROOTFS/usr/palm/public/accounts
cp -rf ../files/usr/palm/public/accounts/* $ROOTFS/usr/palm/public/accounts/ 2>/dev/null || true
cp -rf ../files/db8/kinds/* $ROOTFS/etc/palm/db/kinds 2> /dev/null || true
cd ../..
done
# TODO: (cmake should do this) install filecache types
mkdir -p $ROOTFS/etc/palm/filecache_types
cp -rf common/files/filecache_types/* $ROOTFS/etc/palm/filecache_types
# NOTE: Make binaries findable in /usr/lib/luna so ls2 can match the role file
cp -f imap/build/mojomail-imap "${ROOTFS}/usr/lib/luna/"
cp -f pop/build/mojomail-pop "${ROOTFS}/usr/lib/luna/"
cp -f smtp/build/mojomail-smtp "${ROOTFS}/usr/lib/luna/"
cp -f desktop-support/com.palm.imap.json.prv $ROOTFS/usr/share/ls2/roles/prv/com.palm.imap.json
cp -f desktop-support/com.palm.pop.json.prv $ROOTFS/usr/share/ls2/roles/prv/com.palm.pop.json
cp -f desktop-support/com.palm.smtp.json.prv $ROOTFS/usr/share/ls2/roles/prv/com.palm.smtp.json
cp -f desktop-support/com.palm.imap.service.prv $ROOTFS/usr/share/ls2/system-services/com.palm.imap.service
cp -f desktop-support/com.palm.pop.service.prv $ROOTFS/usr/share/ls2/system-services/com.palm.pop.service
cp -f desktop-support/com.palm.smtp.service.prv $ROOTFS/usr/share/ls2/system-services/com.palm.smtp.service
}
##############################
# Fetch and build luna-sysmgr-common
##############################
function build_luna-sysmgr-common
{
do_fetch openwebos/luna-sysmgr-common $1 luna-sysmgr-common submissions/
set_source_dir $BASE/luna-sysmgr-common $LUNA_SYSMGR_COMMON_DIR
if [ ! -e "luna-desktop-build-${1}.stamp" ] ; then
if [ $SKIPSTUFF -eq 0 ] && [ -e debug-x86 ] && [ -e debug-x86/.obj ] ; then
rm -f debug-x86/libLunaSysMgrCommon.so
rm -rf debug-x86/.obj/*
rm -rf debug-x86/.moc/moc_*.cpp
rm -rf debug-x86/.moc/*.moc
fi
export STAGING_LIBDIR="${LUNA_STAGING}/lib"
$LUNA_STAGING/bin/qmake-palm
make -e PREFIX=$LUNA_STAGING -f Makefile.Ubuntu install BUILD_TYPE=debug
mkdir -p $LUNA_STAGING/include/luna-sysmgr-common
cp include/* $LUNA_STAGING/include/luna-sysmgr-common/
fi
}
##############################
# Fetch and build webappmanager
##############################
function build_webappmanager
{
do_fetch openwebos/webappmanager $1 webappmanager submissions/
set_source_dir $BASE/webappmanager $WEBAPPMANAGER_DIR
if [ ! -e "luna-desktop-build-${1}.stamp" ] ; then
if [ $SKIPSTUFF -eq 0 ] && [ -e debug-x86 ] && [ -e debug-x86/.obj ] ; then
rm -f debug-x86/WebAppMgr
rm -rf debug-x86/.obj/*
rm -rf debug-x86/.moc/moc_*.cpp
rm -rf debug-x86/.moc/*.moc
fi
$LUNA_STAGING/bin/qmake-palm
fi
make $JOBS -f Makefile.Ubuntu
mkdir -p $ROOTFS/usr/lib/luna
cp -f debug-x86/WebAppMgr $ROOTFS/usr/lib/luna/WebAppMgr
cp -f desktop-support/com.palm.webappmgr.json.prv $ROOTFS/usr/share/ls2/roles/prv/com.palm.webappmgr.json
cp -f desktop-support/com.palm.webappmgr.json.pub $ROOTFS/usr/share/ls2/roles/pub/com.palm.webappmgr.json
cp -f desktop-support/com.palm.webappmgr.service.prv $ROOTFS/usr/share/ls2/system-services/com.palm.webappmgr.service
cp -f desktop-support/com.palm.webappmgr.service.pub $ROOTFS/usr/share/ls2/services/com.palm.webappmgr.service
}
##############################
# Fetch and build luna-sysmgr
##############################
function build_luna-sysmgr
{
if [ ! -d $BASE/luna-sysmgr ] || [ ! -e "$BASE/tarballs/luna-sysmgr_${1}.zip" ] ; then
do_fetch openwebos/luna-sysmgr $1 luna-sysmgr submissions/
fi
set_source_dir $BASE/luna-sysmgr $LUNA_SYSMGR_DIR
if [ ! -e "luna-desktop-build-${1}.stamp" ] ; then
if [ $SKIPSTUFF -eq 0 ] && [ -e debug-x86 ] && [ -e debug-x86/.obj ] ; then
rm -f debug-x86/LunaSysMgr
rm -rf debug-x86/.obj/*
rm -rf debug-x86/.moc/moc_*.cpp
rm -rf debug-x86/.moc/*.moc
fi
$LUNA_STAGING/bin/qmake-palm
fi
make $JOBS -f Makefile.Ubuntu
mkdir -p $LUNA_STAGING/lib/sysmgr-images
cp -frad images/* $LUNA_STAGING/lib/sysmgr-images
#cp -f debug-x86/LunaSysMgr $LUNA_STAGING/lib
#cp -f debug-x86/LunaSysMgr $LUNA_STAGING/bin
# Note: ls2/roles/prv/com.palm.luna.json refers to /usr/lib/luna/LunaSysMgr and ls2 uses that path to match role files.
mkdir -p $ROOTFS/usr/lib/luna
cp -f debug-x86/LunaSysMgr $ROOTFS/usr/lib/luna/LunaSysMgr
#TODO: (temporary) remove old luna-sysmgr user scripts from $BASE
rm -f $BASE/service-bus.sh
rm -f $BASE/run-luna-sysmgr.sh
rm -f $BASE/install-luna-sysmgr.sh
mkdir -p $ROOTFS/usr/lib/luna/system/luna-applauncher
cp -f desktop-support/appinfo.json $ROOTFS/usr/lib/luna/system/luna-applauncher/appinfo.json
cp -f desktop-support/com.palm.luna.json.prv $ROOTFS/usr/share/ls2/roles/prv/com.palm.luna.json
cp -f desktop-support/com.palm.luna.json.pub $ROOTFS/usr/share/ls2/roles/pub/com.palm.luna.json
cp -f desktop-support/com.palm.luna.service.prv $ROOTFS/usr/share/ls2/system-services/com.palm.luna.service
cp -f desktop-support/com.palm.luna.service.pub $ROOTFS/usr/share/ls2/services/com.palm.luna.service
mkdir -p $ROOTFS/etc/palm/pubsub_handlers
cp -f service/com.palm.appinstaller.pubsub $ROOTFS/etc/palm/pubsub_handlers/com.palm.appinstaller
cp -f conf/default-exhibition-apps.json $ROOTFS/etc/palm/default-exhibition-apps.json
cp -f conf/default-launcher-page-layout.json $ROOTFS/etc/palm/default-launcher-page-layout.json
cp -f conf/defaultPreferences.txt $ROOTFS/etc/palm/defaultPreferences.txt
cp -f conf/luna.conf $ROOTFS/etc/palm/luna.conf
cp -f conf/luna-desktop.conf $ROOTFS/etc/palm/luna-platform.conf
cp -f conf/lunaAnimations.conf $ROOTFS/etc/palm/lunaAnimations.conf
cp -f conf/notificationPolicy.conf $ROOTFS/etc/palm//notificationPolicy.conf
mkdir -p $ROOTFS/usr/lib/luna/customization
cp -f conf/default-exhibition-apps.json $ROOTFS/usr/lib/luna/customization/default-exhibition-apps.json
mkdir -p $ROOTFS/usr/palm/sounds
cp -f sounds/* $ROOTFS/usr/palm/sounds
mkdir -p $ROOTFS/etc/palm/luna-applauncher