libvarnam icon indicating copy to clipboard operation
libvarnam copied to clipboard

Port varnamc ruby CLI to C

Open subins2000 opened this issue 5 years ago • 8 comments

Ruby dependency can be avoided if varnamc is written in C itself or Python or Go to reduce dependencies. After making the flatpak package, I realize that Ruby uses 40MB+ for its dependency.

What do you think @navaneeth ?

cc @joicemjoseph interested ?

subins2000 avatar Aug 16 '20 12:08 subins2000

@athul is trying a rewrite of varnamc in Go

subins2000 avatar Sep 10 '20 14:09 subins2000

I dont think that is the best way to do.

  1. I am just curious to know why he used Ruby instead of C, while he wrote everything in C.
  2. If you ask me for a choice, I would prefer C than Go, because the build process would be straight forward.

joicemjoseph avatar Sep 10 '20 17:09 joicemjoseph

@joicemjoseph I agree, C would the right way

subins2000 avatar Sep 10 '20 17:09 subins2000

I'd like to give it a go in C. Let's see :sweat_smile:

subins2000 avatar Sep 10 '20 17:09 subins2000

@joicemjoseph Found this : http://savannah.nongnu.org/bugs/?40807

Varnam is segregated, there's savannah, gitlab, and github. We should make one canonical. I'd say with GitLab, let's do some standardization for future contributions too.

subins2000 avatar Sep 11 '20 13:09 subins2000

All the current Varnam Scheme Files (Docs) are in ruby, compiling scheme files therefore need Ruby. Instead of a config file, having a Ruby file is advantageous, yes, but this goal is to port varnamc to C. It's super difficult to implement the current varnamc's --compile option in C. So, I'm not gonna implement it.

Workaround

Provide the compiled .vst binary (they're actually SQLite DB file) for production use. Here are the filesizes :

$ du -h schemes/*.vst
12M     schemes/as.vst
12M     schemes/bn.vst
9.2M    schemes/gu.vst
6.3M    schemes/hi.vst
224K    schemes/kn.vst
52K     schemes/ml-inscript.vst
648K    schemes/ml.vst
18M     schemes/mr.vst
19M     schemes/ne.vst
12M     schemes/or.vst
5.4M    schemes/pa.vst
7.5M    schemes/sa.vst
152K    schemes/ta.vst
192K    schemes/te.vst

These files are downloadable from here, but I'm not sure if they're up to date.

subins2000 avatar Sep 15 '20 19:09 subins2000

I just saw the (slightly weird) dependency on Ruby after building libvarnam and felt the same. Also this is not mentioned anywhere in the README which is a bigger problem. One gets in a bit of a rabbit hole after the ruby installation -> then the ffi gem -> which requires ruby-dev -> etc.

pythonhacker avatar Oct 29 '21 07:10 pythonhacker

@pythonhacker Yes I went through the same issue when I started with libvarnam. GoVarnam fixes this by having the CLI tool written in Go itself.

I did give this a go (pun intended ;)) in C (https://github.com/varnamproject/libvarnam/pull/157) but dependency management in C is troublesome especially for cross-platform compatibility.

subins2000 avatar Oct 29 '21 10:10 subins2000