diff --git a/.restyled.yaml b/.restyled.yaml index c20239aff..fd5674ee1 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -1,3 +1,5 @@ --- exclude: - "gradlew" + - "**/*.cpp" + - "**/*.h" diff --git a/docker/jvm.Dockerfile b/docker/jvm.Dockerfile index ba388e29c..f8ee7a066 100644 --- a/docker/jvm.Dockerfile +++ b/docker/jvm.Dockerfile @@ -17,9 +17,35 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* WORKDIR /work/jvm-toxcore-c +# Rarely changing external dependencies. COPY scripts/ /work/jvm-toxcore-c/scripts/ RUN scripts/build-host "$PWD/_install/host/protobuf.stamp" "-j$(nproc)" RUN scripts/build-host "$PWD/_install/host/toxcore.stamp" "-j$(nproc)" + +# Native code, changes less frequently. COPY lib/src/main/cpp/ /work/jvm-toxcore-c/lib/src/main/cpp/ COPY lib/src/main/proto/ /work/jvm-toxcore-c/lib/src/main/proto/ -RUN scripts/build-host "$PWD/_install/host/tox4j.stamp" "-j$(nproc)" +RUN touch "$PWD/_install/host/.stamp" \ + && touch "$PWD/_install/host/libsodium.stamp" \ + && touch "$PWD/_install/host/libvpx.stamp" \ + && touch "$PWD/_install/host/opus.stamp" \ + && touch "$PWD/_install/host/protobuf.stamp" \ + && touch "$PWD/_install/host/toxcore.stamp" \ + && scripts/build-host "$PWD/_install/host/tox4j.stamp" "-j$(nproc)" +RUN ["ls", "-lh", "/work/jvm-toxcore-c/_install/host/lib/libtox4j-c.so"] + +# Java/Kotlin code changes a lot. +COPY gradlew gradle.properties settings.gradle.kts /work/jvm-toxcore-c/ +COPY gradle /work/jvm-toxcore-c/gradle/ +COPY lib/ /work/jvm-toxcore-c/lib/ +ENV LD_LIBRARY_PATH=/work/jvm-toxcore-c/_install/host/lib +ENV PATH=/work/jvm-toxcore-c/_install/host/bin:$PATH +RUN ./gradlew build + +RUN javac -h . -cp /work/jvm-toxcore-c/lib/build/classes/kotlin/main:/work/jvm-toxcore-c/lib/build/classes/java/main \ + lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvJni.java \ + lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreJni.java \ + lib/src/main/java/im/tox/tox4j/impl/jni/ToxCryptoJni.java +RUN diff -u lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h im_tox_tox4j_impl_jni_ToxCoreJni.h \ + && diff -u lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h im_tox_tox4j_impl_jni_ToxAvJni.h \ + && diff -u lib/src/main/cpp/ToxCrypto/generated/im_tox_tox4j_impl_jni_ToxCryptoJni.h im_tox_tox4j_impl_jni_ToxCryptoJni.h diff --git a/lib/src/main/cpp/CMakeLists.txt b/lib/src/main/cpp/CMakeLists.txt index 7af7ec491..493a05b66 100644 --- a/lib/src/main/cpp/CMakeLists.txt +++ b/lib/src/main/cpp/CMakeLists.txt @@ -1,5 +1,5 @@ project(tox4j-c) -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.16) if(NOT DEFINED CMAKE_MACOSX_RPATH) set(CMAKE_MACOSX_RPATH true) @@ -11,42 +11,9 @@ endif() find_package(PkgConfig REQUIRED) -pkg_search_module(LIBTOXCORE libtoxcore) -if(LIBTOXCORE_FOUND) - pkg_search_module(LIBTOXAV REQUIRED libtoxav) - link_directories(${LIBTOXCORE_LIBRARY_DIRS}) - include_directories(${LIBTOXCORE_INCLUDE_DIRS}) - foreach(flag ${LIBTOXCORE_CFLAGS_OTHER}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") - endforeach() - - link_directories(${LIBTOXAV_LIBRARY_DIRS}) - include_directories(${LIBTOXAV_INCLUDE_DIRS}) - foreach(flag ${LIBTOXAV_CFLAGS_OTHER}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") - endforeach() -else() - pkg_search_module(TOXCORE REQUIRED toxcore) - link_directories(${TOXCORE_LIBRARY_DIRS}) - include_directories(${TOXCORE_INCLUDE_DIRS}) - foreach(flag ${TOXCORE_CFLAGS_OTHER}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") - endforeach() -endif() - -find_package(Protobuf REQUIRED) -include_directories(${PROTOBUF_INCLUDE_DIRS}) - +pkg_search_module(TOXCORE REQUIRED toxcore) +find_package(protobuf CONFIG REQUIRED) find_package(JNI) -if(JAVA_INCLUDE_PATH) - include_directories(${JAVA_INCLUDE_PATH}) -endif() -if(JAVA_INCLUDE_PATH2) - include_directories(${JAVA_INCLUDE_PATH2}) -endif() - -include_directories(${CMAKE_SOURCE_DIR}) -include_directories(${CMAKE_BINARY_DIR}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") @@ -96,14 +63,12 @@ endif() # Build # -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ToxAv/Av.proto - ToxCore/Core.proto util/ProtoLog.proto) - add_library( ${PROJECT_NAME} SHARED ${ANDROID_CPU_FEATURES} - ${PROTO_SRCS} - ${PROTO_HDRS} + ToxAv/Av.proto + ToxCore/Core.proto + util/ProtoLog.proto ToxAv/generated/enums.cpp ToxAv/generated/errors.cpp ToxAv/generated/impls.h @@ -175,15 +140,28 @@ if(ANDROID_CPU_FEATURES) target_compile_definitions(${PROJECT_NAME} PRIVATE -Dtypeof=__typeof__) endif() -target_link_libraries(${PROJECT_NAME} ${PROTOBUF_LIBRARIES}) +target_include_directories(${PROJECT_NAME} PUBLIC ${PROTOBUF_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf-lite) -if(LIBTOXCORE_FOUND) - target_link_libraries(${PROJECT_NAME} ${LIBTOXAV_STATIC_LIBRARIES} - ${LIBTOXCORE_STATIC_LIBRARIES}) -else() - target_link_libraries(${PROJECT_NAME} ${TOXCORE_STATIC_LIBRARIES}) +if(JAVA_INCLUDE_PATH) + target_include_directories(${PROJECT_NAME} PUBLIC ${JAVA_INCLUDE_PATH}) +endif() +if(JAVA_INCLUDE_PATH2) + target_include_directories(${PROJECT_NAME} PUBLIC ${JAVA_INCLUDE_PATH2}) endif() +target_link_directories(${PROJECT_NAME} PUBLIC ${TOXCORE_LIBRARY_DIRS}) +target_link_libraries(${PROJECT_NAME} ${TOXCORE_STATIC_LIBRARIES}) +target_include_directories(${PROJECT_NAME} PUBLIC ${TOXCORE_INCLUDE_DIRS}) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_BINARY_DIR}) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_BINARY_DIR}/ToxAv) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_BINARY_DIR}/ToxCore) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_BINARY_DIR}/util) + +protobuf_generate(TARGET ${PROJECT_NAME}) + # Windows and OSX don't have this linker functionality. if(NOT WIN32 AND NOT APPLE) set_target_properties( diff --git a/lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h b/lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h index 7324219b1..f61f23f1d 100644 --- a/lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h +++ b/lib/src/main/cpp/ToxAv/generated/im_tox_tox4j_impl_jni_ToxAvJni.h @@ -103,54 +103,6 @@ JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_toxavAudioSendFrame JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_toxavVideoSendFrame (JNIEnv *, jclass, jint, jint, jint, jint, jbyteArray, jbyteArray, jbyteArray); -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeAudioReceiveFrame - * Signature: (II[SII)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeAudioReceiveFrame - (JNIEnv *, jclass, jint, jint, jshortArray, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeAudioBitRate - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeAudioBitRate - (JNIEnv *, jclass, jint, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeVideoBitRate - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeVideoBitRate - (JNIEnv *, jclass, jint, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeCall - * Signature: (IIZZ)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeCall - (JNIEnv *, jclass, jint, jint, jboolean, jboolean); - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeCallState - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeCallState - (JNIEnv *, jclass, jint, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeVideoReceiveFrame - * Signature: (IIII[B[B[BIII)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeVideoReceiveFrame - (JNIEnv *, jclass, jint, jint, jint, jint, jbyteArray, jbyteArray, jbyteArray, jint, jint, jint); - #ifdef __cplusplus } #endif diff --git a/lib/src/main/cpp/ToxAv/lifecycle.cpp b/lib/src/main/cpp/ToxAv/lifecycle.cpp index 859843d21..daba90692 100644 --- a/lib/src/main/cpp/ToxAv/lifecycle.cpp +++ b/lib/src/main/cpp/ToxAv/lifecycle.cpp @@ -186,113 +186,3 @@ TOX_METHOD (void, Finalize, { instances.finalize (env, instanceNumber); } - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeAudioBitRate - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeAudioBitRate - (JNIEnv *env, jclass, jint instanceNumber, jint friendNumber, jint audioBitRate) -{ - return instances.with_instance (env, instanceNumber, - [=] (ToxAV *av, Events &events) - { - assert (av != nullptr); - tox4j_audio_bit_rate_cb (friendNumber, audioBitRate, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeVideoBitRate - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeVideoBitRate - (JNIEnv *env, jclass, jint instanceNumber, jint friendNumber, jint videoBitRate) -{ - return instances.with_instance (env, instanceNumber, - [=] (ToxAV *av, Events &events) - { - assert (av != nullptr); - tox4j_video_bit_rate_cb (friendNumber, videoBitRate, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeAudioReceiveFrame - * Signature: (II[SII)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeAudioReceiveFrame - (JNIEnv *env, jclass, jint instanceNumber, jint friendNumber, jshortArray pcm, jint channels, jint samplingRate) -{ - return instances.with_instance (env, instanceNumber, - [=] (ToxAV *av, Events &events) - { - assert (av != nullptr); - auto pcmData = fromJavaArray (env, pcm); - tox4j_assert (pcmData.size () % channels == 0); - tox4j_audio_receive_frame_cb (friendNumber, pcmData.data (), pcmData.size () / channels, channels, samplingRate, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeCall - * Signature: (IIZZ)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeCall - (JNIEnv *env, jclass, jint instanceNumber, jint friendNumber, jboolean audioEnabled, jboolean videoEnabled) -{ - return instances.with_instance (env, instanceNumber, - [=] (ToxAV *av, Events &events) - { - assert (av != nullptr); - tox4j_call_cb (friendNumber, audioEnabled, videoEnabled, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeCallState - * Signature: (IILjava/util/Collection;)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeCallState - (JNIEnv *env, jclass, jint instanceNumber, jint friendNumber, jint callState) -{ - return instances.with_instance (env, instanceNumber, - [=] (ToxAV *av, Events &events) - { - assert (av != nullptr); - tox4j_call_state_cb (friendNumber, callState, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxAvJni - * Method: invokeVideoReceiveFrame - * Signature: (IIII[B[B[B[BIIII)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxAvJni_invokeVideoReceiveFrame - (JNIEnv *env, jclass, jint instanceNumber, jint friendNumber, jint width, jint height, jbyteArray y, jbyteArray u, jbyteArray v, jint yStride, jint uStride, jint vStride) -{ - return instances.with_instance (env, instanceNumber, - [=] (ToxAV *av, Events &events) - { - assert (av != nullptr); - auto yData = fromJavaArray (env, y); - auto uData = fromJavaArray (env, u); - auto vData = fromJavaArray (env, v); - tox4j_assert (yData.size () == std::max (width , std::abs (yStride)) * height); - tox4j_assert (uData.size () == std::max (width / 2, std::abs (uStride)) * (height / 2)); - tox4j_assert (vData.size () == std::max (width / 2, std::abs (vStride)) * (height / 2)); - tox4j_video_receive_frame_cb (friendNumber, width, height, yData.data (), uData.data (), vData.data (), yStride, uStride, vStride, &events); - } - ); -} diff --git a/lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h b/lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h index b03225f60..c860f8a8c 100644 --- a/lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h +++ b/lib/src/main/cpp/ToxCore/generated/im_tox_tox4j_impl_jni_ToxCoreJni.h @@ -311,126 +311,6 @@ JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_toxFriendSendLossyP JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_toxFriendSendLosslessPacket (JNIEnv *, jclass, jint, jint, jbyteArray); -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeSelfConnectionStatus - * Signature: (II)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeSelfConnectionStatus - (JNIEnv *, jclass, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileRecvControl - * Signature: (IIII)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileRecvControl - (JNIEnv *, jclass, jint, jint, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileRecv - * Signature: (IIIIJ[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileRecv - (JNIEnv *, jclass, jint, jint, jint, jint, jlong, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileRecvChunk - * Signature: (IIIJ[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileRecvChunk - (JNIEnv *, jclass, jint, jint, jint, jlong, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileChunkRequest - * Signature: (IIIJI)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileChunkRequest - (JNIEnv *, jclass, jint, jint, jint, jlong, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendConnectionStatus - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendConnectionStatus - (JNIEnv *, jclass, jint, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendLosslessPacket - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendLosslessPacket - (JNIEnv *, jclass, jint, jint, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendLossyPacket - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendLossyPacket - (JNIEnv *, jclass, jint, jint, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendMessage - * Signature: (IIII[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendMessage - (JNIEnv *, jclass, jint, jint, jint, jint, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendName - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendName - (JNIEnv *, jclass, jint, jint, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendRequest - * Signature: (I[BI[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendRequest - (JNIEnv *, jclass, jint, jbyteArray, jint, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendStatus - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendStatus - (JNIEnv *, jclass, jint, jint, jint); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendStatusMessage - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendStatusMessage - (JNIEnv *, jclass, jint, jint, jbyteArray); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendTyping - * Signature: (IIZ)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendTyping - (JNIEnv *, jclass, jint, jint, jboolean); - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendReadReceipt - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendReadReceipt - (JNIEnv *, jclass, jint, jint, jint); - /* * Class: im_tox_tox4j_impl_jni_ToxCoreJni * Method: tox4jLastLog diff --git a/lib/src/main/cpp/ToxCore/lifecycle.cpp b/lib/src/main/cpp/ToxCore/lifecycle.cpp index 02fa0d0c8..6516b16f8 100644 --- a/lib/src/main/cpp/ToxCore/lifecycle.cpp +++ b/lib/src/main/cpp/ToxCore/lifecycle.cpp @@ -346,268 +346,3 @@ TOX_METHOD (jbyteArray, GetSavedata, tox_get_savedata>::make ); } - - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeSelfConnectionStatus - * Signature: (II)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeSelfConnectionStatus - (JNIEnv *env, jclass, jint instanceNumber, jint connection_status) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_self_connection_status_cb (Enum::valueOf (env, connection_status), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileRecvControl - * Signature: (IIII)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileRecvControl - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint file_number, jint control) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_file_recv_control_cb (friend_number, file_number, Enum::valueOf (env, control), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileRecv - * Signature: (IIIIJ[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileRecv - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint file_number, jint kind, jlong file_size, jbyteArray filename) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto filenameArray = fromJavaArray (env, filename); - tox4j_file_recv_cb (friend_number, file_number, kind, file_size, filenameArray.data (), filenameArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileRecvChunk - * Signature: (IIIJ[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileRecvChunk - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint file_number, jlong position, jbyteArray data) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto dataArray = fromJavaArray (env, data); - tox4j_file_recv_chunk_cb (friend_number, file_number, position, dataArray.data (), dataArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFileChunkRequest - * Signature: (IIIJI)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFileChunkRequest - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint file_number, jlong position, jint length) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_file_chunk_request_cb (friend_number, file_number, position, length, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendConnectionStatus - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendConnectionStatus - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint connection_status) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_friend_connection_status_cb (friend_number, Enum::valueOf (env, connection_status), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendLosslessPacket - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendLosslessPacket - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jbyteArray data) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto dataArray = fromJavaArray (env, data); - tox4j_friend_lossless_packet_cb (friend_number, dataArray.data (), dataArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendLossyPacket - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendLossyPacket - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jbyteArray data) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto dataArray = fromJavaArray (env, data); - tox4j_friend_lossy_packet_cb (friend_number, dataArray.data (), dataArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendMessage - * Signature: (IIII[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendMessage - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint type, jint time_delta, jbyteArray message) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto messageArray = fromJavaArray (env, message); - tox4j_friend_message_cb (friend_number, Enum::valueOf (env, type), /*time_delta, */ messageArray.data (), messageArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendName - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendName - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jbyteArray name) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto nameArray = fromJavaArray (env, name); - tox4j_friend_name_cb (friend_number, nameArray.data (), nameArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendRequest - * Signature: (I[BI[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendRequest - (JNIEnv *env, jclass, jint instanceNumber, jbyteArray public_key, jint time_delta, jbyteArray message) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto public_keyArray = fromJavaArray (env, public_key); - auto messageArray = fromJavaArray (env, message); - tox4j_friend_request_cb (public_keyArray.data (), /*time_delta, */ messageArray.data (), messageArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendStatus - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendStatus - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint status) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_friend_status_cb (friend_number, Enum::valueOf (env, status), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendStatusMessage - * Signature: (II[B)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendStatusMessage - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jbyteArray message) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - auto messageArray = fromJavaArray (env, message); - tox4j_friend_status_message_cb (friend_number, messageArray.data (), messageArray.size (), &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendTyping - * Signature: (IIZ)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendTyping - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jboolean is_typing) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_friend_typing_cb (friend_number, is_typing, &events); - } - ); -} - -/* - * Class: im_tox_tox4j_impl_jni_ToxCoreJni - * Method: invokeFriendReadReceipt - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_im_tox_tox4j_impl_jni_ToxCoreJni_invokeFriendReadReceipt - (JNIEnv *env, jclass, jint instanceNumber, jint friend_number, jint message_id) -{ - return instances.with_instance (env, instanceNumber, - [=] (Tox *tox, Events &events) - { - assert (tox != nullptr); - tox4j_friend_read_receipt_cb (friend_number, message_id, &events); - } - ); -} diff --git a/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvImpl.kt b/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvImpl.kt index be7d7a375..923324f33 100644 --- a/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvImpl.kt +++ b/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvImpl.kt @@ -91,55 +91,4 @@ final class ToxAvImpl(private val tox: ToxCoreImpl) : ToxAv { u: ByteArray, v: ByteArray ): Unit = ToxAvJni.toxavVideoSendFrame(instanceNumber, friendNumber.value, width, height, y, u, v) - - fun invokeAudioReceiveFrame( - friendNumber: ToxFriendNumber, - pcm: ShortArray, - channels: AudioChannels, - samplingRate: SamplingRate - ): Unit = - ToxAvJni.invokeAudioReceiveFrame( - instanceNumber, friendNumber.value, pcm, channels.value, samplingRate.value) - - fun invokeAudioBitRate(friendNumber: ToxFriendNumber, audioBitRate: BitRate): Unit = - ToxAvJni.invokeAudioBitRate(instanceNumber, friendNumber.value, audioBitRate.value) - - fun invokeVideoBitRate(friendNumber: ToxFriendNumber, videoBitRate: BitRate): Unit = - ToxAvJni.invokeVideoBitRate(instanceNumber, friendNumber.value, videoBitRate.value) - - fun invokeCall( - friendNumber: ToxFriendNumber, - audioEnabled: Boolean, - videoEnabled: Boolean - ): Unit = ToxAvJni.invokeCall(instanceNumber, friendNumber.value, audioEnabled, videoEnabled) - - fun invokeCallState( - friendNumber: ToxFriendNumber, - callState: EnumSet - ): Unit = - ToxAvJni.invokeCallState( - instanceNumber, friendNumber.value, ToxAvEventDispatch.convert(callState)) - - fun invokeVideoReceiveFrame( - friendNumber: ToxFriendNumber, - width: Width, - height: Height, - y: ByteArray, - u: ByteArray, - v: ByteArray, - yStride: Int, - uStride: Int, - vStride: Int - ): Unit = - ToxAvJni.invokeVideoReceiveFrame( - instanceNumber, - friendNumber.value, - width.value, - height.value, - y, - u, - v, - yStride, - uStride, - vStride) } diff --git a/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvJni.java b/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvJni.java index 9da227883..cff0673ff 100644 --- a/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvJni.java +++ b/lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvJni.java @@ -1,8 +1,6 @@ package im.tox.tox4j.impl.jni; import im.tox.tox4j.av.exceptions.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; @SuppressWarnings({"checkstyle:emptylineseparator", "checkstyle:linelength"}) public final class ToxAvJni { @@ -14,7 +12,7 @@ public final class ToxAvJni { static native void toxavKill(int instanceNumber); static native void toxavFinalize(int instanceNumber); static native int toxavIterationInterval(int instanceNumber); - @Nullable static native byte[] toxavIterate(int instanceNumber); + static native byte[] toxavIterate(int instanceNumber); static native void toxavCall(int instanceNumber, int friendNumber, int audioBitRate, int videoBitRate) throws ToxavCallException; static native void toxavAnswer(int instanceNumber, int friendNumber, int audioBitRate, @@ -26,23 +24,10 @@ static native void toxavAudioSetBitRate(int instanceNumber, int friendNumber, in static native void toxavVideoSetBitRate(int instanceNumber, int friendNumber, int videoBitRate) throws ToxavBitRateSetException; - static native void toxavAudioSendFrame(int instanceNumber, int friendNumber, @NotNull short[] pcm, + static native void toxavAudioSendFrame(int instanceNumber, int friendNumber, short[] pcm, int sampleCount, int channels, int samplingRate) throws ToxavSendFrameException; @SuppressWarnings("checkstyle:parametername") static native void toxavVideoSendFrame(int instanceNumber, int friendNumber, int width, - int height, @NotNull byte[] y, @NotNull byte[] u, @NotNull byte[] v) - throws ToxavSendFrameException; - - static native void invokeAudioReceiveFrame( - int instanceNumber, int friendNumber, short[] pcm, int channels, int samplingRate); - static native void invokeAudioBitRate(int instanceNumber, int friendNumber, int audioBitRate); - static native void invokeVideoBitRate(int instanceNumber, int friendNumber, int videoBitRate); - static native void invokeCall( - int instanceNumber, int friendNumber, boolean audioEnabled, boolean videoEnabled); - static native void invokeCallState(int instanceNumber, int friendNumber, int callState); - @SuppressWarnings("checkstyle:parametername") - static native void invokeVideoReceiveFrame(int instanceNumber, int friendNumber, int width, - int height, @NotNull byte[] y, @NotNull byte[] u, @NotNull byte[] v, int yStride, int uStride, - int vStride); + int height, byte[] y, byte[] u, byte[] v) throws ToxavSendFrameException; } diff --git a/lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreJni.java b/lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreJni.java index ade5f93bb..6485d1004 100644 --- a/lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreJni.java +++ b/lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreJni.java @@ -1,8 +1,6 @@ package im.tox.tox4j.impl.jni; import im.tox.tox4j.core.exceptions.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; @SuppressWarnings({"checkstyle:emptylineseparator", "checkstyle:linelength"}) public final class ToxCoreJni { @@ -11,66 +9,63 @@ public final class ToxCoreJni { } static native int toxNew(boolean ipv6Enabled, boolean udpEnabled, boolean localDiscoveryEnabled, - int proxyType, @NotNull String proxyAddress, int proxyPort, int startPort, int endPort, - int tcpPort, int saveDataType, @NotNull byte[] saveData) throws ToxNewException; + int proxyType, String proxyAddress, int proxyPort, int startPort, int endPort, int tcpPort, + int saveDataType, byte[] saveData) throws ToxNewException; static native void toxKill(int instanceNumber); static native void toxFinalize(int instanceNumber); - @NotNull static native byte[] toxGetSavedata(int instanceNumber); - static native void toxBootstrap(int instanceNumber, @NotNull String address, int port, - @NotNull byte[] publicKey) throws ToxBootstrapException; - static native void toxAddTcpRelay(int instanceNumber, @NotNull String address, int port, - @NotNull byte[] publicKey) throws ToxBootstrapException; + static native byte[] toxGetSavedata(int instanceNumber); + static native void toxBootstrap(int instanceNumber, String address, int port, byte[] publicKey) + throws ToxBootstrapException; + static native void toxAddTcpRelay(int instanceNumber, String address, int port, byte[] publicKey) + throws ToxBootstrapException; static native int toxSelfGetUdpPort(int instanceNumber) throws ToxGetPortException; static native int toxSelfGetTcpPort(int instanceNumber) throws ToxGetPortException; - @NotNull static native byte[] toxSelfGetDhtId(int instanceNumber); + static native byte[] toxSelfGetDhtId(int instanceNumber); static native int toxIterationInterval(int instanceNumber); - @Nullable static native byte[] toxIterate(int instanceNumber); - @NotNull static native byte[] toxSelfGetPublicKey(int instanceNumber); - @NotNull static native byte[] toxSelfGetSecretKey(int instanceNumber); + static native byte[] toxIterate(int instanceNumber); + static native byte[] toxSelfGetPublicKey(int instanceNumber); + static native byte[] toxSelfGetSecretKey(int instanceNumber); static native void toxSelfSetNospam(int instanceNumber, int nospam); static native int toxSelfGetNospam(int instanceNumber); - @NotNull static native byte[] toxSelfGetAddress(int instanceNumber); - static native void toxSelfSetName(int instanceNumber, @NotNull byte[] name) - throws ToxSetInfoException; - @NotNull static native byte[] toxSelfGetName(int instanceNumber); + static native byte[] toxSelfGetAddress(int instanceNumber); + static native void toxSelfSetName(int instanceNumber, byte[] name) throws ToxSetInfoException; + static native byte[] toxSelfGetName(int instanceNumber); static native void toxSelfSetStatusMessage(int instanceNumber, byte[] message) throws ToxSetInfoException; - @NotNull static native byte[] toxSelfGetStatusMessage(int instanceNumber); + static native byte[] toxSelfGetStatusMessage(int instanceNumber); static native void toxSelfSetStatus(int instanceNumber, int status); static native int toxSelfGetStatus(int instanceNumber); - static native int toxFriendAdd(int instanceNumber, @NotNull byte[] address, - @NotNull byte[] message) throws ToxFriendAddException; - static native int toxFriendAddNorequest(int instanceNumber, @NotNull byte[] publicKey) + static native int toxFriendAdd(int instanceNumber, byte[] address, byte[] message) + throws ToxFriendAddException; + static native int toxFriendAddNorequest(int instanceNumber, byte[] publicKey) throws ToxFriendAddException; static native void toxFriendDelete(int instanceNumber, int friendNumber) throws ToxFriendDeleteException; - static native int toxFriendByPublicKey(int instanceNumber, @NotNull byte[] publicKey) + static native int toxFriendByPublicKey(int instanceNumber, byte[] publicKey) throws ToxFriendByPublicKeyException; - @NotNull static native byte[] toxFriendGetPublicKey(int instanceNumber, int friendNumber) throws ToxFriendGetPublicKeyException; static native boolean toxFriendExists(int instanceNumber, int friendNumber); - @NotNull static native int[] toxSelfGetFriendList(int instanceNumber); + static native int[] toxSelfGetFriendList(int instanceNumber); static native void toxSelfSetTyping(int instanceNumber, int friendNumber, boolean typing) throws ToxSetTypingException; static native int toxFriendSendMessage(int instanceNumber, int friendNumber, int type, - int timeDelta, @NotNull byte[] message) throws ToxFriendSendMessageException; + int timeDelta, byte[] message) throws ToxFriendSendMessageException; static native void toxFileControl(int instanceNumber, int friendNumber, int fileNumber, int control) throws ToxFileControlException; static native void toxFileSeek(int instanceNumber, int friendNumber, int fileNumber, long position) throws ToxFileSeekException; static native int toxFileSend(int instanceNumber, int friendNumber, int kind, long fileSize, - @NotNull byte[] fileId, @NotNull byte[] filename) throws ToxFileSendException; + byte[] fileId, byte[] filename) throws ToxFileSendException; static native void toxFileSendChunk(int instanceNumber, int friendNumber, int fileNumber, - long position, @NotNull byte[] data) throws ToxFileSendChunkException; - @NotNull + long position, byte[] data) throws ToxFileSendChunkException; static native byte[] toxFileGetFileId(int instanceNumber, int friendNumber, int fileNumber) throws ToxFileGetException; - static native void toxFriendSendLossyPacket(int instanceNumber, int friendNumber, - @NotNull byte[] data) throws ToxFriendCustomPacketException; - static native void toxFriendSendLosslessPacket(int instanceNumber, int friendNumber, - @NotNull byte[] data) throws ToxFriendCustomPacketException; + static native void toxFriendSendLossyPacket(int instanceNumber, int friendNumber, byte[] data) + throws ToxFriendCustomPacketException; + static native void toxFriendSendLosslessPacket(int instanceNumber, int friendNumber, byte[] data) + throws ToxFriendCustomPacketException; static native byte[] tox4jLastLog(); static native int tox4jGetCurrentLogSize(); diff --git a/lib/src/main/proto/Av.proto b/lib/src/main/proto/Av.proto index c364e57c5..96dd4dacf 100644 --- a/lib/src/main/proto/Av.proto +++ b/lib/src/main/proto/Av.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package im.tox.tox4j.av.proto; option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; message Call { int32 friend_number = 1; diff --git a/lib/src/main/proto/Core.proto b/lib/src/main/proto/Core.proto index 9b1eac8ca..6c7e789b2 100644 --- a/lib/src/main/proto/Core.proto +++ b/lib/src/main/proto/Core.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package im.tox.tox4j.core.proto; option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; message Connection { enum Type { diff --git a/lib/src/main/proto/ProtoLog.proto b/lib/src/main/proto/ProtoLog.proto index 883fb1694..c4f93395c 100644 --- a/lib/src/main/proto/ProtoLog.proto +++ b/lib/src/main/proto/ProtoLog.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package im.tox.tox4j.impl.jni.proto; +option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; // struct timeval from representing a point in time. message Timestamp { diff --git a/scripts/build-host b/scripts/build-host index e0b4f6533..833f8c49b 100755 --- a/scripts/build-host +++ b/scripts/build-host @@ -39,7 +39,7 @@ cpp/src/ToxCrypto/generated/im_tox_tox4j_impl_jni_ToxCryptoJni.h: build %.run: ; $* regenerate: $(foreach i,$(wildcard bin/Jni*),$i.run) $(wildcard cpp/src/*/generated/*.h) -protobuf_CONFIGURE := --prefix=$(PREFIX) --disable-shared +protobuf_CONFIGURE := -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_DISABLE_RTTI=ON -Dprotobuf_BUILD_SHARED_LIBS=OFF libsodium_CONFIGURE := --prefix=$(PREFIX) --disable-shared opus_CONFIGURE := --prefix=$(PREFIX) --disable-shared libvpx_CONFIGURE := --prefix=$(PREFIX) --disable-examples --disable-unit-tests --enable-pic diff --git a/scripts/dependencies.mk b/scripts/dependencies.mk index 509b45766..a85795df9 100644 --- a/scripts/dependencies.mk +++ b/scripts/dependencies.mk @@ -1,6 +1,8 @@ PRE_RULE = (echo "=== Building $@ ==="; ls -ld $@; true) && ls -ld $+ POST_RULE = ls -ld $@ +GIT_CLONE = git clone --depth=1 --recurse-submodules --shallow-submodules + $(BUILDDIR)/tox4j/Makefile: $(CURDIR)/lib/src/main/cpp/CMakeLists.txt $(TOOLCHAIN_FILE) $(foreach i,protobuf toxcore,$(PREFIX)/$i.stamp) @$(PRE_RULE) mkdir -p $(@D) @@ -17,14 +19,13 @@ $(PREFIX)/tox4j.stamp: $(BUILDDIR)/tox4j/Makefile # protobuf $(SRCDIR)/protobuf: - git clone --depth=1 --branch=v3.11.1 https://github.com/google/protobuf $@ + $(GIT_CLONE) --branch=v3.24.4 https://github.com/protocolbuffers/protobuf $@ $(PREFIX)/protobuf.stamp: $(SRCDIR)/protobuf $(TOOLCHAIN_FILE) $(PROTOC) @$(PRE_RULE) - cd $< && autoreconf -fi mkdir -p $(BUILDDIR)/$(notdir $<) - cd $(BUILDDIR)/$(notdir $<) && $(SRCDIR)/$(notdir $<)/configure $($(notdir $<)_CONFIGURE) - $(MAKE) -C $(BUILDDIR)/$(notdir $<) install V=0 + cd $(BUILDDIR)/$(notdir $<) && cmake $(SRCDIR)/$(notdir $<) $($(notdir $<)_CONFIGURE) + $(MAKE) -C $(BUILDDIR)/$(notdir $<) install mkdir -p $(@D) && touch $@ @$(POST_RULE) @@ -35,7 +36,7 @@ $(SRCDIR)/toxcore: if [ -e ../c-toxcore ]; then \ ln -s $(realpath ../c-toxcore) $@; \ else \ - git clone --depth=1 --recurse-submodules https://github.com/TokTok/c-toxcore $@; \ + $(GIT_CLONE) https://github.com/TokTok/c-toxcore $@; \ fi $(PREFIX)/toxcore.stamp: $(foreach f,$(shell cd $(SRCDIR)/toxcore && git ls-files),$(SRCDIR)/toxcore/$f) @@ -51,7 +52,7 @@ $(PREFIX)/toxcore.stamp: $(SRCDIR)/toxcore $(TOOLCHAIN_FILE) $(foreach i,libsodi # libsodium $(SRCDIR)/libsodium: - git clone --depth=1 --branch=1.0.18 https://github.com/jedisct1/libsodium $@ + $(GIT_CLONE) --branch=1.0.18 https://github.com/jedisct1/libsodium $@ $(PREFIX)/libsodium.stamp: $(SRCDIR)/libsodium $(TOOLCHAIN_FILE) @$(PRE_RULE) @@ -66,7 +67,7 @@ $(PREFIX)/libsodium.stamp: $(SRCDIR)/libsodium $(TOOLCHAIN_FILE) # opus $(SRCDIR)/opus: - git clone --depth=1 https://github.com/xiph/opus $@ + $(GIT_CLONE) https://github.com/xiph/opus $@ $(PREFIX)/opus.stamp: $(SRCDIR)/opus $(TOOLCHAIN_FILE) @$(PRE_RULE) @@ -81,7 +82,7 @@ $(PREFIX)/opus.stamp: $(SRCDIR)/opus $(TOOLCHAIN_FILE) # libvpx $(SRCDIR)/libvpx: - git clone --depth=1 --branch=v1.6.0 https://github.com/webmproject/libvpx $@ + $(GIT_CLONE) --branch=v1.6.0 https://github.com/webmproject/libvpx $@ cd $@ && patch -p1 < $(CURDIR)/scripts/patches/libvpx.patch $(PREFIX)/libvpx.stamp: $(SRCDIR)/libvpx $(TOOLCHAIN_FILE)