Skip to content

Commit

Permalink
Migrate to GoVarnam (#1)
Browse files Browse the repository at this point in the history
* Implemented GoVarnam, some things like CorpusDetails, sync are commented out
* mod tidy, fix learn, comment sync
* Use editor repo from varnamproject
* Update upstream, editor
* Copied changes from varnamd-govarnam, use schemes subdir for VST lookup
* Replace libvarnam with govarnam
* Add optional vst-dir in config.toml, improved makefile
* Update README
  • Loading branch information
subins2000 authored Apr 22, 2023
1 parent a0dbe5c commit f75f0f8
Show file tree
Hide file tree
Showing 24 changed files with 551 additions and 654 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ varnam
ui

config.toml
.DS_Store
*.dylib
*.gz
varnam-*
9 changes: 4 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[submodule "libvarnam/libvarnam"]
path = libvarnam/libvarnam
url = https://github.com/subins2000/libvarnam
branch = merge-all-mychanges
[submodule "varnam-editor"]
path = varnam-editor
url = https://github.com/thetronjohnson/varnam-editor.git
url = https://github.com/varnamproject/editor.git
[submodule "govarnam"]
path = govarnam
url = https://github.com/varnamproject/govarnam.git
37 changes: 0 additions & 37 deletions Dockerfile

This file was deleted.

8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Varnam Desktop, a GUI frontend and editor for libvarnam. Type Indian languages easily using transliteration.
Copyright (C) 2020 Indic Project
Varnam Desktop, a GUI frontend and editor for govarnam. Type Indian languages easily using transliteration.
Copyright (C) 2023 Subin Siby, SMC Project

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
Expand All @@ -8,8 +8,8 @@ by the Free Software Foundation, either version 3 of the License, or

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
105 changes: 66 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
BIN := varnam
BIN := varnam-desktop
STUFFED_BIN := varnam
HASH := $(shell git rev-parse HEAD | cut -c 1-8)
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
ARCH := $(shell uname -m)
Expand All @@ -10,52 +11,39 @@ STATIC := ui:/
LDFLAGS := -X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}' -s -w

ifeq ($(OS),Windows_NT)
OS := windows
LDFLAGS := $(LDFLAGS) -H windowsgui
BIN := $(BIN).exe
RELEASE_NAME_32 := $(RELEASE_NAME)-windows-32
RELEASE_NAME := $(RELEASE_NAME)-windows-${ARCH}
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS := linux
RELEASE_NAME := $(RELEASE_NAME)-linux-${ARCH}
endif
ifeq ($(UNAME_S),Darwin)
OS := mac
RELEASE_NAME := $(RELEASE_NAME)-mac-${ARCH}
endif
endif

libvarnam-windows:
cd libvarnam/libvarnam && cmake -Bbuild . && cd build && cmake --build . --config Release && cp Release/varnam.dll ../

libvarnam-windows-32:
cd libvarnam/libvarnam && cmake -A Win32 -Bbuild . && cd build && cmake --build . --config Release && cp Release/varnam.dll ../

.ONESHELL:
libvarnam-nix:
cd libvarnam/libvarnam
mkdir -p build
cd build
cmake ..
cmake --build . --config Release
cp -P libvarnam.so* ../
govarnam-linux:
cd govarnam && make library && cp ./libgovarnam.so ../

ifeq ($(OS),Windows_NT)
.PHONY: libvarnam
libvarnam: libvarnam-windows

.PHONY: editor
editor:
build-editor.bat
else
.PHONY: libvarnam
libvarnam: libvarnam-nix
govarnam-mac:
cd govarnam && make library-mac-universal && cp ./libgovarnam.dylib ../

.PHONY: editor
editor:
./build-editor.sh
endif
govarnam-windows:
cd govarnam && make library && cp ./libgovarnam.so ../govarnam.dll

deps:
go get -u github.com/knadh/stuffbin/...

.PHONY: build
build: ## Build the binary (default)
go build -ldflags="${LDFLAGS}" -o ${BIN}
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
stuffbin -a stuff -in ${BIN} -out ${STUFFED_BIN} ${STATIC}

# 32-bit releases are only for Windows
build-32:
Expand All @@ -64,35 +52,74 @@ build-32:

release-linux:
mkdir -p ${RELEASE_NAME}
cp varnam.sh varnam libvarnam/libvarnam/libvarnam.so.3 config.toml ${RELEASE_NAME}
cp -r schemes ${RELEASE_NAME}
cp varnam.sh varnam libgovarnam.* config.toml ${RELEASE_NAME}
tar -cvzf ${RELEASE_NAME}.tar.gz ${RELEASE_NAME}

release-mac:
mkdir -p ${RELEASE_NAME}
cp -r schemes ${RELEASE_NAME}
cp varnam libgovarnam.* config.toml ${RELEASE_NAME}
cp varnam.sh ${RELEASE_NAME}/varnam.command
tar -cvzf ${RELEASE_NAME}.tar.gz ${RELEASE_NAME}

release-windows:
mkdir -p ${RELEASE_NAME}
cp -a varnam.exe windows-setup.bat libvarnam/libvarnam/varnam.dll config.toml ${RELEASE_NAME}
cp -r schemes ${RELEASE_NAME}
cp -a varnam.exe windows-setup.bat libgovarnam.dll config.toml ${RELEASE_NAME}
powershell "Compress-Archive -Force ${RELEASE_NAME} ${RELEASE_NAME}.zip"

release-windows-32:
mkdir -p ${RELEASE_NAME_32}
cp -a varnam.exe windows-setup.bat libvarnam/libvarnam/varnam.dll config.toml ${RELEASE_NAME_32}
cp -r schemes ${RELEASE_NAME}
cp -a varnam.exe windows-setup.bat libgovarnam.dll config.toml ${RELEASE_NAME_32}
tar -acvf ${RELEASE_NAME_32}.zip ${RELEASE_NAME_32}

release-32:
$(MAKE) libvarnam-windows-32
$(MAKE) govarnam-windows-32
$(MAKE) build-32
$(MAKE) release-windows-32

ifeq ($(OS),Windows_NT)
ifeq ($(OS),windows)
.PHONY: govarnam
govarnam: govarnam-windows

release-os:
$(MAKE) release-windows
else

ui:
build-editor.bat
endif

ifeq ($(OS),linux)
.PHONY: govarnam
govarnam: govarnam-linux

release-os:
$(MAKE) release-linux

ui:
./build-editor.sh
endif

ifeq ($(OS),mac)
.PHONY: govarnam
govarnam: govarnam-mac

release-os:
$(MAKE) release-mac

ui:
./build-editor.sh
endif

.PHONY: editor
editor:
$(MAKE) ui

release:
$(MAKE) libvarnam
$(MAKE) editor
$(MAKE) govarnam
$(MAKE) ui
$(MAKE) build
$(MAKE) release-os

Expand All @@ -104,7 +131,7 @@ run: build
clean: ## Remove temporary files and the binary
go clean
git clean -fdx
cd libvarnam/libvarnam && git clean -fdx
cd govarnam && git clean -fdx

# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
Expand Down
42 changes: 18 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,42 @@
# Varnam Desktop App

Cross-platform desktop app for Varnam. Uses [varnam-editor](https://github.com/thetronjohnson/varnam-editor) as GUI frontend.
Cross-platform desktop app for Varnam. Uses [varnam-editor](https://github.com/varnamproject/editor) as GUI frontend.

## Installation

* Download from [Releases](https://github.com/athul/varnam-desktop/releases)
* Install [dependencies](#dependencies)

## Dependencies

Debian or Ubuntu based systems :
```
sudo apt install libwebkit2gtk-4.0-37
```

Windows : Include [these DLLs](https://github.com/webview/webview/tree/master/dll) in the folder

Mac : Safari Browser should be installed
- Download from [Releases](https://github.com/varnamproject/desktop/releases)

## Development

* Clone the repo.
* Install [dependencies](#dependencies)
* Build `libvarnam` (On Windows, Visual Studio is needed to make the DLLs) :
```
- Clone the repo
- Fetch submodules:

```bash
git submodule update --init --recursive
cd libvarnam/libvarnam && cmake . && make varnamstatic && ln -s $(realpath libvarnamstatic.a) libvarnam.a && cd -
```
* Build `varnam` :

- Build govarnam:

```bash
make govarnam
```

- Build the main desktop app :

```bash
make deps
make editor
make ui
make build
```

* Run :
- Run :

```
```bash
./varnam
```

Thanks to [stuffbin](https://github.com/knadh/stuffbin), HTML+CSS+JS files are all merged into one big binary (`varnam`).

## Usage

`varnam` bundles with `varnamd`, the HTTP server to interface with varnam library. By default, the server runs on `127.0.0.1:8123`. See [varnamd](https://github.com/varnamproject/varnamd) for more details.
`varnam` bundles with `varnamd`, the HTTP server to interface with varnam library. By default, the server runs on `127.0.0.1:8123`. See [varnamd](https://github.com/varnamproject/varnamd) for more details.
Loading

0 comments on commit f75f0f8

Please sign in to comment.