Skip to content

Commit

Permalink
Build for arm64-osx (#564)
Browse files Browse the repository at this point in the history
* Build for arm64-osx

* More required packages

* Remove unsupported filter for speex and speexdsp

* Fix vcpkg ppc64el

* Make Git available
  • Loading branch information
ibauersachs authored Mar 13, 2023
1 parent 5c9346c commit 8640156
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 1,486 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.c text eol=lf
*.cpp text eol=lf
*.m text eol=lf
vcpkg-ppc64el.patch text eol=crlf
5 changes: 3 additions & 2 deletions .github/workflows/maven-and-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ jobs:
matrix:
arch:
- x86_64
- arm64
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -321,12 +322,12 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "Jitsi GitHub Action"
brew install nasm
brew install nasm autoconf automake libtool
resources/mac-cmake.sh ${{ steps.install_java.outputs.path }} ${{ matrix.arch }}
- name: The job has failed
if: ${{ failure() }}
run: tar --exclude *.o -cvJf target/debug-logs.tar.xz src/native/cmake-build
run: tar --exclude *.o -cvJf target/debug-logs.tar.xz src/native/cmake-build-${{ matrix.arch }}

- name: Upload Debug logs
if: ${{ failure() }}
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Build-Depends:
dpkg-dev (>= 1.16.1),
libtool,
cmake,
git,
default-jdk,
libasound2-dev,
libpulse-dev,
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@
darwin-x86-64/libjnscreencapture.dylib;
darwin-x86-64/libjnspeex.dylib;
darwin-x86-64/libjnvpx.dylib;osname=Mac OS X;processor=x86-64,
darwin-aarch64/libjnawtrenderer.dylib;
darwin-aarch64/libjnmaccoreaudio.dylib;
darwin-aarch64/libjnopus.dylib;
darwin-aarch64/libjnportaudio.dylib;
darwin-aarch64/libjnquicktime.dylib;
darwin-aarch64/libjnscreencapture.dylib;
darwin-aarch64/libjnspeex.dylib;
darwin-aarch64/libjnvpx.dylib;osname=Mac OS X;processor=AArch64,
linux-x86/libjnawtrenderer.so;
linux-x86/libjnopus.so;
linux-x86/libjnportaudio.so;
Expand Down
30 changes: 25 additions & 5 deletions resources/deb-prepare.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
#!/usr/bin/env bash
set -e
set -x
sudo apt-get update -
sudo apt-get update
sudo apt-get install -y distro-info

# dev-tools from backports because https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools/+bug/1916633
DEVTOOLS_PACKAGE=ubuntu-dev-tools
UBUNTUTOOLS_PACKAGE=python3-ubuntutools
if lsb_release -i -s == "Ubuntu"; then
case $(lsb_release -c -s) in
bionic | focal)
DEVTOOLS_PACKAGE=$DEVTOOLS_PACKAGE/$(lsb_release -c -s)-backports
UBUNTUTOOLS_PACKAGE=$UBUNTUTOOLS_PACKAGE/$(lsb_release -c -s)-backports
;;
esac
elif lsb_release -i -s == "Debian"; then
case $(lsb_release -c -s) in
stretch | buster)
>&2 echo "Packaging needs 'ubuntu-dev-tools' >= 1.181, which is only available in Bullseye"
exit 1
;;
esac
fi

sudo apt-get install -y \
debhelper \
aptitude \
sbuild \
schroot \
ubuntu-dev-tools/$(lsb_release -c -s)-backports \
python3-ubuntutools/$(lsb_release -c -s)-backports \
"$DEVTOOLS_PACKAGE" \
"$UBUNTUTOOLS_PACKAGE" \
debian-archive-keyring \
git-buildpackage \
rename \
distro-info
rename
sudo adduser $USER sbuild
4 changes: 2 additions & 2 deletions resources/mac-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ case $ARCH in
;;
esac

cmake -B "${PROJECT_DIR}/src/native/cmake-build" \
cmake -B "${PROJECT_DIR}/src/native/cmake-build-${OSX_ARCH}" \
-S "${PROJECT_DIR}/src/native" \
-DJAVA_HOME="$JAVA_HOME" \
-DCMAKE_INSTALL_PREFIX="${PROJECT_DIR}/src/main/resources/darwin-$INSTALL_PREFIX_ARCH" \
-DCMAKE_OSX_ARCHITECTURES="$OSX_ARCH" \
-DVCPKG_TARGET_TRIPLET="$VCPKG_ARCH-osx"
cmake --build "${PROJECT_DIR}/src/native/cmake-build" --config Release --target install --parallel
cmake --build "${PROJECT_DIR}/src/native/cmake-build-${OSX_ARCH}" --config Release --target install --parallel
4 changes: 2 additions & 2 deletions resources/ubuntu-build-image/build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ case "$ARCH" in
JAVA_ARCH="arm64"
TOOLCHAIN=$LIBROOT/src/native/cmake/toolchains/arm64-linux.cmake
;;
"ppc64el")
"ppc64el"|"ppc64le")
ARCH="ppc64el"
VCPKG_ARCH="ppc64le"
JAVA_ARCH="ppc64el"
TOOLCHAIN=$LIBROOT/src/native/cmake/toolchains/ppc64el-linux.cmake
Expand All @@ -36,7 +37,6 @@ esac
export JAVA_HOME=/usr/lib/jvm/java-$JAVA_VERSION-openjdk-$JAVA_ARCH

cd "$LIBROOT/src/native" || exit 1
cp cmake/vcpkg-triplets/x86-linux.cmake vcpkg/triplets/community
cmake -B cmake-build-$ARCH \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$TOOLCHAIN \
-DVCPKG_VERBOSE=ON \
Expand Down
2 changes: 1 addition & 1 deletion src/native/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake-build-*
cmake-build*
.idea/
.vs/
out/
Expand Down
27 changes: 17 additions & 10 deletions src/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@ foreach(var ${vars})
endif()
endforeach()

if (WIN32 OR APPLE OR NOT USE_SYSTEM_VPX)
if (UNIX AND NOT APPLE)
set(DEFAULT_USE_SYSTEM_SPEEX ON)
set(DEFAULT_USE_SYSTEM_VPX ON)
else ()
set(DEFAULT_USE_SYSTEM_SPEEX OFF)
set(DEFAULT_USE_SYSTEM_VPX OFF)
endif ()

option(USE_SYSTEM_SPEEX "Use system-installed speex" ${DEFAULT_USE_SYSTEM_SPEEX})
option(USE_SYSTEM_VPX "Use system-installed vpx" ${DEFAULT_USE_SYSTEM_VPX})

find_package(Git REQUIRED)
execute_process(
COMMAND "${GIT_EXECUTABLE}" apply --verbose --binary ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg-ppc64el.patch
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg"
)
if (NOT USE_SYSTEM_SPEEX OR NOT USE_SYSTEM_VPX)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
CACHE STRING "Vcpkg toolchain file")
endif ()
Expand Down Expand Up @@ -53,7 +69,6 @@ endif ()
find_package(JNI REQUIRED)

if (WIN32)
find_package(Git REQUIRED)
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --match "v[0-9\\.]*" --long --dirty --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
Expand Down Expand Up @@ -92,13 +107,6 @@ set(LIBJITSI_JAVAH "${CMAKE_CURRENT_SOURCE_DIR}/../../target/native/javah")
include(ExternalProject)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if (UNIX AND NOT APPLE)
set(DEFAULT_USE_SYSTEM_SPEEX ON)
else ()
set(DEFAULT_USE_SYSTEM_SPEEX OFF)
endif ()

option(USE_SYSTEM_SPEEX "Use system-installed speex" ${DEFAULT_USE_SYSTEM_SPEEX})

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand All @@ -110,7 +118,6 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64el" OR CMAKE_SYSTEM_PROCESSOR STREQUAL
endif ()

include(GNUInstallDirs)
add_subdirectory(third_party/speex)

add_subdirectory(jawtrenderer)
add_subdirectory(opus)
Expand Down
6 changes: 0 additions & 6 deletions src/native/cmake/vcpkg-triplets/x86-linux.cmake

This file was deleted.

9 changes: 2 additions & 7 deletions src/native/portaudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,8 @@ add_library(${PROJECT_NAME} SHARED
org_jitsi_impl_neomedia_portaudio_Pa.c
${OS_SOURCES})

if (NOT ${USE_SYSTEM_SPEEX})
add_dependencies(${PROJECT_NAME} ext_lib_speexdsp)
add_dependencies(${PROJECT_NAME} ext_lib_speex)
else ()
find_package(speexdsp REQUIRED)
find_package(speex REQUIRED)
endif ()
find_package(speexdsp REQUIRED)
find_package(speex REQUIRED)

# we cannot use the system default portaudio - it has no hotplug
add_dependencies(${PROJECT_NAME} ext_lib_portaudio)
Expand Down
10 changes: 2 additions & 8 deletions src/native/speex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ project(jnspeex C)

set(OS_SOURCES "")
set(OS_LIBS "")
set(DEFAULT_USE_SYSTEM_SPEEX 0)
if (WIN32)
set(OS_SOURCES speex.rc)
elseif (APPLE)
Expand All @@ -14,13 +13,8 @@ add_library(${PROJECT_NAME} SHARED
org_jitsi_impl_neomedia_codec_audio_speex_Speex.c
${OS_SOURCES})


if (NOT ${USE_SYSTEM_SPEEX})
add_dependencies(${PROJECT_NAME} ext_lib_speex)
else ()
find_package(speexdsp REQUIRED)
find_package(speex REQUIRED)
endif ()
find_package(speexdsp REQUIRED)
find_package(speex REQUIRED)

target_link_libraries(${PROJECT_NAME} LINK_PUBLIC
${JNI_LIBRARIES}
Expand Down
99 changes: 0 additions & 99 deletions src/native/third_party/speex/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 8640156

Please sign in to comment.