Skip to content

Commit 151ba5f

Browse files
committed
fix: ffmpeg android build:
- fix asm issue + add libx264
1 parent 1b1440b commit 151ba5f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

platforms/build-android.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
147147

148148
find "$HOST_ROOT/sysroot/usr/lib/$ARM_NAME_TRIPLE/$SDK_VERSION/" -maxdepth 1 -name "*.o" -exec ln -s "{}" "${SYS_ROOT:?}/usr/lib/" \;
149149

150+
# TODO: remove this temporary fix:
151+
# see: https://github.com/android/ndk/issues/2107
152+
if [ "$ARCH_VERSION" = "armv7a" ]; then
153+
sed -i -e 's/asm(/__asm__(/g' "$HOST_ROOT/sysroot/usr/include/arm-linux-androideabi/asm/swab.h"
154+
elif [ "$ARCH_VERSION" = "i686" ]; then
155+
sed -i -e 's/asm(/__asm__(/g' "$HOST_ROOT/sysroot/usr/include/i686-linux-android/asm/swab.h"
156+
elif [ "$ARCH_VERSION" = "x86_64" ]; then
157+
sed -i -e 's/asm(/__asm__(/g' "$HOST_ROOT/sysroot/usr/include/x86_64-linux-android/asm/swab.h"
158+
fi
159+
150160
cd "$LAST_DIR"
151161

152162
fi
@@ -271,7 +281,6 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
271281
-DBUILD_SHARED_LIBS=OFF \
272282
-DINSTALL_PKGCONFIG_MODULES=ON
273283

274-
275284
cmake --build .
276285

277286
cmake --install .
@@ -375,7 +384,7 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
375384

376385
fi
377386

378-
./ffmpeg-android-maker.sh "--target-abis=$ARCH" "--android-api-level=$SDK_VERSION"
387+
./ffmpeg-android-maker.sh "--target-abis=$ARCH" "--android-api-level=$SDK_VERSION" --enable-libx264
379388

380389
FFMPEG_MAKER_OUTPUT_DIR="output"
381390

0 commit comments

Comments
 (0)