From 9c7f2364db3971681b98f85b7d63ab75e742efb1 Mon Sep 17 00:00:00 2001 From: Marko Zajc Date: Sat, 12 Aug 2023 22:29:48 +0200 Subject: [PATCH] Update native dependencies --- natives/CMakeLists.txt | 3 +- natives/build.gradle | 87 ++++++++++++------------------- natives/connector/CMakeLists.txt | 10 ++-- natives/fdk-aac/CMakeLists.txt | 8 +-- natives/samplerate/CMakeLists.txt | 4 +- natives/samplerate/config.h | 3 +- natives/vorbis/CMakeLists.txt | 10 ++-- 7 files changed, 55 insertions(+), 70 deletions(-) diff --git a/natives/CMakeLists.txt b/natives/CMakeLists.txt index 031c3fbf..3db031c7 100644 --- a/natives/CMakeLists.txt +++ b/natives/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.12) +project(lpnatives C) add_subdirectory(samplerate) add_subdirectory(fdk-aac) diff --git a/natives/build.gradle b/natives/build.gradle index ee31cf4c..9eb05b41 100644 --- a/natives/build.gradle +++ b/natives/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'de.undercouch.download' + id "de.undercouch.download" version "5.4.0" } import org.apache.tools.ant.taskdefs.condition.Os @@ -8,26 +8,30 @@ import java.util.regex.Pattern apply from: 'natives.gradle' -ext.opusVersion = '1.3' -ext.mpg123Version = '1.25.10' -ext.oggVersion = '1.3.3' -ext.vorbisVersion = '1.3.6' -ext.sampleRateVersion = '0.1.9' -ext.fdkAacVersion = '2.0.0' +ext.opusVersion = '1.4' +ext.mpg123Version = '1.31.3' +ext.oggVersion = '1.3.5' +ext.vorbisVersion = '1.3.7' +ext.sampleRateVersion = '0.2.2' +ext.fdkAacVersion = '2.0.2' task load { doLast { if (!file("$projectDir/samplerate/src").exists()) { - def downloadPath = "$buildDir/tmp/libsamplerate.tar.gz" + def tarPath = "$buildDir/tmp/libsamplerate.tar" + def downloadPath = "${tarPath}.xz" def unpackPath = "$buildDir/tmp" - download.run { - src "https://www.mega-nerd.com/SRC/libsamplerate-${sampleRateVersion}.tar.gz" + src "https://github.com/libsndfile/libsamplerate/releases/download/${sampleRateVersion}/libsamplerate-${sampleRateVersion}.tar.xz" dest downloadPath } + exec { + commandLine('xz', '-d', downloadPath) + } + copy { - from tarTree(resources.gzip(downloadPath)) + from tarTree(file(tarPath)) into unpackPath } @@ -38,53 +42,47 @@ task load { } if (!file("$projectDir/fdk-aac/libAACdec").exists()) { - def downloadPath = "$buildDir/tmp/fdk-aac-v${fdkAacVersion}.zip" - def unpackPath = "$buildDir" - + def downloadPath = "$buildDir/tmp/fdk-aac-v${fdkAacVersion}.tar.gz" + def unpackPath = "$projectDir/fdk-aac" download.run { - src "https://github.com/mstorsjo/fdk-aac/archive/v${fdkAacVersion}.zip" + src "https://github.com/mstorsjo/fdk-aac/archive/v${fdkAacVersion}.tar.gz" dest downloadPath } copy { - from zipTree(file(downloadPath)) + from tarTree(file(downloadPath)) into unpackPath } - - copy { - from "$unpackPath/fdk-aac-${fdkAacVersion}" - into "$projectDir/fdk-aac" - } } if (!file("$projectDir/vorbis/libogg-${oggVersion}").exists()) { - def downloadPath = "$buildDir/tmp/temp.zip" - def unpackPath = "$buildDir" - + def downloadPath = "$buildDir/tmp/libogg.tar.gz" + def unpackPath = "$projectDir/vorbis" download.run { - src "https://downloads.xiph.org/releases/ogg/libogg-${oggVersion}.zip" + src "https://downloads.xiph.org/releases/ogg/libogg-${oggVersion}.tar.gz" dest downloadPath } copy { - from zipTree(file(downloadPath)) - into "$projectDir/vorbis" + from tarTree(file(downloadPath)) + into unpackPath } + downloadPath = "$buildDir/tmp/libvorbis.tar.gz" download.run { - src "https://downloads.xiph.org/releases/vorbis/libvorbis-${vorbisVersion}.zip" + src "https://downloads.xiph.org/releases/vorbis/libvorbis-${vorbisVersion}.tar.gz" dest downloadPath } copy { - from zipTree(file(downloadPath)) - into "$projectDir/vorbis" + from tarTree(file(downloadPath)) + into unpackPath } } if (!file("$projectDir/opus/opus-${opusVersion}").exists()) { - def downloadPath = "$buildDir/tmp/temp.tar.gz" - def unpackPath = "$buildDir" + def downloadPath = "$buildDir/tmp/libopus.tar.gz" + def unpackPath = "$projectDir/opus" download.run { src "https://downloads.xiph.org/releases/opus/opus-${opusVersion}.tar.gz" @@ -93,13 +91,13 @@ task load { copy { from tarTree(file(downloadPath)) - into "$projectDir/opus" + into unpackPath } } if (!Os.isFamily(Os.FAMILY_WINDOWS) && !file("$projectDir/mp3/mpg123-${mpg123Version}").exists()) { - def downloadPath = "$buildDir/tmp/temp.tar.bz2" - def unpackPath = "$buildDir" + def downloadPath = "$buildDir/tmp/libmpg123.tar.bz2" + def unpackPath = "$projectDir/mp3" download.run { src "https://www.mpg123.de/download/mpg123-${mpg123Version}.tar.bz2" @@ -108,7 +106,7 @@ task load { copy { from tarTree(file(downloadPath)) - into "$projectDir/mp3" + into unpackPath } } } @@ -198,27 +196,10 @@ def buildOpusOnLinux(force) { } } -def extractVersionPrefix(fullVersion, partCount) { - def parts = fullVersion.split('\\.').toList() - return parts.subList(0, Math.min(partCount, parts.size())).join('.') -} - -def replaceAutotoolsVersion(directory, originalVersion) { - def localVersion = (['automake', '--version'].execute().text =~ /\(GNU automake\) ([0-9.]+)/)[0][1] - def localMajorVersion = extractVersionPrefix(localVersion, 2) - def originalMajorVersion = extractVersionPrefix(originalVersion, 2) - - [file("$directory/aclocal.m4"), file("$directory/configure")].each { - it.text = it.text.replace("am__api_version='$originalMajorVersion'", "am__api_version='$localMajorVersion'").replace(originalVersion, localVersion) - } -} - def buildMpg123OnLinux(force) { def present = file("${projectDir}/libs/64/libmpg123.a").exists() if (force || !present) { - replaceAutotoolsVersion("$projectDir/mp3/mpg123-${mpg123Version}", '1.15.1') - def flags = "-fPIC -O3 -fdata-sections -ffunction-sections" def process = ['./configure', '--enable-static', '--with-cpu=x86-64', '--with-pic', "CFLAGS=$flags", "CXXFLAGS=$flags"]. execute(null as String[], file("$projectDir/mp3/mpg123-${mpg123Version}")) diff --git a/natives/connector/CMakeLists.txt b/natives/connector/CMakeLists.txt index 55bd66b7..0ef7bd77 100644 --- a/natives/connector/CMakeLists.txt +++ b/natives/connector/CMakeLists.txt @@ -38,11 +38,11 @@ set(CMAKE_CXX_FLAGS_RELEASE "${COMPILER_FLAGS} ${COMPILER_FLAGS_RELEASE}") include_directories("$ENV{JAVA_HOME}/include/") include_directories("${samplerate_SOURCE_DIR}/src") -include_directories("../opus/opus-1.3/include") -include_directories("../fdk-aac/libAACdec/include") -include_directories("../fdk-aac/libSYS/include") -include_directories("../vorbis/libvorbis-1.3.6/include") -include_directories("../vorbis/libogg-1.3.3/include") +include_directories("../opus/opus-1.4/include") +include_directories("../fdk-aac/fdk-aac-2.0.2/libAACdec/include") +include_directories("../fdk-aac/fdk-aac-2.0.2/libSYS/include") +include_directories("../vorbis/libvorbis-1.3.7/include") +include_directories("../vorbis/libogg-1.3.5/include") link_directories("../libs/64") if (DEFINED ENV{DIST_DIR}) diff --git a/natives/fdk-aac/CMakeLists.txt b/natives/fdk-aac/CMakeLists.txt index 2b785d7b..68bd1506 100644 --- a/natives/fdk-aac/CMakeLists.txt +++ b/natives/fdk-aac/CMakeLists.txt @@ -4,12 +4,14 @@ project(fdk-aac CXX) get_filename_component(ROOT_DIR "." ABSOLUTE) -set(MAIN_DIRS "${ROOT_DIR}/libAACdec" "${ROOT_DIR}/libFDK" "${ROOT_DIR}/libSYS" "${ROOT_DIR}/libMpegTPDec" "${ROOT_DIR}/libSBRdec" "${ROOT_DIR}/libPCMutils" "${ROOT_DIR}/libArithCoding" "${ROOT_DIR}/libDRCdec" "${ROOT_DIR}/libSACdec") +set(FDK_SOURCE "${ROOT_DIR}/fdk-aac-2.0.2") + +set(FDK_DIRS "${FDK_SOURCE}/libAACdec" "${FDK_SOURCE}/libFDK" "${FDK_SOURCE}/libSYS" "${FDK_SOURCE}/libMpegTPDec" "${FDK_SOURCE}/libSBRdec" "${FDK_SOURCE}/libPCMutils" "${FDK_SOURCE}/libArithCoding" "${FDK_SOURCE}/libDRCdec" "${FDK_SOURCE}/libSACdec") set(MAIN_SOURCES "") -message(STATUS "${MAIN_DIRS}") +message(STATUS "${FDK_DIRS}") -foreach(subdir ${MAIN_DIRS}) +foreach(subdir ${FDK_DIRS}) file (GLOB dir_sources "${subdir}/src/*.cpp" "${subdir}/src/*.h" "${subdir}/include/*.h") set (MAIN_SOURCES ${MAIN_SOURCES} ${dir_sources}) diff --git a/natives/samplerate/CMakeLists.txt b/natives/samplerate/CMakeLists.txt index 934b5da4..5ab8b102 100644 --- a/natives/samplerate/CMakeLists.txt +++ b/natives/samplerate/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0) project(samplerate C) if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL "MSVC") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fdata-sections -ffunction-sections") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fdata-sections -ffunction-sections -DHAVE_CONFIG_H") else() - set(CMAKE_C_FLAGS_RELEASE "/MT") + set(CMAKE_C_FLAGS_RELEASE "/MT /DHAVE_CONFIG_H") endif() include_directories(.) diff --git a/natives/samplerate/config.h b/natives/samplerate/config.h index 69b772ed..ef2e8c41 100644 --- a/natives/samplerate/config.h +++ b/natives/samplerate/config.h @@ -6,9 +6,10 @@ #define HAVE_LRINT 1 #define HAVE_LRINTF 1 #define HAVE_STDINT_H 1 +#define HAVE_STDBOOL_H 1 #define PACKAGE "libsamplerate" -#define VERSION "0.1.9" +#define VERSION "0.2.2" #ifdef _MSC_VER #define inline __inline diff --git a/natives/vorbis/CMakeLists.txt b/natives/vorbis/CMakeLists.txt index 1e1b4cc5..290733c7 100644 --- a/natives/vorbis/CMakeLists.txt +++ b/natives/vorbis/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.0) project(vorbis C) get_filename_component(ROOT_DIR "." ABSOLUTE) -set(VORBIS_SOURCE "${ROOT_DIR}/libvorbis-1.3.6/lib") -set(OGG_SOURCE "${ROOT_DIR}/libogg-1.3.3/src") +set(VORBIS_SOURCE "${ROOT_DIR}/libvorbis-1.3.7/lib") +set(OGG_SOURCE "${ROOT_DIR}/libogg-1.3.5/src") if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_C_FLAGS_RELEASE "/MT") @@ -17,8 +17,8 @@ file(GLOB MAIN_SOURCES "${VORBIS_SOURCE}/*.c" "${OGG_SOURCE}/*.c") list(REMOVE_ITEM MAIN_SOURCES "${VORBIS_SOURCE}/psytune.c") list(REMOVE_ITEM MAIN_SOURCES "${VORBIS_SOURCE}/tone.c") -include_directories("${ROOT_DIR}/libogg-1.3.3/include") -include_directories("${ROOT_DIR}/libvorbis-1.3.6/include") -include_directories("${ROOT_DIR}/libvorbis-1.3.6/lib") +include_directories("${ROOT_DIR}/libogg-1.3.5/include") +include_directories("${ROOT_DIR}/libvorbis-1.3.7/include") +include_directories("${ROOT_DIR}/libvorbis-1.3.7/lib") add_library(vorbis STATIC ${MAIN_SOURCES})