alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.7k stars 1.08k forks source link

Add jitpack build #558

Closed nshmyrev closed 2 years ago

nshmyrev commented 3 years ago

So we can distribute things for F-droid, see

https://forum.f-droid.org/t/google-voice-foss-replica/13629/8

k3b commented 3 years ago

For details see https://jitpack.io/docs/ANDROID/ and https://jitpack.io/docs/BUILDING/

I am currently experimenting how to create a gradle only android lib that includes ndk and downloading the c++ source modules without the need for a bash script

k3b commented 3 years ago

@nshmyrev i have created https://github.com/k3b/vosk-api-jitpack.io as an attempt to create the lib in gradle only without any bash script.

Note that i have never worked before with android-ndk and cmake. the last time i programmed in c++ was 20 years ago (windows-3.0)


what i have done so far:

Created a new android project with a ndk subproject "vosk-api"

can you help me solving that issue

nshmyrev commented 3 years ago

can you help me solving that issue

Hi, thank you for starting this. Some notes:

  1. I wanted to look a bit later on that too
  2. I don't think a separate project is needed, you can do it within vosk-api. I believe you can specify the build command in jitpack.yml so it will pick the right folder.
  3. I don't think you need to rework everything with cmake. You just add build-kaldi script to gradle as a task and it will be invoked on build. I hope jitpack allows build of a bigger c++ project.
k3b commented 3 years ago

Thanks for reply.

The seperate project is just an experiment where i can play and learn without polluting the original.

I already learned about

I agree that building using jitpack.yml is probably much less effort than recreating the build in native gradle.

"jitpack.yml" is provider specific so it will not work with travis or under windows where there is no bash-shell.

I will try to learn more about android c++ integration.

Can you help me what should be put into OpenBLAS/CMakeLists.txt to android specific target lib.

if (???ANDROID???)
    target_link_libraries(native-lib SHARED ?????)
endif ()
nshmyrev commented 3 years ago

Can you help me what should be put into OpenBLAS/CMakeLists.txt to android specific target lib.

I don't think you need to put something specific. It is already there:

https://github.com/xianyi/OpenBLAS/blob/42f048cf6c04e51de6c7a3ade5af71b0c4dcea0d/CMakeLists.txt#L190

k3b commented 3 years ago

thanks.

i already found the solution. the error with missing "target" was a missing environment variable. i go on learning ....

k3b commented 3 years ago

I finally stopped trying to create a gradle-native-build because config.h is not generated in vosk-api/src/main/cpp/clonedRepositories/OpenBLAS/Makefile.system

I cannot do this without a coderewrite.

I hope that nshmyrev -s jitpack.yml aproach will work

k3b commented 3 years ago

I tried with jitpack.yml but it does not compile

publishing:

consumig as

nshmyrev commented 3 years ago

but it does not compile

The log says you need to define ANDROID_NDK_HOME, probably also in jitpack.yml

k3b commented 3 years ago

The log says you need to define ANDROID_NDK_HOME, probably also in jitpack.yml

i thought that would be done with sdkmanager --install "ndk;21.3.6528147"

k3b commented 3 years ago

https://stackoverflow.com/questions/67791300/how-to-install-android-ndk-using-a-jitpack-yml-without-gradle

nshmyrev commented 3 years ago

@k3b jitpack doesn't define ANROID_NDK_HOME, but it defines ANDROID_HOME. You can probably modify build-vosk.sh script like this:

  ANDROID_NDK_HOME?=$ANDROID_HOME/ndk-bundle

and it should go forward

k3b commented 3 years ago

@nshmyrev have you tried to upload your aar lib via https://central.sonatype.org/publish/ ? it is among the trusted maven repos

nshmyrev commented 3 years ago

Yeah, we had bad experience with sonatype before. I'd better go with jitpack. But I'm sorry I didn't had time to check yet.

Stypox commented 2 years ago

Is anyone still working on this? I'd like to publish the Dicio assistant on F-Droid but that needs this issue to be resolved. If nobody is working on it I might try myself, though I don't have much experience with build scripts and NDK.

nshmyrev commented 2 years ago

Is anyone still working on this?

No, I don't think so

I'd like to publish the Dicio assistant on F-Droid but that needs this issue to be resolved.

Cool app!

Please try and let me know if you need any help. If it doesn't work, maybe I'll register to sonatype in the end, not sure.

nshmyrev commented 2 years ago

I decided to go ahead with sonatype. Created an issue at https://issues.sonatype.org/browse/OSSRH-74850

nshmyrev commented 2 years ago

Done https://s01.oss.sonatype.org/content/repositories/releases/com/alphacephei/vosk-android/0.3.32/, not sure if it is public already or not

nshmyrev commented 2 years ago

We are on mavencentral already

https://repo1.maven.org/maven2/com/alphacephei/vosk-android/

Stypox commented 2 years ago

Thank you very much :-D

nshmyrev commented 2 years ago

Thank you @Stypox, your patch was extremely helpful