• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:arch

3 # Builds protoc executable into target/<OS>/<ARCH>/protoc.exe; optionally builds
4 # protoc plugins into target/<OS>/<ARCH>/protoc-gen-*.exe
6 # Usage: ./build-protoc.sh <OS> <ARCH> <TARGET>
8 # <TARGET> can be "protoc" or "protoc-gen-javalite". Supported <OS> <ARCH>
10 # HOST <OS> <ARCH> <COMMENT>
11 # cygwin windows x86_32 Requires: i686-w64-mingw32-gcc
12 # cygwin windows x86_64 Requires: x86_64-w64-mingw32-gcc
13 # linux linux aarch_64 Requires: g++-aarch64-linux-gnu
16 # linux windows x86_32 Requires: i686-w64-mingw32-gcc
17 # linux windows x86_64 Requires: x86_64-w64-mingw32-gcc
27 ARCH=$2
36 protoc-gen-javalite)
67 if [ -z "$lineno" ]; then
80 # Usage: checkArch <path-to-protoc>
86 format="$(objdump -f "$1" | grep -o "file format .*$" | grep -o "[^ ]*$")"
89 host_machine="$(uname -m)";
90 if [[ "$ARCH" == x86_32 ]]; then
91 assertEq $format "elf32-i386" $LINENO
92 elif [[ "$ARCH" == x86_64 ]]; then
93 assertEq $format "elf64-x86-64" $LINENO
94 elif [[ "$ARCH" == aarch_64 ]]; then
95 assertEq $format "elf64-little" $LINENO
96 elif [[ "$ARCH" == ppcle_64 ]]; then
98 assertEq $format "elf64-powerpcle" $LINENO
100 assertEq $format "elf64-little" $LINENO
103 fail "Unsupported arch: $ARCH"
107 if [[ "$ARCH" == x86_32 ]]; then
108 assertEq $format "pei-i386" $LINENO
109 elif [[ "$ARCH" == x86_64 ]]; then
110 assertEq $format "pei-x86-64" $LINENO
112 fail "Unsupported arch: $ARCH"
116 format="$(file -b "$1" | grep -o "[^ ]*$")"
118 if [[ "$ARCH" == x86_32 ]]; then
120 elif [[ "$ARCH" == x86_64 ]]; then
123 fail "Unsupported arch: $ARCH"
133 # Usage: checkDependencies <path-to-protoc>
137 dump_cmd='objdump -x '"$1"' | fgrep "DLL Name"'
140 host_machine="$(uname -m)";
142 if [[ "$ARCH" == x86_32 ]]; then
143 white_list="linux-gate\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux\.so\.2"
144 elif [[ "$ARCH" == x86_64 ]]; then
145 …white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-x86-64\.so\.2"
146 elif [[ "$ARCH" == ppcle_64 ]]; then
148 dump_cmd='objdump -p '"$1"' | grep NEEDED'
150 …white_list="linux-vdso64\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|libz\.so\.1\|ld64\.s…
151 elif [[ "$ARCH" == aarch_64 ]]; then
152 dump_cmd='objdump -p '"$1"' | grep NEEDED'
153 white_list="libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-aarch64\.so\.1"
156 dump_cmd='otool -L '"$1"' | fgrep dylib'
159 if [[ -z "$white_list" || -z "$dump_cmd" ]]; then
160 fail "Unsupported platform $OS-$ARCH."
163 eval $dump_cmd | grep -i "$white_list" || fail "doesn't show any expected dependencies"
165 eval $dump_cmd | grep -i -v "$white_list"
177 echo "Building protoc, OS=$OS ARCH=$ARCH TARGET=$MAKE_TARGET"
179 CONFIGURE_ARGS="--disable-shared"
185 # Override the default value set in configure.ac that has '-g' which produces
187 CXXFLAGS="-DNDEBUG"
194 if [[ "$ARCH" == x86_64 ]]; then
195 CONFIGURE_ARGS="$CONFIGURE_ARGS --host=x86_64-w64-mingw32"
196 elif [[ "$ARCH" == x86_32 ]]; then
197 CONFIGURE_ARGS="$CONFIGURE_ARGS --host=i686-pc-mingw32"
199 fail "Unsupported arch by CYGWIN: $ARCH"
203 assertEq "$ARCH" x86_32 $LINENO
206 assertEq "$ARCH" x86_64 $LINENO
209 if [[ "$ARCH" == x86_64 ]]; then
210 CXXFLAGS="$CXXFLAGS -m64"
211 elif [[ "$ARCH" == x86_32 ]]; then
212 CXXFLAGS="$CXXFLAGS -m32"
213 elif [[ "$ARCH" == aarch_64 ]]; then
214 CONFIGURE_ARGS="$CONFIGURE_ARGS --host=aarch64-linux-gnu"
215 elif [[ "$ARCH" == ppcle_64 ]]; then
216 CXXFLAGS="$CXXFLAGS -m64"
217 CONFIGURE_ARGS="$CONFIGURE_ARGS --host=powerpc64le-linux-gnu"
219 fail "Unsupported arch: $ARCH"
222 # Cross-compilation for Windows
224 if [[ "$ARCH" == x86_64 ]]; then
225 CONFIGURE_ARGS="$CONFIGURE_ARGS --host=x86_64-w64-mingw32"
226 elif [[ "$ARCH" == x86_32 ]]; then
227 CONFIGURE_ARGS="$CONFIGURE_ARGS --host=i686-w64-mingw32"
229 fail "Unsupported arch: $ARCH"
237 CXXFLAGS="$CXXFLAGS -mmacosx-version-min=10.7"
238 if [[ "$ARCH" == x86_64 ]]; then
239 CXXFLAGS="$CXXFLAGS -m64"
240 elif [[ "$ARCH" == x86_32 ]]; then
241 CXXFLAGS="$CXXFLAGS -m32"
243 fail "Unsupported arch: $ARCH"
250 # -s to produce stripped binary.
253 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -s"
256 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++ -s"
265 BUILD_DIR="build/$OS/$ARCH"
266 TARGET_FILE="target/$OS/$ARCH/$MAKE_TARGET.exe"
268 mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" &&
270 cd src && make $MAKE_TARGET -j8 &&
271 cd "$WORKING_DIR" && mkdir -p $(dirname $TARGET_FILE) &&
276 # Since Mac linker doesn't accept "-s", we need to run strip