forked from libretro/libretro-super
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libretro-config.sh
executable file
·1022 lines (911 loc) · 27.1 KB
/
libretro-config.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
# vim: set ts=3 sw=3 noet ft=sh : bash
# The platform variable is normally not set at the time libretro-config is
# included by libretro-build.sh. Other platform scripts may begin to include
# libretro-config as well if they define their platform-specific code in the
# case block below. This is a band-aid fix that we will address after 1.1 is
# released.
#if uncommented, will build experimental cores as well which are not yet fit for release.
#export BUILD_EXPERIMENTAL=1
#ARM DEFINES
#===========
#if uncommented, will build cores with Cortex A8 compiler optimizations
#export CORTEX_A8=1
#if uncommented, will build cores with Cortex A9 compiler optimizations
#export CORTEX_A9=1
#if uncommented, will build cores with ARM hardfloat ABI
#export ARM_HARDFLOAT=1
#if uncommented, will build cores with ARM softfloat ABI
#export ARM_SOFTFLOAT=1
#if uncommented, will build cores with ARM NEON support (ARMv7+ only)
#export ARM_NEON=1
#OPENGL DEFINES
#==============
#if uncommented, will build libretro GL cores. Ignored for mobile platforms - GL cores will always be built there.
export BUILD_LIBRETRO_GL=1
#if uncommented, will build cores with OpenGL ES 2 support. Not needed
#for platform-specific cores - only for generic core builds (ie. libretro-build.sh)
#export ENABLE_GLES=1
#Statically link cores
#export STATIC_LINKING=1
#ANDROID DEFINES
#================
export TARGET_ABIS="armeabi-v7a arm64-v8a x86 x86_64"
#uncomment to define NDK standalone toolchain for ARM
#export NDK_ROOT_DIR_ARM =
#uncomment to define NDK standalone toolchain for MIPS
#export NDK_ROOT_DIR_MIPS =
#uncomment to define NDK standalone toolchain for x86
#export NDK_ROOT_DIR_X86 =
# android version target if GLES is in use
export NDK_GL_HEADER_VER=android-18
# android version target if GLES is not in use
export NDK_NO_GL_HEADER_VER=android-9
# Retroarch target android API level
export RA_ANDROID_API=android-18
# Retroarch minimum API level (defines low end android version compatability)
export RA_ANDROID_MIN_API=android-9
#OSX DEFINES
#===========
# Define this to skip the universal build
# export NOUNIVERSAL=1
# ARCHFLAGS is a very convenient way of doing this for simple/obvious cores
# that don't need anything defined on the command line for 32 vs 64 bit
# systems, however it won't work for anything that does. For that, you need
# to do two separate builds, one for each arch, and then do something like:
# lipo -create core_i386.dylib core_x86_64.dylib -output core_ub.dylib
#
# If building on 10.5/10.6, it's possible that you could actually build a UB
# for Intel/PowerPC, but please don't. ;) Consider this a proof of concept
# for now just to test a few cores.
if [[ "$FORMAT_COMPILER_TARGET" = "osx" && -z "$NOUNIVERSAL" ]]; then
case "$ARCH" in
i386|x86_64)
export ARCHFLAGS="-arch i386 -arch x86_64"
;;
Power*|ppc|ppc64)
export ARCHFLAGS="-arch ppc -arch ppc64"
;;
*)
echo "Will not build universal binaries for unknown ARCH=\"$ARCH\""
;;
esac
fi
# OUTPUT AND LOGGING
# ==================
#
# This is kind of an inline design document that'll be changed for basic user
# instructions when the logging system is finished and tested.
#
# libretro-super has two kinds of output, the basic kind showing what the
# script is doing in a big-picture sense, and the commands and output from
# individual commands. End-users don't necessarily need to see this more
# detailed output, except when we're talking about huge cores like mame.
#
# If each can be directed to null, to the screen, to a log file, or to both
# the screen and a log file, you end up with a matrix os 16 possibilities. Of
# those, only a few are truly useful:
#
# Basic Detailed Useful to
# screen screen developer/end-user w/ space issues
# screen both developer
# both both developer
# screen log end-user
# log log buildbot
#
# What this tells me is that we need to log by default, as long as we kill
# old logfiles to avoid filling your HD with gigabytes of mame build logs.
# Output should go to both screen and log for developers, but users don't need
# to see the make commands, etc. Being able to disable both would be useful,
# but that a near-term TODO item. That just leaves being able to squelch the
# screen output for buildbot usage, and that's just > /dev/null on the command
# line, so not our problem here.
#
# Again, the ability to turn OFF these logs will be wanted very soon.
# Uncomment this to avoid clobbering logs
#LIBRETRO_LOG_APPEND=1
# Change this to adjust where logs are written
#LIBRETRO_LOG_DIR="$WORKDIR/log"
# Change this to rename the libretro-super main log file
#LIBRETRO_LOG_SUPER="libretro-super.log"
# Change this to rename core log files (%s for core's "safe" name)
#LIBRETRO_LOG_CORE="%s.log"
# Comment this if you don't need to see developer output
LIBRETRO_DEVELOPER=1
# BUILD_REVISIONS
# ===============
#
# libretro-super can save a revision string (e.g., the git sha hash) for any
# core it has compiled. If this feature is enabled, it will check if the
# revison string has changed before it compiles the core. This can speed up
# the build process for end-users and buildbots, and it also results in nightly
# build directories being smaller. It is not enabled by default because it
# cannot know about uncommitted changes in a working directory.
# Set this to enable the feature
#SKIP_UNCHANGED=1
# Set this if you don't like the default
#BUILD_REVISIONS_DIR="$WORKDIR/build-revisions"
# COLOR IN OUTPUT
# ===============
#
# If you don't like ANSI-style color in your output, uncomment this line.
#NO_COLOR=1
# If you want to force it even in log files, uncomment this line.
#FORCE_COLOR=1
#USER DEFINES
#------------
#These options should be defined inside your own
#local libretro-config-user.sh file rather than here.
#The following below is just a sample.
if [ -f "$WORKDIR/libretro-config-user.sh" ]; then
. "$WORKDIR/libretro-config-user.sh"
fi
case "$platform" in
##
## Configs that did not use libretro-config originally
## TODO: Integrate this with everything else (post-1.1)
##
emscripten)
DIST_DIR="emscripten"
FORMAT_EXT=bc
FORMAT=_emscripten
FORMAT_COMPILER_TARGET=emscripten
FORMAT_COMPILER_TARGET_ALT=emscripten
;;
ios)
# NOTE: This config requires a Mac with an Xcode installation. These
# scripts will work at least as far as 10.5 that we're sure of, but
# we build with clang targeting iOS >= 5. We'll accept patches for
# older versions of iOS.
DIST_DIR="ios"
FORMAT_EXT=dylib
IOS=1
ARCH=armv7
FORMAT=_ios
FORMAT_COMPILER_TARGET=ios
FORMAT_COMPILER_TARGET_ALT=ios
export IOSSDK=$(xcodebuild -version -sdk iphoneos Path)
MIN_IOS5="-miphoneos-version-min=5.0"
MIN_IOS7="-miphoneos-version-min=7.0"
# Use generic names rather than gcc/clang to better support both
CC="cc -arch armv7 -marm -miphoneos-version-min=5.0 -isysroot $IOSSDK"
CXX="c++ -arch armv7 -marm -miphoneos-version-min=5.0 -isysroot $IOSSDK"
CXX11="clang++ -std=c++11 -stdlib=libc++ -arch armv7 -marm -miphoneos-version-min=5.0 -isysroot $IOSSDK"
;;
ios9)
# NOTE: This config requires a Mac with an Xcode installation. These
# scripts will work at least as far as 10.5 that we're sure of, but
# we build with clang targeting iOS >= 5. We'll accept patches for
# older versions of iOS.
DIST_DIR="ios9"
FORMAT_EXT=dylib
IOS=1
ARCH=armv7
FORMAT=_ios
FORMAT_COMPILER_TARGET=ios9
FORMAT_COMPILER_TARGET_ALT=ios9
export IOSSDK=$(xcodebuild -version -sdk iphoneos Path)
MIN_IOS5="-miphoneos-version-min=5.0"
MIN_IOS7="-miphoneos-version-min=7.0"
# Use generic names rather than gcc/clang to better support both
CC="cc -arch armv7 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX="c++ -arch armv7 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX11="clang++ -std=c++11 -stdlib=libc++ -arch armv7 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
;;
ios10)
DIST_DIR="ios10"
FORMAT_EXT=dylib
IOS=1
ARCH=armv7 arm64
FORMAT=_ios
FORMAT_COMPILER_TARGET=ios10
FORMAT_COMPILER_TARGET_ALT=ios10
export IOSSDK=$(xcodebuild -version -sdk iphoneos Path)
# Use generic names rather than gcc/clang to better support both
CC="cc -arch armv7 -arch arm64 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX="c++ -arch armv7 -arch arm64 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX11="clang++ -std=c++11 -stdlib=libc++ -arch armv7 -arch arm64 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
;;
ios-arm64)
DIST_DIR="ios-arm64"
FORMAT_EXT=dylib
IOS=1
ARCH=arm64
FORMAT=_ios
FORMAT_COMPILER_TARGET=ios-arm64
FORMAT_COMPILER_TARGET_ALT=ios-arm64
export IOSSDK=$(xcodebuild -version -sdk iphoneos Path)
# Use generic names rather than gcc/clang to better support both
CC="cc -arch arm64 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX="c++ -arch arm64 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX11="clang++ -std=c++11 -stdlib=libc++ -arch arm64 -marm -miphoneos-version-min=8.0 -isysroot $IOSSDK"
CXX17="clang++ -std=c++17 -stdlib=libc++ -arch arm64 -isysroot $IOSSDK"
;;
tvos-arm64)
DIST_DIR="tvos-arm64"
FORMAT_EXT=dylib
IOS=1
ARCH=arm64
FORMAT=_tvos
FORMAT_COMPILER_TARGET=tvos-arm64
FORMAT_COMPILER_TARGET_ALT=tvos-arm64
export IOSSDK=$(xcodebuild -version -sdk appletvos Path)
# Use generic names rather than gcc/clang to better support both
CC="cc -arch arm64 -marm -mtvos-version-min=9.0 -isysroot $IOSSDK"
CXX="c++ -arch arm64 -marm -mtvos-version-min=9.0 -isysroot $IOSSDK"
CXX11="clang++ -std=c++11 -stdlib=libc++ -arch arm64 -marm -mtvos-version-min=9.0 -isysroot $IOSSDK"
CXX17="clang++ -std=c++17 -stdlib=libc++ -arch arm64 -isysroot $IOSSDK"
;;
android-x86_64)
FORMAT_ABI="x86_64"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_${FORMAT_ABI}
FORMAT_COMPILER_TARGET_ALT=android_${FORMAT_ABI}
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/x86_64-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/x86_64-linux-android-gcc"
CXX="$NDK_ROOT_DIR/toolchains/x86_64-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/x86_64-linux-android-g++"
CXX11="$NDK_ROOT_DIR/toolchains/x86_64-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/x86_64-linux-android-g++"
;;
android-x86)
FORMAT_ABI="x86"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_${FORMAT_ABI}
FORMAT_COMPILER_TARGET_ALT=android_${FORMAT_ABI}
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/x86-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/i686-linux-android-gcc"
CXX="$NDK_ROOT_DIR/toolchains/x86-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/i686-linux-android-g++"
CXX11="$NDK_ROOT_DIR/toolchains/x86-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/i686-linux-android-g++"
;;
android-armeabi)
FORMAT_ABI="armeabi"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_${FORMAT_ABI}
FORMAT_COMPILER_TARGET_ALT=android_${FORMAT_ABI}
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/arm-linux-androideabi-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/arm-linux-androideabi-gcc"
CXX="$NDK_ROOT_DIR/toolchains/arm-linux-androideabi-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/arm-linux-androideabi-g++"
CXX11="$NDK_ROOT_DIR/toolchains/arm-linux-androideabi-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/arm-linux-androideabi-g++"
;;
android-armeabi_v7a)
FORMAT_ABI="armeabi-v7a"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_armeabi-v7a
FORMAT_COMPILER_TARGET_ALT=android_armeabi-v7a
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/arm-linux-androideabi-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/arm-linux-androideabi-gcc"
CXX="$NDK_ROOT_DIR/toolchains/arm-linux-androideabi-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/arm-linux-androideabi-g++"
CXX11="$NDK_ROOT_DIR/toolchains/arm-linux-androideabi-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/arm-linux-androideabi-g++"
;;
android-arm64_v8a)
FORMAT_ABI="arm64-v8a"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_arm64-v8a
FORMAT_COMPILER_TARGET_ALT=android_arm64-v8a
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/aarch64-linux-android-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/aarch64-linux-android-gcc"
CXX="$NDK_ROOT_DIR/toolchains/aarch64-linux-android-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/aarch64-linux-android-g++"
CXX11="$NDK_ROOT_DIR/toolchains/aarch64-linux-android-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/aarch64-linux-android-g++"
;;
android-mips)
FORMAT_ABI="mips"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_${FORMAT_ABI}
FORMAT_COMPILER_TARGET_ALT=android_${FORMAT_ABI}
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/mipsel-linux-android-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/mipsel-linux-android-gcc"
CXX="$NDK_ROOT_DIR/toolchains/mipsel-linux-android-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/mipsel-linux-android-g++"
CXX11="$NDK_ROOT_DIR/toolchains/mipsel-linux-android-4.8/prebuilt/${HOST_PLATFORM}-x86_64/bin/mipsel-linux-android-g++"
;;
android-mips64)
FORMAT_ABI="mips64"
DIST_DIR="android/${FORMAT_ABI}"
FORMAT_EXT=so
FORMAT=".android_${FORMAT_ABI}"
FORMAT_COMPILER_TARGET=android_${FORMAT_ABI}
FORMAT_COMPILER_TARGET_ALT=android_${FORMAT_ABI}
FORMAT_ABI_ANDROID=yes
UNAME_PLATFORM="$(uname)"
HOST_PLATFORM="linux"
case "$UNAME_PLATFORM" in
osx|*Darwin*)
HOST_PLATFORM="darwin"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
HOST_PLATFORM="windows"
;;
win64|*mingw64*|*MINGW64*)
HOST_PLATFORM="windows"
;;
esac
export NDK_ROOT_DIR
CC="$NDK_ROOT_DIR/toolchains/mips64el-linux-android-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/mips64el-linux-android-gcc"
CXX="$NDK_ROOT_DIR/toolchains/mips64el-linux-android-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/mips64el-linux-android-g++"
CXX11="$NDK_ROOT_DIR/toolchains/mips64el-linux-android-4.9/prebuilt/${HOST_PLATFORM}-x86_64/bin/mips64el-linux-android-g++"
;;
qnx)
DIST_DIR="qnx"
FORMAT_EXT=so
FORMAT=_qnx
FORMAT_COMPILER_TARGET=qnx
FORMAT_COMPILER_TARGET_ALT=qnx
CC="qcc -Vgcc_ntoarmv7le"
CXX="QCC -Vgcc_ntoarmv7le_cpp"
CXX11="QCC -Vgcc_ntoarmv7le_cpp"
;;
psp1)
DIST_DIR="psp1"
FORMAT_EXT=a
FORMAT=_psp1
FORMAT_COMPILER_TARGET=psp1
FORMAT_COMPILER_TARGET_ALT=psp1
CC="psp-gcc${BINARY_EXT}"
CXX="psp-g++${BINARY_EXT}"
;;
psl1ght)
DIST_DIR="psl1ght"
FORMAT_EXT=a
FORMAT=_psl1ght
FORMAT_COMPILER_TARGET=psl1ght
FORMAT_COMPILER_TARGET_ALT=psl1ght
CC="powerpc64-ps3-elf-gcc${BINARY_EXT}"
CXX="powerpc64-ps3-elf-g++${BINARY_EXT}"
;;
ps2)
DIST_DIR="ps2"
FORMAT_EXT=a
FORMAT=_ps2
FORMAT_COMPILER_TARGET=ps2
FORMAT_COMPILER_TARGET_ALT=ps2
CC="ee-gcc${BINARY_EXT}"
CXX="ee-g++${BINARY_EXT}"
;;
ctr)
DIST_DIR="ctr"
FORMAT_EXT=a
FORMAT=_ctr
FORMAT_COMPILER_TARGET=ctr
FORMAT_COMPILER_TARGET_ALT=ctr
CC="$DEVKITARM/bin/arm-none-eabi-gcc$BINARY_EXT"
CXX="$DEVKITARM/bin/arm-none-eabi-g++$BINARY_EXT"
AR="$DEVKITARM/bin/arm-none-eabi-ar$BINARY_EXT"
;;
vita)
DIST_DIR="vita"
FORMAT_EXT=a
FORMAT=_vita
FORMAT_COMPILER_TARGET=vita
FORMAT_COMPILER_TARGET_ALT=vita
CC="arm-vita-eabi-gcc${BINARY_EXT}"
CXX="arm-vita-eabi-g++${BINARY_EXT}"
;;
ps3)
DIST_DIR="ps3"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=ps3
FORMAT_COMPILER_TARGET_ALT=sncps3
FORMAT=_ps3
CC="ppu-lv2-gcc.exe"
CXX="ppu-lv2-g++.exe"
;;
ngc)
DIST_DIR="ngc"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=ngc
FORMAT_COMPILER_TARGET_ALT=ngc
FORMAT=_ngc
CC="$DEVKITPPC/bin/powerpc-eabi-gcc$BINARY_EXT"
CXX="$DEVKITPPC/bin/powerpc-eabi-g++$BINARY_EXT"
AR="$DEVKITPPC/bin/powerpc-eabi-ar$BINARY_EXT"
;;
wii)
DIST_DIR="wii"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=wii
FORMAT_COMPILER_TARGET_ALT=wii
FORMAT=_wii
CC="$DEVKITPPC/bin/powerpc-eabi-gcc$BINARY_EXT"
CXX="$DEVKITPPC/bin/powerpc-eabi-g++$BINARY_EXT"
AR="$DEVKITPPC/bin/powerpc-eabi-ar$BINARY_EXT"
;;
xbox1)
DIST_DIR="xbox1"
FORMAT_EXT=lib
FORMAT_COMPILER_TARGET=xbox1_msvc2003
FORMAT_COMPILER_TARGET_ALT=xbox1_msvc2003
FORMAT=_xdk1
BINARY_EXT=.exe
CC="cl.exe"
CXX="cl.exe"
;;
xbox360)
DIST_DIR="xbox360"
FORMAT_EXT=lib
FORMAT_COMPILER_TARGET=xbox360_msvc2010
FORMAT_COMPILER_TARGET_ALT=xbox360_msvc2010
FORMAT=_xdk360
BINARY_EXT=.exe
CC="cl.exe"
CXX="cl.exe"
;;
wiiu)
DIST_DIR="wiiu"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=wiiu
FORMAT_COMPILER_TARGET_ALT=wiiu
FORMAT=_wiiu
CC="$DEVKITPPC/bin/powerpc-eabi-gcc$BINARY_EXT"
CXX="$DEVKITPPC/bin/powerpc-eabi-g++$BINARY_EXT"
AR="$DEVKITPPC/bin/powerpc-eabi-ar$BINARY_EXT"
;;
switch)
DIST_DIR="switch"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=switch
FORMAT_COMPILER_TARGET_ALT=switch
FORMAT=_switch
CC="clang$BINARY_EXT"
CXX="clang++$BINARY_EXT"
AR="llvm-ar$BINARY_EXT"
;;
libnx)
DIST_DIR="libnx"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=libnx
FORMAT_COMPILER_TARGET_ALT=libnx
FORMAT=_libnx
;;
sncps3)
DIST_DIR="ps3"
FORMAT_EXT=a
FORMAT_COMPILER_TARGET=sncps3
FORMAT=_ps3
CC="$CELL_SDK/host-win32/sn/bin/ps3ppusnc.exe"
CXX="$CELL_SDK/host-win32/sn/bin/ps3ppusnc.exe"
;;
theos_ios)
DIST_DIR="theos_ios"
BUILD_PRODUCT_PREFIX="objs/obj"
FORMAT_EXT=dylib
IOS=1
ARCH=armv7
FORMAT=_ios
FORMAT_COMPILER_TARGET=theos_ios
FORMAT_COMPILER_TARGET_ALT=theos_ios
# Make sure that the cross bins you need are first in your path
CXX11="clang++ -std=c++11 -stdlib=libc++ -miphoneos-version-min=5.0"
;;
##
## Original libretro-config path
##
*)
# Architecture Assignment
config_cpu() {
[ -n "$2" ] && ARCH="$1"
[ -z "$ARCH" ] && ARCH="$(uname -m)"
case "$ARCH" in
x86_64)
X86=true
X86_64=true
;;
i386|i686)
X86=true
;;
armv*)
ARM=true
export FORMAT_COMPILER_TARGET=armv
export RARCHCFLAGS="$RARCHCFLAGS -marm"
case "$ARCH" in
armv5tel) ARMV5=true ;;
armv6l) ARMV6=true ;;
armv7l) ARMV7=true ;;
esac
;;
esac
if [ -n "$PROCESSOR_ARCHITEW6432" -a "$PROCESSOR_ARCHITEW6432" = "AMD64" ]; then
ARCH=x86_64
X86=true && X86_64=true
fi
}
# Platform Assignment
config_platform() {
[ -n "$1" ] && platform="$1"
[ -z "$platform" ] && platform="$(uname)"
case "$platform" in
*BSD*)
platform=bsd
FORMAT_EXT="so"
BINARY_EXT=""
FORMAT_COMPILER_TARGET="unix"
DIST_DIR="bsd"
;;
*Haiku*)
platform=haiku
FORMAT_EXT="so"
BINARY_EXT=""
FORMAT_COMPILER_TARGET="unix"
DIST_DIR="haiku"
;;
osx|*Darwin*)
platform=osx
FORMAT_EXT="dylib"
BINARY_EXT=""
FORMAT_COMPILER_TARGET="osx"
case "$ARCH" in
x86_64|i386|Power*|ppc*)
DIST_DIR="osx-$ARCH"
;;
*)
DIST_DIR="osx-unknown"
;;
esac
;;
msvc2003_x86)
platform=windows_msvc2003_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2003_x86"
DIST_DIR="msvc2003_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2005_x86)
platform=windows_msvc2005_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2005_x86"
DIST_DIR="msvc2005_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2008_x86)
platform=windows_msvc2008_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2008_x86"
DIST_DIR="msvc2008_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2010_x86)
platform=windows_msvc2010_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2010_x86"
DIST_DIR="msvc2010_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2010_x64)
platform=windows_msvc2010_x64
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2010_x64"
DIST_DIR="msvc2010_x64"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2015_x86)
platform=windows_msvc2015_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2015_x86"
DIST_DIR="msvc2015_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2015_x64)
platform=windows_msvc2015_x64
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2015_x64"
DIST_DIR="msvc2015_x64"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2017_desktop_x86)
platform=windows_msvc2017_desktop_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2017_desktop_x86"
DIST_DIR="msvc2017_desktop_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2017_desktop_x64)
platform=windows_msvc2017_desktop_x64
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2017_desktop_x64"
DIST_DIR="msvc2017_desktop_x64"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2017_uwp_x86)
platform=windows_msvc2017_uwp_x86
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2017_uwp_x86"
DIST_DIR="msvc2017_uwp_x86"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2017_uwp_x64)
platform=windows_msvc2017_uwp_x64
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2017_uwp_x64"
DIST_DIR="msvc2017_uwp_x64"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
msvc2017_uwp_arm)
platform=windows_msvc2017_uwp_arm
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="windows_msvc2017_uwp_arm"
DIST_DIR="msvc2017_uwp_arm"
CC="cl.exe"
CXX="cl.exe"
CXX11="cl.exe"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
platform=win
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="win"
DIST_DIR="win_x86"
;;
win64|*mingw64*|*MINGW64*)
platform=win
FORMAT_EXT="dll"
BINARY_EXT=".exe"
FORMAT_COMPILER_TARGET="win"
DIST_DIR="win_x64"
;;
*psp1*)
platform=psp1
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="psp1"
DIST_DIR="psp1"
;;
*ctr*)
platform=ctr
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="ctr"
DIST_DIR="ctr"
;;
*emscripten*)
platform=emscripten
FORMAT_EXT="bc"
FORMAT_COMPILER_TARGET="emscripten"
DIST_DIR="emscripten"
;;
*vita*)
platform=vita
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="vita"
DIST_DIR="vita"
;;
*ps3*)
platform=ps3
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="ps3"
FORMAT_COMPILER_TARGET_ALT="sncps3"
DIST_DIR="ps3"
;;
*wii*)
platform=wii
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="wii"
DIST_DIR="wii"
;;
*ngc*)
platform=ngc
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="ngc"
DIST_DIR="ngc"
;;
android-x86_64)
platform=android-x86_64
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/x86_64"
;;
android-x86)
platform=android-x86
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/x86"
;;
android-armeabi)
platform=android-armeabi
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/armeabi"
;;
android-armeabi_v7a)
platform=android-armeabi_v7a
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/armeabi-v7a"
;;
android-arm64_v8a)
platform=android-arm64_v8a
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/arm64-v8a"
;;
android-mips)
platform=android-mips
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/mips"
;;
android-mips64)
platform=android-mips64
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="${platform}"
DIST_DIR="android/mips64"
;;
theos_ios*)
platform=theos_ios
FORMAT_EXT="dylib"
FORMAT_COMPILER_TARGET="theos_ios"
DIST_DIR="theos_ios"
;;
android)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="android"
DIST_DIR="android"
;;
android-armv7)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="android-armv7"
DIST_DIR="android/armeabi-v7a"
;;
linux-armv7-neon)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="unix-armv7-hardfloat-neon"
DIST_DIR="unix"
;;
*)
BINARY_EXT=""
FORMAT_COMPILER_TARGET="unix"
if [ -n "$STATIC_LINKING" ]; then
FORMAT=_unix
FORMAT_EXT="a"
DIST_DIR="unix-static"
else
FORMAT_EXT="so"
DIST_DIR="unix"
fi
;;
esac
export FORMAT_COMPILER_TARGET_ALT="$FORMAT_COMPILER_TARGET"
}