File tree Expand file tree Collapse file tree 3 files changed +52
-4
lines changed Expand file tree Collapse file tree 3 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ case "${platform}" in
27
27
/usr/bin/find . ' (' ' !' -path ' ./icutools/deps/icu-small/source/stubdata/stubdata.o' ' )' -path " ./torque_*/**/*.o" -or -path " ./v8*/**/*.o" -or -path " ./icu*/**/*.o" | sort | uniq | xargs /usr/bin/ar -cq " ${LIBV8_MONOLITH} "
28
28
;;
29
29
" Linux" )
30
- find . ' (' ' !' -path ' ./icutools/deps/icu-small/source/stubdata/stubdata.o' ' )' -and ' (' -path " ./torque_*/**/*.o" -or -path " ./v8*/**/*.o" -or -path " ./icu*/**/*.o" ' )' | sort | uniq | xargs ar -cqS " ${LIBV8_MONOLITH} "
31
- ranlib " ${LIBV8_MONOLITH} "
30
+ find . ' (' ' !' -path ' ./icutools/deps/icu-small/source/stubdata/stubdata.o' ' )' -and ' (' -path " ./torque_*/**/*.o" -or -path " ./v8*/**/*.o" -or -path " ./icu*/**/*.o" ' )' | sort | uniq | xargs ar -cqSP " ${LIBV8_MONOLITH} "
31
+ ar -sP " ${LIBV8_MONOLITH} "
32
32
;;
33
33
* )
34
34
echo " Unsupported platform: ${platform} "
Original file line number Diff line number Diff line change @@ -39,8 +39,35 @@ for lib in libv8_monolith.a; do
39
39
mkdir -p " ${dir} "
40
40
rm -f " ${dir} /${lib} "
41
41
42
- echo " ${BASEDIR} /out/${BUILDTYPE} /${lib} -> ${dir} /${lib} "
43
- " ${STRIP} " -S -x -o " ${dir} /${lib} " " ${lib} "
42
+ if [ " $STRIP_NEEDS_EXTRACT " = " y" ]; then
43
+ # manual extract/strip objects/build archive sequence
44
+ # because `strip` can't deal with these
45
+ # (presumably due to that folder issue mentioned below)
46
+ (
47
+ tmpdir=" $( mktemp -d) "
48
+ trap ' rm -r "$tmpdir"' EXIT
49
+ mkdir " $tmpdir /stage"
50
+ cd " $tmpdir /stage"
51
+
52
+ # create folders named in `ar` archive (`ar -x` fails to create these)
53
+ " $AR " " $ARLISTFLAGS " " $BASEDIR /out/$BUILDTYPE /$lib " | while read -r path; do
54
+ dirname " $path "
55
+ done | uniq | xargs mkdir -p
56
+ " $AR " " $AREXTRACTFLAGS " " $BASEDIR /out/${BUILDTYPE} /$lib "
57
+
58
+ # strip all objects
59
+ " $FIND " -type f -exec " $STRIP " -Sx {} +
60
+
61
+ # rebuild the archive
62
+ " $FIND " -type f -exec " $AR " " $ARCOLLECTFLAGS " " ../$lib " {} +
63
+ $ARBUILDSYMBOLS " ../$lib "
64
+ mv " ../$lib " " $dir /$lib "
65
+ )
66
+ echo " ${BASEDIR} /out/${BUILDTYPE} /${lib} -> ${dir} /${lib} "
67
+ else
68
+ echo " ${BASEDIR} /out/${BUILDTYPE} /${lib} -> ${dir} /${lib} "
69
+ " ${STRIP} " -S -x -o " ${dir} /${lib} " " ${lib} "
70
+ fi
44
71
done
45
72
46
73
mkdir -p " ${top} /ext/libv8-node"
Original file line number Diff line number Diff line change @@ -15,6 +15,14 @@ elif command -v cc >/dev/null 2>&1; then
15
15
fi
16
16
17
17
STRIP=" ${STRIP:- strip} "
18
+ AR=" ${AR:- ar} "
19
+ AREXTRACTFLAGS=" ${AREXTRACTFLAGS:- -x} "
20
+ ARLISTFLAGS=" ${ARLISTFLAGS:- -t} "
21
+ ARCOLLECTFLAGS=" ${ARCOLLECTFLAGS:- cqS} "
22
+ # this is the command to build the symbol table in an ar archive.
23
+ ARBUILDSYMBOLS=" ${ARBUILDSYMBOLS:- ranlib} "
24
+ FIND=" ${FIND:- find} "
25
+ STRIP_NEEDS_EXTRACT=" ${STRIP_NEEDS_EXTRACT:- n} "
18
26
19
27
triple=$( ${CC} -dumpmachine)
20
28
host_platform=" ${triple} "
@@ -63,6 +71,11 @@ case "${host_platform}" in
63
71
CXX=" ${CXX:-/ opt/ local/ gcc7/ bin/ g++} "
64
72
STRIP=" gstrip"
65
73
;;
74
+ * linux* )
75
+ STRIP_NEEDS_EXTRACT=" y"
76
+ ARCOLLECTFLAGS=" -cqSP"
77
+ ARBUILDSYMBOLS=" ${AR} -sP"
78
+ ;;
66
79
esac
67
80
68
81
if [ " ${host_platform} " != " ${target_platform} " ]; then
@@ -146,6 +159,14 @@ export CC='${CC}'
146
159
export CXX='${CXX} '
147
160
host_platform='${host_platform} '
148
161
target_platform='${target_platform} '
162
+ STRIP='$STRIP '
163
+ AR='$AR '
164
+ AREXTRACTFLAGS='$AREXTRACTFLAGS '
165
+ ARLISTFLAGS='$ARLISTFLAGS '
166
+ ARCOLLECTFLAGS='$ARCOLLECTFLAGS '
167
+ ARBUILDSYMBOLS='$ARBUILDSYMBOLS '
168
+ FIND='$FIND '
169
+ STRIP_NEEDS_EXTRACT='$STRIP_NEEDS_EXTRACT '
149
170
EOF
150
171
151
172
if [ -n " ${CC_host:- } " ]; then cat << EOF ; fi
You can’t perform that action at this time.
0 commit comments