-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some modules support LoongArch64 #1401
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 913a303..ef5fba9 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -9,7 +9,7 @@ | ||
# PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license. | ||
# | ||
|
||
-cmake_minimum_required(VERSION 3.16) | ||
+cmake_minimum_required(VERSION 3.13.4) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use a sed command for small changes like this: |
||
|
||
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") | ||
message(WARNING "Building in-source is highly not recommended\n" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,8 +110,16 @@ cd .. | |
|
||
export PATH=$INSTALL_PATH/bin:$PATH | ||
export PKG_CONFIG_PATH=$INSTALL_PATH/lib/pkgconfig/ | ||
|
||
PATCH_ARCH=$(uname -m) | ||
patch -Np1 -d $LAME < ../../lame.patch | ||
if [ "$PATCH_ARCH" == "loongarch64" ]; then | ||
patch -Np1 -d $LAME < ../../lame-add-loongarch-cpuinfo.patch | ||
patch -Np1 -d $XML2 < ../../libxml2-add-loongarch-cpuinfo.patch | ||
patch -Np1 -d $OPUS < ../../opus-add-loongarch-cpuinfo.patch | ||
patch -Np1 -d $VO_AMRWBENC < ../../vo-amrwbenc-add-loongarch-cpuinfo.patch | ||
patch -Np1 -d $X264 < ../../x264-stable-add-loongarch-cpuinfo.patch | ||
patch -Np1 -d SVT-AV1-v$SVTAV1_VERSION < ../../change-cmake-version.patch | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we put all this under the |
||
patch -Np1 -d $OPENSSL < ../../openssl-android.patch | ||
patch -Np1 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg.patch | ||
patch -Np1 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg-flv-support-hevc-opus.patch | ||
|
@@ -976,6 +984,145 @@ EOF | |
make install | ||
;; | ||
|
||
linux-loongarch64) | ||
echo "" | ||
echo "--------------------" | ||
echo "Building zlib" | ||
echo "--------------------" | ||
echo "" | ||
cd $ZLIB | ||
CC="gcc -mabi=lp64 -fPIC" ./configure --prefix=$INSTALL_PATH --static | ||
make -j $MAKEJ V=0 | ||
make install | ||
echo "" | ||
echo "--------------------" | ||
echo "Building LAME" | ||
echo "--------------------" | ||
echo "" | ||
cd ../$LAME | ||
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" | ||
make -j $MAKEJ V=0 | ||
make install | ||
echo "" | ||
echo "--------------------" | ||
echo "Building XML2" | ||
echo "--------------------" | ||
echo "" | ||
cd ../$XML2 | ||
./configure --prefix=$INSTALL_PATH $LIBXML_CONFIG --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" | ||
make -j $MAKEJ V=0 | ||
make install | ||
echo "" | ||
echo "--------------------" | ||
echo "Building speex" | ||
echo "--------------------" | ||
echo "" | ||
cd ../$SPEEX | ||
PKG_CONFIG= ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../$OPUS | ||
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../$OPENCORE_AMR | ||
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" CXXFLAGS="-mabi=lp64" | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../$VO_AMRWBENC | ||
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" CXXFLAGS="-mabi=lp64" | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../$OPENSSL | ||
./Configure linux64-loongarch64 -fPIC no-shared --prefix=$INSTALL_PATH --libdir=lib | ||
make -s -j $MAKEJ | ||
make install_sw | ||
cd ../srt-$LIBSRT_VERSION | ||
CC="gcc -mabi=lp64" CXX="g++ -mabi=lp64" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $SRT_CONFIG . | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../openh264-$OPENH264_VERSION | ||
make -j $MAKEJ DESTDIR=./ PREFIX=.. AR=ar ARCH=loongarch64 USE_ASM=No install-static | ||
cd ../$X264 | ||
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-opencl --host=loongarch64-linux-gnu | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../x265-$X265/build/linux | ||
# from x265 multilib.sh | ||
mkdir -p 8bit 10bit 12bit | ||
|
||
cd 12bit | ||
$CMAKE ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DNASM_EXECUTABLE:FILEPATH=$INSTALL_PATH/bin/nasm | ||
make -j $MAKEJ | ||
|
||
cd ../10bit | ||
$CMAKE ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DNASM_EXECUTABLE:FILEPATH=$INSTALL_PATH/bin/nasm | ||
make -j $MAKEJ | ||
|
||
cd ../8bit | ||
ln -sf ../10bit/libx265.a libx265_main10.a | ||
ln -sf ../12bit/libx265.a libx265_main12.a | ||
$CMAKE ../../../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DENABLE_SHARED:BOOL=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DNASM_EXECUTABLE:FILEPATH=$INSTALL_PATH/bin/nasm -DENABLE_CLI=OFF | ||
make -j $MAKEJ | ||
|
||
# rename the 8bit library, then combine all three into libx265.a | ||
mv libx265.a libx265_main.a | ||
ar -M <<EOF | ||
CREATE libx265.a | ||
ADDLIB libx265_main.a | ||
ADDLIB libx265_main10.a | ||
ADDLIB libx265_main12.a | ||
SAVE | ||
END | ||
EOF | ||
make install | ||
# ---- | ||
cd ../../../ | ||
cd ../libvpx-$VPX_VERSION | ||
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-examples --disable-unit-tests --target=loongarch64-linux-gcc --as=nasm | ||
make -j $MAKEJ | ||
make install | ||
cd ../libwebp-$WEBP_VERSION | ||
CC="gcc -mabi=lp64 -fPIC" CXX="g++ -mabi=lp64 -fPIC" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $WEBP_CONFIG . | ||
make -j $MAKEJ V=0 | ||
make install | ||
cd ../freetype-$FREETYPE_VERSION | ||
./configure --prefix=$INSTALL_PATH --with-bzip2=no --with-harfbuzz=no --with-png=no --with-brotli=no --enable-static --disable-shared --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" | ||
make -j $MAKEJ | ||
make install | ||
LIBS= | ||
if [[ ! -z $(ldconfig -p | grep libva-drm) ]]; then | ||
cd ../mfx_dispatch-$MFX_VERSION | ||
autoreconf -fiv | ||
PKG_CONFIG_PATH="../lib/pkgconfig" ./configure --prefix=$INSTALL_PATH --disable-shared --enable-static --enable-fast-install --with-pic --host=loongarch64-linux-gnu CFLAGS="-mabi=lp64" CXXFLAGS="-mabi=lp64" | ||
make -j $MAKEJ | ||
make install | ||
ENABLE="$ENABLE --enable-libmfx" | ||
LIBS="-lva-drm -lva-x11 -lva" | ||
fi | ||
cd ../nv-codec-headers-n$NVCODEC_VERSION | ||
make install PREFIX=$INSTALL_PATH | ||
cd ../libaom-$AOMAV1_VERSION | ||
mkdir -p build_release | ||
cd build_release | ||
CC="gcc -mabi=lp64" CXX="g++ -mabi=lp64" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBAOM_CONFIG .. | ||
make -j $MAKEJ | ||
make install | ||
cd .. | ||
pwd | ||
cd ../SVT-AV1-v$SVTAV1_VERSION | ||
mkdir -p build_release | ||
cd build_release | ||
CC="gcc -mabi=lp64" CXX="g++ -mabi=lp64" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. | ||
make -j $MAKEJ | ||
make install | ||
cd .. | ||
cd ../ffmpeg-$FFMPEG_VERSION | ||
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-pthreads --enable-libxcb --cc="gcc -mabi=lp64" --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-lstdc++ -lpthread -ldl -lz -lm $LIBS" || cat ffbuild/config.log | ||
make -j $MAKEJ | ||
make install | ||
;; | ||
|
||
linux-armhf) | ||
tar --totals -xjf ../alsa-lib-$ALSA_VERSION.tar.bz2 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/config.guess b/config.guess | ||
index 0bb53ae..c602849 100755 | ||
--- a/config.guess | ||
+++ b/config.guess | ||
@@ -896,6 +896,9 @@ EOF | ||
aarch64:Linux:*:*) | ||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | ||
exit ;; | ||
+ loongarch64:Linux:*:*) | ||
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | ||
+ exit ;; | ||
aarch64_be:Linux:*:*) | ||
UNAME_MACHINE=aarch64_be | ||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | ||
diff --git a/config.sub b/config.sub | ||
index 3580aaf..f469203 100755 | ||
--- a/config.sub | ||
+++ b/config.sub | ||
@@ -249,6 +249,7 @@ case $basic_machine in | ||
1750a | 580 \ | ||
| a29k \ | ||
| aarch64 | aarch64_be \ | ||
+ | loongarch64 \ | ||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | ||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | ||
| am33_2.0 \ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/config.guess b/config.guess | ||
index b33c9e8..9f6c9ec 100755 | ||
--- a/config.guess | ||
+++ b/config.guess | ||
@@ -909,6 +909,9 @@ EOF | ||
aarch64:Linux:*:*) | ||
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" | ||
exit ;; | ||
+ loongarch64:Linux:*:*) | ||
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" | ||
+ exit ;; | ||
aarch64_be:Linux:*:*) | ||
UNAME_MACHINE=aarch64_be | ||
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" | ||
diff --git a/config.sub b/config.sub | ||
index b51fb8c..b19b219 100755 | ||
--- a/config.sub | ||
+++ b/config.sub | ||
@@ -1156,6 +1156,7 @@ case $cpu-$vendor in | ||
1750a | 580 \ | ||
| a29k \ | ||
| aarch64 | aarch64_be \ | ||
+ | loongarch64 \ | ||
| abacus \ | ||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ | ||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/config.guess b/config.guess | ||
index a744844..1217273 100755 | ||
--- a/config.guess | ||
+++ b/config.guess | ||
@@ -919,6 +919,9 @@ EOF | ||
UNAME_MACHINE=aarch64_be | ||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | ||
exit ;; | ||
+ loongarch64:Linux:*:*) | ||
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | ||
+ exit ;; | ||
alpha:Linux:*:*) | ||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in | ||
EV5) UNAME_MACHINE=alphaev5 ;; | ||
diff --git a/config.sub b/config.sub | ||
index 932128b..51adf62 100755 | ||
--- a/config.sub | ||
+++ b/config.sub | ||
@@ -248,6 +248,7 @@ case $basic_machine in | ||
1750a | 580 \ | ||
| a29k \ | ||
| aarch64 | aarch64_be \ | ||
+ | loongarch64 \ | ||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | ||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | ||
| am33_2.0 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put linux-loongarch64 after linux-arm64 for consistency, everywhere, here and in all the other files.