2
2
3
3
#
4
4
# Generate the static-stdlib-args.lnk used by the -static-stdlib option for
5
- # 'GenericUnix' (eg linux) plaforms. If libicu is built locally then include
6
- # libicudata
5
+ # 'GenericUnix' (eg linux) plaforms. Tries to find static .a files for libs
6
+ # not normally installed by default (currently libicu)
7
+ # If libicu is built locally then include libicudata
7
8
#
8
9
9
10
# SDK=$1
10
11
OUTPUTFILE=$2
11
12
ICU_STATIC_LIB=$3
13
+ # libdirs from pkg-config
14
+ ICU_UC_LIBDIR=$4
15
+ ICU_I18N_LIBDIR=$5
12
16
13
17
14
- if [ " ${ICU_STATIC_LIB} " == " TRUE" ]; then
15
- read -r -d ' ' ICU_LIBS << EOF
18
+ # Try and find the libicu .a library files to directly link in using the
19
+ # fullpath to the files otherwise fullback to the default
20
+ function find_static_iculibs {
21
+ if [ -n " ${ICU_I18N_LIBDIR} " ]; then
22
+ LIBICU_I18N_A=${ICU_I18N_LIBDIR} /libicui18n.a
23
+ fi
24
+
25
+ if [ -n " ${ICU_UC_LIBDIR} " ]; then
26
+ LIBICU_UC_A=${ICU_UC_LIBDIR} /libicuuc.a
27
+ LIBICU_DATA_A=${ICU_UC_LIBDIR} /libicudata.a
28
+ fi
29
+
30
+ if [ -f " ${LIBICU_I18N_A} " ] && [ -f " ${LIBICU_UC_A} " ] &&
31
+ [ -f " ${LIBICU_DATA_A} " ]; then
32
+ read -d ' ' ICU_LIBS << EOF
33
+ $LIBICU_I18N_A
34
+ $LIBICU_UC_A
35
+ $LIBICU_DATA_A
36
+ EOF
37
+ else
38
+ read -d ' ' ICU_LIBS << EOF
16
39
-licui18n
17
40
-licuuc
18
- -licudata
19
41
EOF
20
- else
21
- read -r -d ' ' ICU_LIBS << EOF
42
+ fi
43
+ }
44
+
45
+
46
+ # If libicu was compiled as part of the swift build then link the libs as normal
47
+ function use_local_iculibs {
48
+ read -d ' ' ICU_LIBS << EOF
22
49
-licui18n
23
50
-licuuc
51
+ -licudata
24
52
EOF
25
- fi
26
-
53
+ }
27
54
28
- if [ -z " ${OUTPUTFILE} " ]; then
29
- echo $0 : No outputfile specified
30
- exit 1
31
- fi
32
55
56
+ function write_linkfile {
57
+ if [ -z " ${OUTPUTFILE} " ]; then
58
+ echo $0 : No outputfile specified
59
+ exit 1
60
+ fi
33
61
cat > $OUTPUTFILE << EOF
34
62
-ldl
35
63
-lpthread
@@ -43,3 +71,12 @@ $ICU_LIBS
43
71
-Xlinker
44
72
ALL
45
73
EOF
74
+ }
75
+
76
+
77
+ if [ " ${ICU_STATIC_LIB} " == " TRUE" ]; then
78
+ use_local_iculibs
79
+ else
80
+ find_static_iculibs
81
+ fi
82
+ write_linkfile
0 commit comments