forked from adobe-flash/crossbridge
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
1955 lines (1795 loc) · 102 KB
/
Makefile
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
# ====================================================================================
# CrossBridge Makefile
# ====================================================================================
$?UNAME=$(shell uname -s)
$?SRCROOT=$(PWD)
ESCAPED_SRCROOT=$(shell echo $(SRCROOT) | sed -e 's/[\/&]/\\&/g')
$?SDK=$(PWD)/sdk
$?BUILDROOT=$(PWD)/build
$?WIN_BUILD=$(BUILDROOT)/win
$?MAC_BUILD=$(BUILDROOT)/mac
$?LINUX_BUILD=$(BUILDROOT)/linux
# ====================================================================================
# DEPENDENCIES
# ====================================================================================
# Dependency Core
$?DEPENDENCY_AVMPLUS=avmplus-master
$?DEPENDENCY_BINUTILS=binutils
$?DEPENDENCY_BMAKE=bmake
$?DEPENDENCY_CMAKE=cmake-3.0.0
$?DEPENDENCY_DMALLOC=dmalloc-5.5.2
$?DEPENDENCY_FFI=libffi-3.0.11
$?DEPENDENCY_GDB=gdb-7.3
$?DEPENDENCY_LIBTOOL=libtool-2.4.2
$?DEPENDENCY_LLVM=llvm-2.9
$?DEPENDENCY_LLVM_GCC=llvm-gcc-4.2-2.9
$?DEPENDENCY_MAKE=make-4.0
$?DEPENDENCY_PKG_CFG=pkg-config-0.26
$?DEPENDENCY_SWIG=swig-3.0.0
# Dependency Testing
$?DEPENDENCY_DEJAGNU=dejagnu-1.5
# Dependency Extras
$?DEPENDENCY_LIBICONV=libiconv-1.14
$?DEPENDENCY_LIBREADLINE=readline-6.3
$?DEPENDENCY_LIBPROTOBUF=protobuf-2.5.0
$?DEPENDENCY_LIBNCURSES=ncurses-5.9
$?DEPENDENCY_LIBXML=libxml2-2.9.1
$?DEPENDENCY_LIBAA=aalib-1.2
$?DEPENDENCY_LIBEIGEN=eigen-3.1.2
$?DEPENDENCY_LIBGMP=gmp-6.0.0
$?DEPENDENCY_LIBPHYSFS=physfs-2.0.3
# Dependency Multimedia
$?DEPENDENCY_LIBSNDFILE=libsndfile-1.0.25
$?DEPENDENCY_LIBFLAC=flac-1.2.1
$?DEPENDENCY_LIBGIF=giflib-5.0.5
$?DEPENDENCY_LIBFREETYPE=freetype-2.5.3
$?DEPENDENCY_LIBOGG=libogg-1.3.1
$?DEPENDENCY_LIBPNG=libpng-1.5.7
$?DEPENDENCY_JPEG=jpeg-8c
$?DEPENDENCY_LIBSDL=SDL-1.2.14
$?DEPENDENCY_LIBSDLIMAGE=SDL_image-1.2.12
$?DEPENDENCY_LIBSDLMIXER=SDL_mixer-1.2.12
$?DEPENDENCY_LIBSDLTTF=SDL_ttf-2.0.11
$?DEPENDENCY_LIBSDL2=SDL2-2.0.3
$?DEPENDENCY_LIBSDL2IMAGE=SDL2_image-2.0.0
$?DEPENDENCY_LIBSDL2MIXER=SDL2_mixer-2.0.0
$?DEPENDENCY_LIBSDL2TTF=SDL2_ttf-2.0.12
$?DEPENDENCY_LIBTIFF=tiff-4.0.3
$?DEPENDENCY_LIBVORBIS=libvorbis-1.3.4
$?DEPENDENCY_LIBWEBP=libwebp-0.4.0
# Dependency Compression
$?DEPENDENCY_BZIP=bzip2-1.0.6
$?DEPENDENCY_ZLIB=zlib-1.2.5
$?DEPENDENCY_XZ=xz-5.0.5
# Dependency Cryptography
$?DEPENDENCY_OPENSSL=openssl-1.0.1i
$?DEPENDENCY_MCRYPT=libmcrypt-2.5.8
$?DEPENDENCY_MHASH=mhash-0.9.9.9
$?DEPENDENCY_BEECRYPT=beecrypt-4.2.1
$?DEPENDENCY_NETTLE=nettle-3.0
# ====================================================================================
# HOST PLATFORM OPTIONS
# ====================================================================================
# Windows or OSX or Linux
ifneq (,$(findstring CYGWIN,$(UNAME)))
$?PLATFORM="cygwin"
$?RAWPLAT=cygwin
ifdef NUMBER_OF_PROCESSORS
$?THREADS=$(NUMBER_OF_PROCESSORS)
else
$?THREADS=2
endif
$?nativepath=$(shell cygpath -at mixed $(1))
$?BUILD_TRIPLE=i686-pc-cygwin
$?NOPIE=
$?BIN_TRUE=/usr/bin/true
else ifneq (,$(findstring Darwin,$(UNAME)))
$?PLATFORM="darwin"
$?RAWPLAT=darwin
$?THREADS=$(shell sysctl -n hw.ncpu)
$?nativepath=$(1)
$?BUILD_TRIPLE=x86_64-apple-darwin10
$?NOPIE=-no_pie
$?BIN_TRUE=/usr/bin/true
else
$?PLATFORM="linux"
$?RAWPLAT=linux
$?THREADS=1
$?nativepath=$(1)
$?BUILD_TRIPLE=x86_64-unknown-linux-gnu
$?NOPIE=
$?BIN_TRUE=/bin/true
endif
# ====================================================================================
# TARGET PLATFORM OPTIONS
# ====================================================================================
# Windows
ifneq (,$(findstring cygwin,$(PLATFORM)))
$?CC=gcc
$?CXX=g++
$?EXEEXT=.exe
$?SOEXT=.dll
$?SDLFLAGS=
$?TAMARIN_CONFIG_FLAGS=--target=i686-linux
$?TAMARINLDFLAGS=" -Wl,--stack,16000000"
$?TAMARINOPTFLAGS=-Wno-unused-function -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-narrowing -Wno-sizeof-pointer-memaccess -Wno-unused-variable -Wno-unused-but-set-variable -Wno-deprecated-declarations
$?BUILD=$(WIN_BUILD)
$?PLATFORM_NAME=win
$?HOST_TRIPLE=i686-pc-cygwin
endif
# OSX
ifneq (,$(findstring darwin,$(PLATFORM)))
$?CC=gcc-4.2
$?CXX=g++-4.2
$?EXEEXT=
$?SOEXT=.dylib
$?SDLFLAGS=--build=i686-apple-darwin10
$?TAMARIN_CONFIG_FLAGS=
$?TAMARINLDFLAGS=" -m32 -arch=i686"
$?TAMARINOPTFLAGS=-Wno-deprecated-declarations
$?BUILD=$(MAC_BUILD)
$?PLATFORM_NAME=mac
$?HOST_TRIPLE=x86_64-apple-darwin10
endif
# Linux
ifneq (,$(findstring linux,$(PLATFORM)))
$?CC=gcc
$?CXX=g++
$?EXEEXT=
$?SOEXT=.so
$?SDLFLAGS=--build=i686-unknown-linux
$?TAMARIN_CONFIG_FLAGS=
$?TAMARINLDFLAGS=" -m32 -arch=i686"
$?TAMARINOPTFLAGS=-Wno-deprecated-declarations
$?BUILD=$(LINUX_BUILD)
$?PLATFORM_NAME=linux
$?HOST_TRIPLE=x86_64-unknown-linux
endif
# Cross-Compile Options
$?CYGTRIPLE=i686-pc-cygwin
$?TRIPLE=avm2-unknown-freebsd8
#$?MINGWTRIPLE=i686-mingw32
# ====================================================================================
# GNU Tool-chain and CC Options
# ====================================================================================
# Host Tools
#$?CC_FOR_BUILD=gcc
export CC:=$(CC)
export CXX:=$(CXX)
# linker tool (symbolic force no-dereference)
$?LN=ln -sfn
# sync tool
$?RSYNC=rsync -az --no-p --no-g --chmod=ugo=rwX -l
# archive tool
$?NATIVE_AR=ar
# java tool
$?JAVA=$(call nativepath,$(shell which java))
$?JAVAC=$(call nativepath,$(shell which javac))
$?JAVACOPTS=-source 1.6 -target 1.6 -Xlint:-options
# python tool
$?PYTHON=$(call nativepath,$(shell which python))
# Target Tools
$?AR=$(SDK)/usr/bin/ar scru -v
$?SDK_CC=$(SDK)/usr/bin/gcc
$?SDK_CXX=$(SDK)/usr/bin/g++
$?SDK_AR=$(SDK)/usr/bin/ar
$?SDK_NM=$(SDK)/usr/bin/nm
$?SDK_CMAKE=$(SDK)/usr/bin/cmake
$?SDK_MAKE=$(SDK)/usr/bin/make
# Extra Tool (Used by LLVM test)
$?FPCMP=$(BUILDROOT)/extra/fpcmp$(EXEEXT)
# Common Flags
$?DBGOPTS=
$?LIBHELPEROPTFLAGS=-O3
$?CFLAGS=-O4
$?CXXFLAGS=-O4
# ====================================================================================
# LLVM and Clang options
# ====================================================================================
$?LLVMASSERTIONS=OFF
$?LLVMTESTS=ON
$?LLVMCMAKEOPTS=
$?LLVMLDFLAGS=
$?LLVMCFLAGS=
$?LLVMCXXFLAGS=
$?LLVMINSTALLPREFIX=$(BUILD)
$?LLVM_ONLYLLC=false
$?LLVMBUILDTYPE=MinSizeRel
$?LLVMTARGETS=AVM2;AVM2Shim;X86;CBackend
$?CLANG=ON
# ====================================================================================
# AIR or Flex SDK options
# ====================================================================================
ifneq "$(wildcard $(AIR_HOME)/lib/compiler.jar)" ""
$?FLEX_SDK_TYPE=AdobeAIR
$?FLEX_SDK_HOME=$(AIR_HOME)
$?FLEX_ASDOC=java -classpath "$(call nativepath,$(AIR_HOME)/lib/legacy/asdoc.jar)" -Dflex.compiler.theme= -Dflexlib=$(call nativepath,$(AIR_HOME)/frameworks) flex2.tools.ASDoc -compiler.fonts.local-fonts-snapshot=
else ifneq "$(wildcard $(FLEX_HOME)/lib/flex-compiler-oem.jar)" ""
$?FLEX_SDK_TYPE=ApacheFlex
$?FLEX_SDK_HOME=$(FLEX_HOME)
$?FLEX_ASDOC=java -classpath "$(call nativepath,$(FLEX_SDK_HOME)/lib/asdoc.jar)" -Dflexlib=$(call nativepath,$(FLEX_SDK_HOME)/frameworks) flex2.tools.ASDoc
else
$(error Adobe AIR SDK and Apache Flex SDK are missing - setting the 'AIR_HOME' or 'FLEX_HOME' environment variable is essential to build the CrossBridge SDK)
endif
# ====================================================================================
# Tamarin options
# ====================================================================================
# ASC1 Flags
$?TAMARINCONFIG=CFLAGS=" -m32 -I$(SRCROOT)/avm2_env/misc -I/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/lib/gcc/i686-apple-darwin11/4.2.1/include/ -DVMCFG_ALCHEMY_SDK_BUILD " CXXFLAGS=" -m32 -I$(SRCROOT)/avm2_env/misc -I/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/lib/gcc/i686-apple-darwin11/4.2.1/include/ $(TAMARINOPTFLAGS) -DVMCFG_ALCHEMY_SDK_BUILD " LDFLAGS=$(TAMARINLDFLAGS) $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/configure.py --enable-shell --enable-alchemy-posix $(TAMARIN_CONFIG_FLAGS)
# ASC1 Tool
$?ASC=$(call nativepath,$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/utils/asc.jar)
# ASC2 Tool
# 1. merge the compiled source into a single output file
# 2. emit metadata information into the bytecode
# 3. future abc
# 4. use the AS3 class based object model for greater performance and better error reporting
# 5. turn on 'parallel generation of method bodies' feature for Alchemy
# 6. turn on the inlining of functions
# 7. make the packages in the abc file available for import
$?ASC2=java -jar $(call nativepath,$(SRCROOT)/tools/lib-air/asc2.jar) -merge -md -abcfuture -AS3 -parallel -inline \
-import $(call nativepath,$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/generated/builtin.abc) \
-import $(call nativepath,$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/generated/shell_toplevel.abc)
# ASC2 configuration definitions
# 1. as3 source is for asdocs
# 2. as3 source is for distribution
# 3. as3 source is including trace commands
$?ASC2OPTS=-config CONFIG::asdocs=false -config CONFIG::actual=true -config CONFIG::debug=true
# 1. treat undeclared variable and method access as errors
# 2. produce an optimized abc file
# 3. remove dead code when -optimize is set
$?ASC2EXTRAOPTS=-strict -optimize -removedeadcode
# AVMShell link
$?AVMSHELL=$(SDK)/usr/bin/avmshell$(EXEEXT)
# ====================================================================================
# Other options
# ====================================================================================
$?FLASCC_VERSION_MAJOR:=15
$?FLASCC_VERSION_MINOR:=0
$?FLASCC_VERSION_PATCH:=0
$?FLASCC_VERSION_BUILD:=3
$?SDKNAME=CrossBridge_$(FLASCC_VERSION_MAJOR).$(FLASCC_VERSION_MINOR).$(FLASCC_VERSION_PATCH).$(FLASCC_VERSION_BUILD)
BUILD_VER_DEFS"-DFLASCC_VERSION_MAJOR=$(FLASCC_VERSION_MAJOR) -DFLASCC_VERSION_MINOR=$(FLASCC_VERSION_MINOR) -DFLASCC_VERSION_PATCH=$(FLASCC_VERSION_PATCH) -DFLASCC_VERSION_BUILD=$(FLASCC_VERSION_BUILD)"
# ====================================================================================
# BMAKE
# ====================================================================================
#TODO are we done sweeping for asm?
#$?BMAKE=AR='/usr/bin/true ||' GENCAT=/usr/bin/true RANLIB=/usr/bin/true CC="$(SDK)/usr/bin/gcc -emit-llvm"' -DSTRIP_FBSDID -D__asm__\(X...\)="\error" -D__asm\(X...\)="\error"' MAKEFLAGS="" MFLAGS="" $(BUILD)/bmake/bmake -m $(BUILD)/lib/share/mk
$?BMAKE=AR='/usr/bin/true ||' GENCAT=/usr/bin/true RANLIB=/usr/bin/true CC="$(SDK)/usr/bin/gcc -emit-llvm -DSTRIP_FBSDID" MAKEFLAGS="" MFLAGS="" $(BUILD)/bmake/bmake -m $(BUILD)/lib/share/mk
# ====================================================================================
# ALL TARGETS
# ====================================================================================
EXTRALIBORDER= zlib libbzip libxz libeigen dmalloc libffi libgmp libiconv libxml2 libvgl libjpeg libpng libgif libtiff libwebp
EXTRALIBORDER+= libogg libvorbis libflac libsndfile libsdl libfreetype libsdl_ttf libsdl_mixer libsdl_image gls3d freeglut libphysfs libncurses
EXTRALIBORDER+= libopenssl libmcrypt libmhash libnettle libbeecrypt
TESTORDER= test_hello_c test_hello_cpp test_pthreads_c_shell test_pthreads_cpp_swf test_posix
TESTORDER+= test_sjlj test_sjlj_opt test_eh test_eh_opt test_as3interop test_symbols
#TESTORDER+= gcctests swigtests llvmtests checkasm
BUILDORDER= cmake abclibs
BUILDORDER+= uname noenv avm2-as alctool alcdb alcwig
BUILDORDER+= llvm binutils plugins gcc bmake
BUILDORDER+= csu libc libthr libm libBlocksRuntime
BUILDORDER+= gcclibs as3wig abcflashpp abcstdlibs_more
BUILDORDER+= sdkcleanup tr trd swig genfs gdb pkgconfig libtool
ifeq (,$(findstring 1,$(LIGHTSDK)))
BUILDORDER+= $(EXTRALIBORDER)
endif
BUILDORDER+= finalcleanup
BUILDORDER+= $(TESTORDER)
BUILDORDER+= samples
# All Tests
all_tests: $(TESTORDER)
# All Libs
all_libs: $(EXTRALIBORDER)
# All Targets
all:
@echo "Building $(SDKNAME)"
@echo "Please be patient, may take a few hours ..."
@mkdir -p $(BUILD)/logs
@$(MAKE) diagnostics &> $(BUILD)/logs/diagnostics.txt 2>&1
@echo "- install_libs"
@$(MAKE) install_libs &> $(BUILD)/logs/install_libs.txt 2>&1
@echo "- base"
@$(MAKE) base &> $(BUILD)/logs/base.txt 2>&1
@echo "- make"
@$(MAKE) make &> $(BUILD)/logs/make.txt 2>&1
@$(SDK_MAKE) -s all_with_local_make
# Macro for Targets with local Make
all_with_local_make:
@for target in $(BUILDORDER) ; do \
echo "- $$target" ; \
$(MAKE) $$target &> $(BUILD)/logs/$$target.txt 2>&1; \
mret=$$? ; \
logs="$$logs $(BUILD)/logs/$$target.txt" ; \
grep -q "Resource temporarily unavailable" $(BUILD)/logs/$$target.txt ; \
gret=$$? ; \
rcount=1 ; \
while [ $$gret == 0 ] && [ $$rcount -lt 6 ] ; do \
echo "- $$target (retry $$rcount)" ; \
$(MAKE) $$target &> $(BUILD)/logs/$$target.txt 2>&1; \
mret=$$? ; \
grep -q "Resource temporarily unavailable" $(BUILD)/logs/$$target.txt ; \
gret=$$? ; \
let rcount=rcount+1 ; \
done ; \
if [ $$mret -ne 0 ] ; then \
echo "Failed to build: $$target" ;\
exit 1 ; \
fi ; \
done
# Print debug information
diagnostics:
@echo "~~~ $(SDKNAME) ~~~"
@echo "User: $(UNAME)"
@echo "Platform: $(PLATFORM)"
@echo "Build: $(BUILD)"
@echo "Triple: $(TRIPLE)"
@echo "Host Triple: $(HOST_TRIPLE)"
@echo "Build Triple: $(BUILD_TRIPLE)"
@echo "CC: $(shell $(CC) --version)"
@echo "CXX: $(shell $(CXX) --version)"
@echo "FLEX_SDK_TYPE: $(FLEX_SDK_TYPE)"
@echo "FLEX_SDK_HOME: $(FLEX_SDK_HOME)"
# Development target
all_dev:
@$(SDK_MAKE) genfs
# Development target
all_dev51:
@$(SDK_MAKE) abclibs_compile
#@cd samples/05_SWC && $(MAKE)
@$(SDK_MAKE) test_hello_cpp
@$(SDK_MAKE) test_hello_c
# Clean build outputs
clean:
@echo "Cleaning ..."
@rm -rf $(BUILDROOT)
@rm -rf $(SDK)
@$(MAKE) -s clean_libs
@cd samples && $(MAKE) -s clean
@echo "Done."
# Install packaged dependency libraries
install_libs:
tar xf packages/$(DEPENDENCY_BMAKE).tar.gz
tar xf packages/$(DEPENDENCY_CMAKE).tar.gz
tar xf packages/$(DEPENDENCY_DEJAGNU).tar.gz
tar xf packages/$(DEPENDENCY_DMALLOC).tar.gz
tar xf packages/$(DEPENDENCY_GDB).tar.gz
tar xf packages/$(DEPENDENCY_JPEG).tar.gz
tar xf packages/$(DEPENDENCY_LIBAA).tar.gz
tar xf packages/$(DEPENDENCY_BZIP).tar.gz
tar xf packages/$(DEPENDENCY_LIBEIGEN).tar.gz
tar xf packages/$(DEPENDENCY_LIBFLAC).tar.gz
tar xf packages/$(DEPENDENCY_LIBFREETYPE).tar.gz
tar xf packages/$(DEPENDENCY_LIBGIF).tar.gz
tar xf packages/$(DEPENDENCY_LIBGMP).tar.gz
tar xf packages/$(DEPENDENCY_LIBICONV).tar.gz
tar xf packages/$(DEPENDENCY_LIBNCURSES).tar.gz
tar xf packages/$(DEPENDENCY_LIBPROTOBUF).tar.gz
tar xf packages/$(DEPENDENCY_LIBPHYSFS).tar
tar xf packages/$(DEPENDENCY_LIBREADLINE).tar.gz
tar xf packages/$(DEPENDENCY_LIBOGG).tar.gz
tar xf packages/$(DEPENDENCY_LIBPNG).tar.gz
tar xf packages/$(DEPENDENCY_LIBSNDFILE).tar.gz
tar xf packages/$(DEPENDENCY_LIBSDL).tar.gz
tar xf packages/$(DEPENDENCY_LIBSDLIMAGE).tar.gz
tar xf packages/$(DEPENDENCY_LIBSDLMIXER).tar.gz
tar xf packages/$(DEPENDENCY_LIBSDLTTF).tar.gz
#tar xf packages/$(DEPENDENCY_LIBSDL2).tar.gz
#tar xf packages/$(DEPENDENCY_LIBSDL2IMAGE).tar.gz
#tar xf packages/$(DEPENDENCY_LIBSDL2MIXER).tar.gz
#tar xf packages/$(DEPENDENCY_LIBSDL2TTF).tar.gz
tar xf packages/$(DEPENDENCY_LIBTIFF).tar.gz
tar xf packages/$(DEPENDENCY_LIBTOOL).tar.gz
tar xf packages/$(DEPENDENCY_LIBVORBIS).tar.gz
tar xf packages/$(DEPENDENCY_LIBWEBP).tar.gz
tar xf packages/$(DEPENDENCY_XZ).tar.gz
tar xf packages/$(DEPENDENCY_LIBXML).tar.gz
tar xf packages/$(DEPENDENCY_MAKE).tar.gz
tar xf packages/$(DEPENDENCY_OPENSSL).tar.gz
tar xf packages/$(DEPENDENCY_MCRYPT).tar.gz
tar xf packages/$(DEPENDENCY_MHASH).tar.gz
tar xf packages/$(DEPENDENCY_BEECRYPT).tar.gz
tar xf packages/$(DEPENDENCY_NETTLE).tar.gz
tar xf packages/$(DEPENDENCY_PKG_CFG).tar.gz
tar xf packages/$(DEPENDENCY_SWIG).tar.gz
unzip -q -u packages/$(DEPENDENCY_AVMPLUS).zip
tar xf packages/$(DEPENDENCY_ZLIB).tar.gz
# apply patches
cp -r ./patches/$(DEPENDENCY_DEJAGNU) .
cp -r ./patches/$(DEPENDENCY_DMALLOC) .
cp -r ./patches/$(DEPENDENCY_GDB) .
cp -r ./patches/$(DEPENDENCY_LIBPHYSFS) .
cp -r ./patches/$(DEPENDENCY_LIBPNG) .
cp -r ./patches/$(DEPENDENCY_LIBSDL) .
#cp -r ./patches/$(DEPENDENCY_LIBSDL2) .
cp -r ./patches/$(DEPENDENCY_OPENSSL) .
cp -r ./patches/$(DEPENDENCY_MCRYPT) .
cp -r ./patches/$(DEPENDENCY_MHASH) .
cp -r ./patches/$(DEPENDENCY_PKG_CFG) .
cp -r ./patches/$(DEPENDENCY_SWIG) .
cp -r ./patches/$(DEPENDENCY_ZLIB) .
cp -r ./patches/$(DEPENDENCY_AVMPLUS) .
# Clear depdendency libraries
clean_libs:
rm -rf $(DEPENDENCY_BMAKE)
rm -rf $(DEPENDENCY_CMAKE)
rm -rf $(DEPENDENCY_DEJAGNU)
rm -rf $(DEPENDENCY_DMALLOC)
rm -rf $(DEPENDENCY_GDB)
rm -rf $(DEPENDENCY_JPEG)
rm -rf $(DEPENDENCY_LIBAA)
rm -rf $(DEPENDENCY_BZIP)
rm -rf $(DEPENDENCY_LIBEIGEN)
rm -rf eigen-eigen-5097c01bcdc4
rm -rf $(DEPENDENCY_LIBFLAC)
rm -rf $(DEPENDENCY_LIBFREETYPE)
rm -rf $(DEPENDENCY_LIBGIF)
rm -rf $(DEPENDENCY_LIBGMP)
rm -rf $(DEPENDENCY_LIBICONV)
rm -rf $(DEPENDENCY_LIBNCURSES)
rm -rf $(DEPENDENCY_LIBPROTOBUF)
rm -rf $(DEPENDENCY_LIBPHYSFS)
rm -rf $(DEPENDENCY_LIBREADLINE)
rm -rf $(DEPENDENCY_LIBOGG)
rm -rf $(DEPENDENCY_LIBPNG)
rm -rf $(DEPENDENCY_LIBSNDFILE)
rm -rf $(DEPENDENCY_LIBSDL)
rm -rf $(DEPENDENCY_LIBSDLIMAGE)
rm -rf $(DEPENDENCY_LIBSDLMIXER)
rm -rf $(DEPENDENCY_LIBSDLTTF)
rm -rf $(DEPENDENCY_LIBSDL2)
rm -rf $(DEPENDENCY_LIBSDL2IMAGE)
rm -rf $(DEPENDENCY_LIBSDL2MIXER)
rm -rf $(DEPENDENCY_LIBSDL2TTF)
rm -rf $(DEPENDENCY_LIBTIFF)
rm -rf $(DEPENDENCY_LIBTOOL)
rm -rf $(DEPENDENCY_LIBVORBIS)
rm -rf $(DEPENDENCY_LIBWEBP)
rm -rf $(DEPENDENCY_XZ)
rm -rf $(DEPENDENCY_LIBXML)
rm -rf $(DEPENDENCY_MAKE)
rm -rf $(DEPENDENCY_OPENSSL)
rm -rf $(DEPENDENCY_MCRYPT)
rm -rf $(DEPENDENCY_MHASH)
rm -rf $(DEPENDENCY_BEECRYPT)
rm -rf $(DEPENDENCY_NETTLE)
rm -rf $(DEPENDENCY_PKG_CFG)
rm -rf $(DEPENDENCY_SWIG)
rm -rf $(DEPENDENCY_ZLIB)
rm -rf $(DEPENDENCY_AVMPLUS)
# ====================================================================================
# BASE
# ====================================================================================
# Initialize the build
base:
mkdir -p $(BUILDROOT)/extra
mkdir -p $(BUILD)/abclibs
mkdir -p $(SDK)/usr
mkdir -p $(SDK)/usr/bin
mkdir -p $(SDK)/usr/lib
mkdir -p $(SDK)/usr/lib/bfd-plugins
mkdir -p $(SDK)/usr/share
mkdir -p $(SDK)/usr/platform/$(PLATFORM)/libexec/gcc/$(TRIPLE)
$(LN) ../usr $(SDK)/usr/$(TRIPLE)
$(LN) $(PLATFORM) $(SDK)/usr/platform/current
$(LN) ../ $(SDK)/usr/platform/usr
$(LN) ../../bin $(SDK)/usr/platform/current/bin
$(LN) ../../lib $(SDK)/usr/platform/current/lib
$(LN) ../../share $(SDK)/usr/platform/current/share
$(LN) platform/current/libexec $(SDK)/usr/libexec
$(LN) ../../../../../lib $(SDK)/usr/platform/current/libexec/gcc/$(TRIPLE)/lib
cd $(SDK)/usr/platform/current/bin && $(LN) ar$(EXEEXT) avm2-unknown-freebsd8-ar$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) nm$(EXEEXT) avm2-unknown-freebsd8-nm$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) strip$(EXEEXT) avm2-unknown-freebsd8-strip$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) ranlib$(EXEEXT) avm2-unknown-freebsd8-ranlib$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) gcc$(EXEEXT) avm2-unknown-freebsd8-gcc$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) g++$(EXEEXT) avm2-unknown-freebsd8-g++$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) gcc$(EXEEXT) gcc-4.2$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) g++$(EXEEXT) g++-4.2$(EXEEXT)
$(RSYNC) $(SRCROOT)/tools/utils-py/add-opt-in.py $(SDK)/usr/bin/
$(RSYNC) $(SRCROOT)/tools/utils-py/projector-dis.py $(SDK)/usr/bin/
$(RSYNC) $(SRCROOT)/tools/utils-py/swfdink.py $(SDK)/usr/bin/
$(RSYNC) $(SRCROOT)/tools/utils-py/swf-info.py $(SDK)/usr/bin/
$(MAKE) builtinabcs
$(RSYNC) tools/playerglobal/15.0/airglobal.abc $(SDK)/usr/lib/
$(RSYNC) tools/playerglobal/15.0/airglobal.swc $(SDK)/usr/lib/
$(RSYNC) tools/playerglobal/15.0/playerglobal.abc $(SDK)/usr/lib/
$(RSYNC) tools/playerglobal/15.0/playerglobal.swc $(SDK)/usr/lib/
$(RSYNC) avm2_env/public-api.txt $(SDK)/
rm -rf $(DEPENDENCY_AVMPLUS)/generated/builtin.abc
$(RSYNC) tools/playerglobal/15.0/builtin.abc $(DEPENDENCY_AVMPLUS)/generated/
cp -f $(DEPENDENCY_AVMPLUS)/generated/*.abc $(SDK)/usr/lib/
$(RSYNC) --exclude '*iconv.h' avm2_env/usr/include/ $(SDK)/usr/include
$(RSYNC) avm2_env/usr/lib/ $(SDK)/usr/lib
cd $(BUILD) && $(ASC2) $(call nativepath,$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/utils/swfmake.as) -outdir . -out swfmake
cd $(BUILD) && $(ASC2) $(call nativepath,$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/utils/projectormake.as) -outdir . -out projectormake
cd $(BUILD) && $(ASC2) $(call nativepath,$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/utils/abcdump.as) -outdir . -out abcdump
# ====================================================================================
# MAKE
# ====================================================================================
# Assemble GNU Make
make:
rm -rf $(BUILD)/make
mkdir -p $(BUILD)/make
cp -r $(SRCROOT)/$(DEPENDENCY_MAKE)/* $(BUILD)/make/
cd $(BUILD)/make && CC=$(CC) CXX=$(CXX) ./configure --prefix=$(SDK)/usr --program-prefix="" \
--build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=$(TRIPLE)
cd $(BUILD)/make && CC=$(CC) CXX=$(CXX) $(MAKE)
cd $(BUILD)/make && CC=$(CC) CXX=$(CXX) $(MAKE) install
# ====================================================================================
# CMAKE
# ====================================================================================
# Assemble CMake
cmake:
rm -rf $(BUILD)/cmake
rm -rf $(SDK)/usr/cmake_junk
mkdir -p $(BUILD)/cmake
mkdir -p $(SDK)/usr/cmake_junk
mkdir -p $(SDK)/usr/platform/$(PLATFORM)/share/$(DEPENDENCY_CMAKE)/
cp -r $(SRCROOT)/$(DEPENDENCY_CMAKE)/* $(BUILD)/cmake/
cd $(BUILD)/cmake && CC=$(CC) CXX=$(CXX) ./configure --prefix=$(SDK)/usr --datadir=share/$(DEPENDENCY_CMAKE) --docdir=cmake_junk --mandir=cmake_junk
cd $(BUILD)/cmake && CC=$(CC) CXX=$(CXX) $(MAKE)
cd $(BUILD)/cmake && CC=$(CC) CXX=$(CXX) $(MAKE) install
#cp -r $(SDK)/usr/share/$(DEPENDENCY_CMAKE) $(SDK)/usr/platform/$(PLATFORM)/share/
# ====================================================================================
# ABCLIBS
# ====================================================================================
# Assemble builtin ABCs
# Use it if Tamarin AS3 code is modified
builtinabcs:
mkdir -p $(BUILD)/abclibsposix
cd $(BUILD)/abclibsposix && $(PYTHON) $(SRCROOT)/posix/gensyscalls.py $(SRCROOT)/posix/syscalls.changed
cat $(BUILD)/abclibsposix/IKernel.as | sed '1,1d' | sed '$$d' > $(SRCROOT)/posix/IKernel.as
cp $(BUILD)/abclibsposix/IKernel.as $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cp $(BUILD)/abclibsposix/ShellPosix.as $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cp $(BUILD)/abclibsposix/ShellPosixGlue.cpp $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cp $(BUILD)/abclibsposix/ShellPosixGlue.h $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cd $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/core && $(PYTHON) ./builtin.py -abcfuture -config CONFIG::VMCFG_FLOAT=false -config CONFIG::VMCFG_ALCHEMY_SDK_BUILD=true -config CONFIG::VMCFG_ALCHEMY_POSIX=true
cd $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell && $(PYTHON) ./shell_toplevel.py -abcfuture -config CONFIG::VMCFG_FLOAT=false -config CONFIG::VMCFG_ALCHEMY_SDK_BUILD=true -config CONFIG::VMCFG_ALCHEMY_POSIX=true
cp -f $(DEPENDENCY_AVMPLUS)/generated/*.abc $(SDK)/usr/lib/
# Assemble builtin SysCalls
builtinsyscalls:
$(SDK)/usr/bin/gcc -c print_stat_info.c
$(SDK)/usr/bin/llvm-ld -internalize-public-api-file=$(SDK)/public-api.txt \
print_stat_info.o $(SDK)/usr/lib/crt1_c.o $(SDK)/usr/lib/libgcc.a \
$(SDK)/usr/lib/libc.a $(SDK)/usr/lib/libm.a -o print_stat_info-linked
perl $(SRCROOT)/llvm-2.9/lib/Target/AVM2/build.pl $(SDK)/usr print_stat_info-linked.bc \
$(SRCROOT)/$(DEPENDENCY_AVMPLUS)/utils/asc.jar $(SRCROOT)/llvm-2.9/lib/Target/AVM2 print_stat_info
$(AVMSHELL) $(BUILD)/swfmake.abc -- -o print_stat_info.swf \
$(SDK)/usr/lib/C_Run.abc \
$(SDK)/usr/lib/Exit.abc $(SDK)/usr/lib/LongJmp.abc \
$(SDK)/usr/lib/CModule.abc print_stat_info.abc $(SDK)/usr/lib/startHack.abc
$(AVMSHELL) $(BUILD)/projectormake.abc -- -o print_stat_info $(AVMSHELL) \
print_stat_info.swf -- -Djitordie
chmod u+x print_stat_info
rm print_stat_info-linked print_stat_info-linked.bc* print_stat_info.abc print_stat_info.cpp \
print_stat_info.h print_stat_info.o print_stat_info.swf
# Assemble ABC library binaries and documentation
abclibs:
$(MAKE) abclibs_compile
$(MAKE) abclibs_asdocs && $(MAKE) asdocs_deploy
# Assemble ABC library binaries
abclibs_compile:
# Cleaning
mkdir -p $(BUILD)/abclibs
mkdir -p $(BUILD)/abclibsposix
#mkdir -p $(SDK)/usr/lib/abcs
# Generating the Posix interface
cd $(BUILD)/abclibsposix && $(PYTHON) $(SRCROOT)/posix/gensyscalls.py $(SRCROOT)/posix/syscalls.changed
# Post-Processing IKernel
# TODO: Do not print out files in the source folder (VPMedia)
cat $(BUILD)/abclibsposix/IKernel.as | sed '1,1d' | sed '$$d' > $(SRCROOT)/posix/IKernel.as
# Rebuild AVMPlus ABCs
#$(MAKE) builtinabcs
# Generating DefaultPreloader
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/DefaultPreloader.as) -swf com.adobe.flascc.preloader.DefaultPreloader,800,600,60 -outdir . -out DefaultPreloader
# Generating ABC Libs
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) $(call nativepath,$(SRCROOT)/posix/ELF.as) -outdir . -out ELF
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) $(call nativepath,$(SRCROOT)/posix/Exit.as) -outdir . -out Exit
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) $(call nativepath,$(SRCROOT)/posix/LongJmp.as) -outdir . -out LongJmp
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) -import Exit.abc $(call nativepath,$(SRCROOT)/posix/C_Run.as) -outdir . -out C_Run
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) $(call nativepath,$(SRCROOT)/posix/vfs/ISpecialFile.as) -outdir . -out ISpecialFile
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) $(call nativepath,$(SRCROOT)/posix/vfs/IBackingStore.as) -outdir . -out IBackingStore
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import IBackingStore.abc $(call nativepath,$(SRCROOT)/posix/vfs/InMemoryBackingStore.as) -outdir . -out InMemoryBackingStore
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import IBackingStore.abc -import ISpecialFile.abc $(call nativepath,$(SRCROOT)/posix/vfs/IVFS.as) -outdir . -out IVFS
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import ISpecialFile.abc -import IBackingStore.abc -import IVFS.abc -import InMemoryBackingStore.abc $(call nativepath,$(SRCROOT)/posix/vfs/DefaultVFS.as) -outdir . -out DefaultVFS
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import ISpecialFile.abc -import IBackingStore.abc -import IVFS.abc -import InMemoryBackingStore.abc $(call nativepath,$(SRCROOT)/posix/vfs/URLLoaderVFS.as) -outdir . -out URLLoaderVFS
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath, `find $(SRCROOT)/posix/vfs/nochump -name "*.as"`) -outdir . -out AlcVFSZip
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) -import Exit.abc -import C_Run.abc -import IBackingStore.abc -import ISpecialFile.abc -import IVFS.abc -import LongJmp.abc $(call nativepath,$(SRCROOT)/posix/CModule.as) -outdir . -out CModule
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import Exit.abc -import ELF.abc $(call nativepath,$(SRCROOT)/posix/AlcDbgHelper.as) -d -outdir . -out AlcDbgHelper
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/BinaryData.as) -outdir . -out BinaryData
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/Console.as) -outdir . -out Console
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import Exit.abc -import ELF.abc $(call nativepath,$(SRCROOT)/posix/startHack.as) -outdir . -out startHack
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc $(call nativepath,$(SRCROOT)/posix/ShellCreateWorker.as) -outdir . -out ShellCreateWorker
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import Exit.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/PlayerCreateWorker.as) -outdir . -out PlayerCreateWorker
cd $(BUILD)/abclibs && $(ASC2) $(ASC2OPTS) $(ASC2EXTRAOPTS) -import CModule.abc -import C_Run.abc -import Exit.abc -import IBackingStore.abc -import ISpecialFile.abc -import IVFS.abc -import DefaultVFS.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/PlayerKernel.as) -outdir . -out PlayerKernel
cp $(BUILD)/abclibs/*.abc $(SDK)/usr/lib
cp $(BUILD)/abclibs/*.swf $(SDK)/usr/lib
# Assemble AS3 documentation
abclibs_asdocs:
rm -rf $(BUILDROOT)/tempdita
rm -rf $(BUILDROOT)/apidocs
mkdir -p $(BUILDROOT)
mkdir -p $(BUILDROOT)/apidocs
mkdir -p $(BUILDROOT)/apidocs/tempdita
mkdir -p $(BUILD)/logs
cd $(BUILDROOT) && $(FLEX_ASDOC) \
-load-config= \
-external-library-path=$(call nativepath,$(FLEX_SDK_HOME)/frameworks/libs/player/15.0/playerglobal.swc) \
-strict=false -define+=CONFIG::asdocs,true -define+=CONFIG::actual,false -define+=CONFIG::debug,false \
-doc-sources+=$(call nativepath,$(SRCROOT)/posix/vfs) \
-doc-sources+=$(call nativepath,$(SRCROOT)/posix) \
-keep-xml=true \
-exclude-sources+=$(call nativepath,$(SRCROOT)/posix/startHack.as) \
-exclude-sources+=$(call nativepath,$(SRCROOT)/posix/IKernel.as) \
-exclude-sources+=$(call nativepath,$(SRCROOT)/posix/vfs/nochump) \
-package-description-file=$(call nativepath,$(SRCROOT)/test/aspackages.xml) \
-main-title "CrossBridge API Reference" \
-window-title "CrossBridge API Reference" \
-output apidocs
mv $(BUILDROOT)/apidocs/tempdita $(BUILDROOT)/
# Deploy AS3 documentation
asdocs_deploy:
rm -rf $(SDK)/usr/share/asdocs
mkdir -p $(SDK)/usr/share/asdocs
$(RSYNC) --exclude "*.xslt" --exclude "*.html" --exclude ASDoc_Config.xml --exclude overviews.xml $(BUILDROOT)/tempdita/ $(SDK)/usr/share/asdocs
# ====================================================================================
# BASICTOOLS
# ====================================================================================
# Assemble UName Helper
uname:
$(CC) $(SRCROOT)/tools/uname/uname.c -o $(SDK)/usr/bin/uname$(EXEEXT)
# Assemble NoEnv Helper
noenv:
$(CC) $(SRCROOT)/tools/noenv/noenv.c -o $(SDK)/usr/bin/noenv$(EXEEXT)
# Assemble TBD Tool
avm2-as:
$(CXX) $(SRCROOT)/avm2_env/misc/SetAlchemySDKLocation.c $(SRCROOT)/tools/as/as.cpp -o $(SDK)/usr/bin/avm2-as$(EXEEXT)
# Assemble TBD Tool
alctool:
rm -rf $(BUILD)/alctool
mkdir -p $(BUILD)/alctool/flascc
cp -f $(SRCROOT)/tools/lib-air/*.jar $(SDK)/usr/lib/
cp -f $(SRCROOT)/tools/lib-air/legacy/*.jar $(SDK)/usr/lib/
cp -f $(SRCROOT)/tools/aet/*.java $(BUILD)/alctool/flascc/.
cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/alctool/flascc/.
cd $(BUILD)/alctool && $(JAVAC) $(JAVACOPTS) flascc/*.java -cp $(call nativepath,$(SRCROOT)/tools/lib-air/compiler.jar)
cd $(BUILD)/alctool && echo "Main-Class: flascc.AlcTool" > MANIFEST.MF
cd $(BUILD)/alctool && echo "Class-Path: compiler.jar" >> MANIFEST.MF
cd $(BUILD)/alctool && jar cmf MANIFEST.MF alctool.jar flascc/*.class
cp $(BUILD)/alctool/alctool.jar $(SDK)/usr/lib/.
# Assemble Debugger Tool
alcdb:
rm -rf $(BUILD)/alcdb
mkdir -p $(BUILD)/alcdb/flascc
cp -f $(SRCROOT)/tools/alcdb/*.java $(BUILD)/alcdb/flascc/.
cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/alcdb/flascc/.
cd $(BUILD)/alcdb && $(JAVAC) $(JAVACOPTS) flascc/*.java -cp $(call nativepath,$(SRCROOT)/tools/lib-air/legacy/fdb.jar)
cd $(BUILD)/alcdb && echo "Main-Class: flascc.AlcDB" > MANIFEST.MF
cd $(BUILD)/alcdb && echo "Class-Path: fdb.jar" >> MANIFEST.MF
cd $(BUILD)/alcdb && jar cmf MANIFEST.MF alcdb.jar flascc/*.class
cp $(BUILD)/alcdb/alcdb.jar $(SDK)/usr/lib/.
# Assemble Debugger Tool
alcwig:
rm -rf $(BUILD)/alcwig
mkdir -p $(BUILD)/alcwig/flascc/
cp -f $(SRCROOT)/tools/aet/AS3Wig.java $(BUILD)/alcwig/flascc/.
cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/alcwig/flascc/.
cd $(BUILD)/alcwig && $(JAVAC) $(JAVACOPTS) flascc/*.java -cp $(call nativepath,$(SDK)/usr/lib/compiler.jar)
cd $(BUILD)/alcwig && echo "Main-Class: flascc.AS3Wig" > MANIFEST.MF
cd $(BUILD)/alcwig && echo "Class-Path: compiler.jar" >> MANIFEST.MF
cd $(BUILD)/alcwig && jar cmf MANIFEST.MF as3wig.jar flascc/*.class
cp $(BUILD)/alcwig/as3wig.jar $(SDK)/usr/lib/.
# ====================================================================================
# LLVM
# ====================================================================================
# Assemble LLVM Tool-Chain
llvm:
rm -rf $(BUILD)/llvm-debug
mkdir -p $(BUILD)/llvm-debug
cd $(BUILD)/llvm-debug && LDFLAGS="$(LLVMLDFLAGS)" CFLAGS="$(LLVMCFLAGS)" CXXFLAGS="$(LLVMCXXFLAGS)" $(SDK_CMAKE) -G "Unix Makefiles" \
$(LLVMCMAKEOPTS) -DCMAKE_INSTALL_PREFIX=$(LLVMINSTALLPREFIX)/llvm-install -DCMAKE_BUILD_TYPE=$(LLVMBUILDTYPE) -DLLVM_BUILD_CLANG=$(CLANG) \
-DLLVM_ENABLE_ASSERTIONS=$(LLVMASSERTIONS) -DLLVM_BUILD_GOLDPLUGIN=ON -DBINUTILS_INCDIR=$(SRCROOT)/$(DEPENDENCY_BINUTILS)/include \
-DLLVM_TARGETS_TO_BUILD="$(LLVMTARGETS)" -DLLVM_NATIVE_ARCH="avm2" -DLLVM_INCLUDE_TESTS=$(LLVMTESTS) -DLLVM_INCLUDE_EXAMPLES=OFF \
$(SRCROOT)/$(DEPENDENCY_LLVM) && $(MAKE) -j$(THREADS) && $(MAKE) install
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llc$(EXEEXT) $(SDK)/usr/bin/llc$(EXEEXT)
ifeq ($(LLVM_ONLYLLC), false)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-ar$(EXEEXT) $(SDK)/usr/bin/llvm-ar$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-as$(EXEEXT) $(SDK)/usr/bin/llvm-as$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-diff$(EXEEXT) $(SDK)/usr/bin/llvm-diff$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-dis$(EXEEXT) $(SDK)/usr/bin/llvm-dis$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-extract$(EXEEXT) $(SDK)/usr/bin/llvm-extract$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-ld$(EXEEXT) $(SDK)/usr/bin/llvm-ld$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-link$(EXEEXT) $(SDK)/usr/bin/llvm-link$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-nm$(EXEEXT) $(SDK)/usr/bin/llvm-nm$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-ranlib$(EXEEXT) $(SDK)/usr/bin/llvm-ranlib$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/opt$(EXEEXT) $(SDK)/usr/bin/opt$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/lib/LLVMgold.* $(SDK)/usr/lib/LLVMgold$(SOEXT)
cp -f $(BUILD)/llvm-debug/bin/fpcmp$(EXEEXT) $(BUILDROOT)/extra/fpcmp$(EXEEXT)
endif
# Assemble LLVM Tests
llvmtests:
rm -rf $(BUILD)/llvm-tests
mkdir -p $(BUILD)/llvm-tests
cp -f $(SDK)/usr/bin/avmshell-release-debugger $(SDK)/usr/bin/avmshell
#cp -f $(BUILD)/llvm-install/llvm-lit $(SDK)/usr/bin/llvm-lit
cd $(BUILD)/llvm-tests && $(SRCROOT)/$(DEPENDENCY_LLVM)/configure --with-llvmgcc=$(SDK)/usr/bin/gcc --with-llvmgxx=$(SDK)/usr/bin/g++ --without-f2c --without-f95 --disable-clang --enable-jit=no --target=$(TRIPLE) --prefix=$(BUILD)/llvm-install
cd $(BUILD)/llvm-tests && $(LN) $(SDK)/usr Release
cd $(BUILD)/llvm-tests/projects/test-suite/MultiSource && (LANG=C && $(MAKE) TEST=nightly TARGET_LLCFLAGS=-jvm="$(JAVA)" -j$(THREADS) FPCMP=$(FPCMP) DISABLE_CBE=1)
cd $(BUILD)/llvm-tests/projects/test-suite/SingleSource && (LANG=C && $(MAKE) TEST=nightly TARGET_LLCFLAGS=-jvm="$(JAVA)" -j$(THREADS) FPCMP=$(FPCMP) DISABLE_CBE=1)
$(PYTHON) $(SRCROOT)/tools/llvmtestcheck.py --srcdir $(SRCROOT)/$(DEPENDENCY_LLVM)/projects/test-suite/ --builddir $(BUILD)/llvm-tests/projects/test-suite/ --fpcmp $(FPCMP)> $(BUILD)/llvm-tests/passfail.txt
cp $(BUILD)/llvm-tests/passfail.txt $(BUILD)/passfail_llvm.txt
# Assemble LLVM SpecCPU2006 Test
llvmtests-speccpu2006: # works only on mac!
rm -rf $(BUILD)/llvm-tests
rm -rf $(BUILD)/llvm-spec-tests
mkdir -p $(BUILD)/llvm-tests
cp -f $(SDK)/usr/bin/avmshell-release-debugger $(SDK)/usr/bin/avmshell
mkdir -p $(BUILD)/llvm-externals && cd $(BUILD)/llvm-externals && curl http://alchemy.corp.adobe.com/speccpu2006.tar.bz2 | tar xvjf -
#mkdir -p $(BUILD)/llvm-externals && cd $(BUILD)/llvm-externals && cat $(SRCROOT)/speccpu2006.tar.bz2 | tar xvjf -
cd $(BUILD)/llvm-tests && $(SRCROOT)/$(DEPENDENCY_LLVM)/configure --without-f2c --without-f95 --with-llvmgcc=$(SDK)/usr/bin/gcc --with-llvmgxx=$(SDK)/usr/bin/g++ --with-externals=$(BUILD)/llvm-externals --disable-clang --enable-jit=no --target=$(TRIPLE) --prefix=$(BUILD)/llvm-install
cd $(BUILD)/llvm-tests && $(LN) $(SDK)/usr Release
cd $(BUILD)/llvm-tests/projects/test-suite/External && (LANG=C && $(MAKE) TEST=nightly TARGET_LLCFLAGS=-jvm="$(JAVA)" -j$(THREADS) FPCMP=$(FPCMP) DISABLE_CBE=1 CXXFLAGS+='-DSPEC_CPU_MACOSX -DSPEC_CPU_NO_HAS_SIGSETJMP' CFLAGS+='-DSPEC_CPU_MACOSX -DSPEC_CPU_NO_HAS_SIGSETJMP')
$(PYTHON) $(SRCROOT)/tools/llvmtestcheck.py --fpcmp $(FPCMP) --srcdir $(SRCROOT)/$(DEPENDENCY_LLVM)/projects/test-suite/ --builddir $(BUILD)/llvm-tests/projects/test-suite/ > $(BUILD)/llvm-tests/passfail.txt
cp $(BUILD)/llvm-tests/passfail.txt $(BUILD)/passfail_spec.txt
cp -r $(BUILD)/llvm-tests/projects $(BUILD)/llvm-spec-tests
# ====================================================================================
# BINUTILS
# ====================================================================================
binutils:
ifneq (,$(findstring cygwin,$(PLATFORM)))
$(SDK_MAKE) -i binutils_build
else
$(SDK_MAKE) binutils_build
endif
# Assemble LLVM BinUtils
binutils_build:
rm -rf $(BUILD)/binutils
mkdir -p $(BUILD)/binutils
cd $(BUILD)/binutils && CC=$(CC) CXX=$(CXX) CFLAGS="-I$(SRCROOT)/avm2_env/misc/ $(DBGOPTS) " CXXFLAGS="-I$(SRCROOT)/avm2_env/misc/ $(DBGOPTS) " $(SRCROOT)/$(DEPENDENCY_BINUTILS)/configure \
--disable-doc --disable-nls --enable-gold --disable-ld --enable-plugins \
--build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=$(TRIPLE) --with-sysroot=$(SDK)/usr \
--program-prefix="" --prefix=$(SDK)/usr --disable-werror \
--enable-targets=$(TRIPLE)
cd $(BUILD)/binutils && $(MAKE) -j$(THREADS) && $(MAKE) install
mv $(SDK)/usr/bin/ld.gold$(EXEEXT) $(SDK)/usr/bin/ld$(EXEEXT)
rm -rf $(SDK)/usr/bin/readelf$(EXEEXT) $(SDK)/usr/bin/elfedit$(EXEEXT) $(SDK)/usr/bin/ld.bfd$(EXEEXT) $(SDK)/usr/bin/objdump$(EXEEXT) $(SDK)/usr/bin/objcopy$(EXEEXT) $(SDK)/usr/share/info $(SDK)/usr/share/man
# ====================================================================================
# PLUGINS
# ====================================================================================
# Assemble LLVM Plug-ins
plugins:
rm -rf $(BUILD)/makeswf $(BUILD)/multiplug $(BUILD)/zlib
mkdir -p $(BUILD)/makeswf $(BUILD)/multiplug $(BUILD)/zlib
cd $(BUILD)/makeswf && $(CXX) $(DBGOPTS) -I$(SRCROOT)/avm2_env/misc/ -DHAVE_ABCNM -DDEFTMPDIR=\"$(call nativepath,/tmp)\" -DDEFSYSROOT=\"$(call nativepath,$(SDK))\" -DHAVE_STDINT_H -I$(SRCROOT)/$(DEPENDENCY_ZLIB)/ -I$(SRCROOT)/$(DEPENDENCY_BINUTILS)/include -fPIC -c $(SRCROOT)/gold-plugins/makeswf.cpp
cd $(BUILD)/makeswf && $(CXX) $(DBGOPTS) -shared -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup -o makeswf$(SOEXT) makeswf.o
cd $(BUILD)/multiplug && $(CXX) $(DBGOPTS) -I$(SRCROOT)/avm2_env/misc/ -DHAVE_STDINT_H -DSOEXT=\"$(SOEXT)\" -DDEFSYSROOT=\"$(call nativepath,$(SDK))\" -I$(SRCROOT)/$(DEPENDENCY_BINUTILS)/include -fPIC -c $(SRCROOT)/gold-plugins/multiplug.cpp
cd $(BUILD)/multiplug && $(CXX) $(DBGOPTS) -shared -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup -o multiplug$(SOEXT) multiplug.o
cp -f $(BUILD)/makeswf/makeswf$(SOEXT) $(SDK)/usr/lib/makeswf$(SOEXT)
cp -f $(BUILD)/multiplug/multiplug$(SOEXT) $(SDK)/usr/lib/multiplug$(SOEXT)
cp -f $(BUILD)/multiplug/multiplug$(SOEXT) $(SDK)/usr/lib/bfd-plugins/multiplug$(SOEXT)
# ====================================================================================
# GCC
# ====================================================================================
# Assemble LLVM GCC 4.2
gcc:
rm -rf $(BUILD)/llvm-gcc-42
mkdir -p $(BUILD)/llvm-gcc-42
cd $(BUILD)/llvm-gcc-42 && CFLAGS='$(NOPIE) -DSHARED_LIBRARY_EXTENSION=$(SOEXT) $(BUILD_VER_DEFS) -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Os $(DBGOPTS) -I$(SRCROOT)/avm2_env/misc/ ' \
CC=$(CC) CXX=$(CXX) $(SRCROOT)/llvm-gcc-4.2-2.9/configure --enable-languages=c,c++ \
--enable-llvm=$(LLVMINSTALLPREFIX)/llvm-install/ --disable-bootstrap --disable-multilib --disable-libada --disable-doc --disable-nls \
--enable-sjlj-exceptions --disable-shared --program-prefix="" \
--prefix=$(SDK)/usr --with-sysroot="" --with-build-sysroot=$(SDK)/ \
--build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=$(TRIPLE)
cd $(BUILD)/llvm-gcc-42 && CC=$(CC) CXX=$(CXX) $(MAKE) -j$(THREADS) all-gcc \
CFLAGS_FOR_TARGET='$(NOPIE) -DSHARED_LIBRARY_EXTENSION=$(SOEXT) $(BUILD_VER_DEFS) -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Os -emit-llvm -I$(SRCROOT)/avm2_env/misc/ ' \
CXXFLAGS_FOR_TARGET='$(NOPIE) -DSHARED_LIBRARY_EXTENSION=$(SOEXT) $(BUILD_VER_DEFS) -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Os -emit-llvm -I$(SRCROOT)/avm2_env/misc/ ' && $(MAKE) install-gcc
rm -f $(SDK)/usr/bin/gccbug*
rm -f $(BUILD)/llvm-gcc-42/gcc/gccbug*
rm -rf $(SDK)/usr/lib/avm2-unknown-freebsd8
mv $(SDK)/usr/lib/gcc/* $(SDK)/usr/lib/
mv $(SDK)/usr/lib/avm2-unknown-freebsd8/4.2.1/*.a $(SDK)/usr/lib/
rmdir $(SDK)/usr/lib/gcc
$(RSYNC) $(SDK)/usr/libexec/gcc/avm2-unknown-freebsd8/4.2.1/ $(SDK)/usr/bin/
rm -rf $(SDK)/usr/libexec
# ====================================================================================
# BMAKE
# ====================================================================================
# Assemble BMake
bmake:
rm -rf $(BUILD)/bmake
mkdir -p $(BUILD)/bmake
cd $(BUILD)/bmake && $(SRCROOT)/$(DEPENDENCY_BMAKE)/configure && bash make-bootstrap.sh
# ====================================================================================
# STDLIBS
# ====================================================================================
# TBD
csu:
$(RSYNC) avm2_env/usr/ $(BUILD)/lib/
cd $(BUILD)/lib/src/lib/csu/avm2 && $(BMAKE) SSP_CFLAGS="" MACHINE_ARCH=avm2 crt1_c.o
cp -f $(BUILD)/lib/src/lib/csu/avm2/crt1_c.o $(SDK)/usr/lib/.
# TBD
# TODO: We are already calling gensyscalls.py in abclibs_compile phase, is second time really necessary?! (VPMedia)
libc:
mkdir -p $(BUILD)/posix/
rm -f $(BUILD)/posix/*.o
mkdir -p $(BUILD)/lib/src/lib/libc/
$(RSYNC) avm2_env/usr/ $(BUILD)/lib/
cd $(BUILD)/posix && $(PYTHON) $(SRCROOT)/posix/gensyscalls.py $(SRCROOT)/posix/syscalls.changed
cp $(BUILD)/posix/IKernel.as $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cp $(BUILD)/posix/ShellPosix.as $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cp $(BUILD)/posix/ShellPosixGlue.cpp $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cp $(BUILD)/posix/ShellPosixGlue.h $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell
cd $(SRCROOT)/$(DEPENDENCY_AVMPLUS)/shell && $(PYTHON) ./shell_toplevel.py -config CONFIG::VMCFG_ALCHEMY_POSIX=true
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c posix.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/vgl.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -D_KERNEL -c $(SRCROOT)/avm2_env/usr/src/kern/kern_umtx.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -I $(SRCROOT)/avm2_env/usr/src/lib/libc/include/ -c $(SRCROOT)/posix/thrStubs.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/kpmalloc.c
cd $(BUILD)/posix && cp *.o $(BUILD)/lib/src/lib/libc/
cd $(BUILD)/lib/src/lib/libc && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 libc.a
# find bitcode (and ignore non-bitcode genned from .s files) and put
# it in our lib
rm -f $(BUILD)/lib/src/lib/libc/tmp/*
$(AR) $(SDK)/usr/lib/libssp.a $(BUILD)/lib/src/lib/libc/stack_protector.o && cp $(SDK)/usr/lib/libssp.a $(SDK)/usr/lib/libssp_nonshared.a
# we override these in thrStubs.c but leave them weak
cd $(BUILD)/lib/src/lib/libc && $(SDK)/usr/bin/llvm-dis -o=_pthread_stubs.ll _pthread_stubs.o && sed -E 's/@pthread_(key_create|key_delete|getspecific|setspecific|once) =/@_d_u_m_m_y_\1 =/g' _pthread_stubs.ll | $(SDK)/usr/bin/llvm-as -o _pthread_stubs.o
cd $(BUILD)/lib/src/lib/libc && rm -f libc.a && find . -name '*.o' -exec sh -c 'file {} | grep -v 86 > /dev/null' \; -print | xargs $(AR) libc.a
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -I $(SRCROOT)/avm2_env/usr/src/lib/libc/include/ -fexceptions -c $(SRCROOT)/posix/libcHack.c
cp -f $(BUILD)/lib/src/lib/libc/libc.a $(BUILD)/posix/libcHack.o $(SDK)/usr/lib/.
# TBD
libthr:
rm -rf $(BUILD)/libthr
mkdir -p $(BUILD)/libthr
$(RSYNC) avm2_env/usr/src/lib/ $(BUILD)/libthr/
cd $(BUILD)/libthr/libthr && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/thrHelpers.c
# CWARNFLAGS= because thr_exit() can return and pthread_exit() is marked noreturn (where?)...
cd $(BUILD)/libthr/libthr && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 CWARNFLAGS= libthr.a
# find bitcode (and ignore non-bitcode genned from .s files) and put
# it in our lib
cd $(BUILD)/libthr/libthr && rm -f libthr.a && find . -name '*.o' -exec sh -c 'file {} | grep -v 86 > /dev/null' \; -print | xargs $(AR) libthr.a
cp -f $(BUILD)/libthr/libthr/libthr.a $(SDK)/usr/lib/.
# TBD
libm:
cd compiler_rt && $(MAKE) clean && $(MAKE) avm2 CC="$(SDK)/usr/bin/gcc -emit-llvm" RANLIB=$(SDK)/usr/bin/ranlib AR=$(SDK_AR) VERBOSE=1
$(SDK)/usr/bin/llvm-link -o $(BUILD)/libcompiler_rt.o compiler_rt/avm2/avm2/avm2/SubDir.lib/*.o
$(SDK_NM) $(BUILD)/libcompiler_rt.o | grep "T _" | sed 's/_//' | awk '{print $$3}' | sort | uniq > $(BUILD)/compiler_rt.txt
cat $(BUILD)/compiler_rt.txt >> $(SDK)/public-api.txt
cat $(SRCROOT)/$(DEPENDENCY_LLVM)/lib/CodeGen/SelectionDAG/TargetLowering.cpp | grep "Names\[RTLIB::" | awk '{print $$3}' | sed 's/"//g' | sed 's/;//' | sort | uniq > $(BUILD)/rtlib.txt
cat avm2_env/rtlib-extras.txt >> $(BUILD)/rtlib.txt
rm -rf $(BUILD)/msun/ $(BUILD)/libmbc $(SDK)/usr/lib/libm.a $(SDK)/usr/lib/libm.o
mkdir -p $(BUILD)/msun
$(RSYNC) avm2_env/usr/src/lib/ $(BUILD)/msun/
cd $(BUILD)/msun/msun && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 libm.a
# find bitcode (and ignore non-bitcode genned from .s files) and put
# it in our lib
cd $(BUILD)/msun/msun && rm -f libm.a && find . -name '*.o' -exec sh -c 'file {} | grep -v 86 > /dev/null' \; -print | xargs $(AR) libm.a
# remove symbols for sin, cos, other things we support as intrinsics
cd $(BUILD)/msun/msun && $(SDK_AR) sd libm.a s_cos.o s_sin.o e_pow.o e_sqrt.o
$(SDK_AR) r $(SDK)/usr/lib/libm.a
mkdir -p $(BUILD)/libmbc
cd $(BUILD)/libmbc && $(SDK_AR) x $(BUILD)/msun/msun/libm.a
cd $(BUILD)/libmbc && $(SDK)/usr/bin/llvm-link -o $(BUILD)/libmbc/libm.o $(BUILD)/libcompiler_rt.o *.o
$(SDK)/usr/bin/opt -O3 -o $(SDK)/usr/lib/libm.o $(BUILD)/libmbc/libm.o
$(SDK_NM) $(SDK)/usr/lib/libm.o | grep "T _" | sed 's/_//' | awk '{print $$3}' | sort | uniq > $(BUILD)/libm.bc.txt
# TBD
libBlocksRuntime:
cd compiler_rt/BlocksRuntime && echo '#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT' > config.h && echo '#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG' >> config.h
cd compiler_rt/BlocksRuntime && $(SDK)/usr/bin/gcc -emit-llvm -c data.c -o data.o
cd compiler_rt/BlocksRuntime && $(SDK)/usr/bin/gcc -emit-llvm -c runtime.c -o runtime.o
cd compiler_rt/BlocksRuntime && $(AR) $(SDK)/usr/lib/libBlocksRuntime.a data.o runtime.o
cp compiler_rt/BlocksRuntime/Block*.h $(SDK)/usr/include/
# ====================================================================================
# GCCLIBS
# ====================================================================================
# TBD
gcclibs:
rm -rf $(BUILD)/llvm-gcc-42/$(TRIPLE)
cd $(BUILD)/llvm-gcc-42 \
&& $(MAKE) -j$(THREADS) FLASCC_INTERNAL_SDK_ROOT=$(SDK) CFLAGS_FOR_TARGET='-O2 -emit-llvm ' CXXFLAGS_FOR_TARGET='-O2 -emit-llvm ' all-target-libstdc++-v3 all-target-libgomp \
&& $(MAKE) -j$(THREADS) FLASCC_INTERNAL_SDK_ROOT=$(SDK) install-target-libstdc++-v3 install-target-libgomp \
&& find $(SDK) -name '*.gch' -type d | xargs rm -rf
$(SDK)/usr/bin/ranlib $(SDK)/usr/lib/libstdc++.a
$(SDK)/usr/bin/ranlib $(SDK)/usr/lib/libsupc++.a
$(SDK)/usr/bin/ranlib $(SDK)/usr/lib/libgomp.a
cp -f $(SDK)/usr/lib/gcc/$(TRIPLE)/4.2.1/include/omp.h $(SDK)/usr/include/
rm -rf $(SDK)/usr/lib/gcc
mkdir -p $(SDK)/usr/lib/stdlibs_abc
cd $(BUILD)/posix && $(SDK)/usr/bin/g++ -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/AS3++.cpp
cd $(BUILD)/posix && $(SDK)/usr/bin/llc -gendbgsymtable -jvm="$(JAVA)" -falcon-parallel -filetype=obj AS3++.o -o AS3++.abc
cd $(BUILD)/posix && $(SDK_AR) crus $(SDK)/usr/lib/libAS3++.a AS3++.o
cd $(BUILD)/posix && $(SDK_AR) crus $(SDK)/usr/lib/stdlibs_abc/libAS3++.a AS3++.abc
# ====================================================================================
# AS3WIG
# ====================================================================================
# TBD
as3wig:
rm -rf $(BUILD)/as3wig
mkdir -p $(BUILD)/as3wig
#mkdir -p $(BUILD)/as3wig/flascc
#cp -f $(SRCROOT)/tools/aet/AS3Wig.java $(BUILD)/as3wig/flascc/.
#cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/as3wig/flascc/.
#cd $(BUILD)/as3wig && $(JAVAC) $(JAVACOPTS) flascc/*.java -cp $(call nativepath,$(SDK)/usr/lib/compiler.jar)
#cd $(BUILD)/as3wig && echo "Main-Class: flascc.AS3Wig" > MANIFEST.MF
#cd $(BUILD)/as3wig && echo "Class-Path: compiler.jar" >> MANIFEST.MF
#cd $(BUILD)/as3wig && jar cmf MANIFEST.MF as3wig.jar flascc/*.class
#cp $(BUILD)/as3wig/as3wig.jar $(SDK)/usr/lib/.
mkdir -p $(SDK)/usr/include/AS3++/
cp -f $(SRCROOT)/tools/aet/AS3Wig.h $(SDK)/usr/include/AS3++/AS3Wig.h
java -jar $(call nativepath,$(SDK)/usr/lib/as3wig.jar) -builtins -i $(call nativepath,$(SDK)/usr/lib/builtin.abc) -o $(call nativepath,$(SDK)/usr/include/AS3++/builtin)
java -jar $(call nativepath,$(SDK)/usr/lib/as3wig.jar) -builtins -i $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -o $(call nativepath,$(SDK)/usr/include/AS3++/playerglobal)
cp -f $(SRCROOT)/tools/aet/AS3Wig.cpp $(BUILD)/as3wig/
echo "#include <AS3++/builtin.h>\n" > $(BUILD)/as3wig/AS3WigIncludes.h
echo "#include <AS3++/playerglobal.h>\n" >> $(BUILD)/as3wig/AS3WigIncludes.h
cd $(BUILD)/as3wig && $(SDK)/usr/bin/g++ -c -emit-llvm -I. AS3Wig.cpp -o Flash++.o
cd $(BUILD)/as3wig && $(SDK_AR) crus $(SDK)/usr/lib/libFlash++.a Flash++.o
# ====================================================================================
# ABCSDTLIBS
# ====================================================================================
# TBD
abcflashpp:
$(SDK)/usr/bin/llc -gendbgsymtable -jvmopt=-Xmx4G -jvm="$(JAVA)" -falcon-parallel -target-player -filetype=obj $(BUILD)/as3wig/Flash++.o -o $(BUILD)/as3wig/Flash++.abc
$(SDK_AR) crus $(SDK)/usr/lib/stdlibs_abc/libFlash++.a $(BUILD)/as3wig/Flash++.abc
# TBD
abcstdlibs_more:
mkdir -p $(SDK)/usr/lib/stdlibs_abc
$(SDK)/usr/bin/llc -gendbgsymtable -jvm="$(JAVA)" -falcon-parallel -filetype=obj $(SDK)/usr/lib/crt1_c.o -o $(SDK)/usr/lib/stdlibs_abc/crt1_c.o