From 5d65f1ec8ec5105680ab3f599b6593f70a607dbd Mon Sep 17 00:00:00 2001 From: Subin Siby Date: Mon, 6 Dec 2021 00:28:30 +0530 Subject: [PATCH 1/5] Target Ubuntu 14.04 (gtk 3.10) build --- Makefile | 5 +++++ preferences.go | 22 +++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index bf7abb7..474c6c7 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,11 @@ ibus-xml: $(shell SCHEMES=("ml" "ta" "hi" "te" "ka" "bn"); for s in $${SCHEMES[@]}; do echo $s; ./${BIN} -s $$s -lang $$s -xml component/varnam-$$s.xml -prefix ${INSTALL_PREFIX}; done) +ubuntu-14: + CGO_CFLAGS="-w" go build -tags "pango_1_36,gtk_3_10,glib_2_40,cairo_1_13,gdk_pixbuf_2_30,gtk_deprecated" -ldflags "-s -w" -o ${BIN} . + $(MAKE) ibus-xml + $(MAKE) install-script + ubuntu-18: go build -tags pango_1_42,gtk_3_22 -ldflags "-s -w" -o ${BIN} . $(MAKE) ibus-xml diff --git a/preferences.go b/preferences.go index 55361c6..f60afa8 100644 --- a/preferences.go +++ b/preferences.go @@ -130,8 +130,11 @@ func makeSettingsPage() *gtk.Box { settingsPage, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 6) checkError(err) - settingsPage.SetMarginStart(12) - settingsPage.SetMarginEnd(12) + // gtk_widget_set_margin_left & right is deprecated since 3.12 + // It got removed in 3.98: https://github.com/GNOME/gtk/blob/main/NEWS.pre-4.0#L939 + // Our minimum GTK support needed is 3.10 (Ubuntu 14.04) + settingsPage.SetMarginLeft(12) + settingsPage.SetMarginRight(12) settingsPage.SetMarginBottom(12) /* Dictionary Match Exact Preference */ @@ -326,8 +329,8 @@ func makeRLWPage() *gtk.Box { rlwPage, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 6) checkError(err) - rlwPage.SetMarginStart(12) - rlwPage.SetMarginEnd(12) + rlwPage.SetMarginLeft(12) + rlwPage.SetMarginRight(12) rlwPage.SetMarginTop(12) rlwPage.SetMarginBottom(12) @@ -419,8 +422,8 @@ func showPrefs() { notebook.SetScrollable(true) - notebook.SetMarginStart(12) - notebook.SetMarginEnd(12) + notebook.SetMarginLeft(12) + notebook.SetMarginRight(12) notebook.SetMarginBottom(12) settingsLabel, err := gtk.LabelNew("Settings") @@ -433,13 +436,6 @@ func showPrefs() { win.Add(notebook) - settingsPage, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 6) - checkError(err) - - settingsPage.SetMarginStart(12) - settingsPage.SetMarginEnd(12) - settingsPage.SetMarginBottom(12) - // Recursively show all widgets contained in this window. mainWin.ShowAll() From 14cea17edeec3d85f4e67f55e5a1786bfbd64b96 Mon Sep 17 00:00:00 2001 From: Subin Siby Date: Mon, 6 Dec 2021 00:30:15 +0530 Subject: [PATCH 2/5] Update gotk3 --- go.mod | 3 +-- go.sum | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index f02c65f..1c03af9 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,7 @@ go 1.15 require ( github.com/godbus/dbus/v5 v5.0.3 - github.com/gotk3/gotk3 v0.6.0 - github.com/mattn/go-pointer v0.0.1 // indirect + github.com/gotk3/gotk3 v0.6.2-0.20211107090813-1d544513fb74 github.com/varnamproject/govarnam v0.0.0-00010101000000-000000000000 ) diff --git a/go.sum b/go.sum index 68038c6..b81c54b 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,5 @@ github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gotk3/gotk3 v0.6.0 h1:Aqlq4/6VabNwtCyA9M9zFNad5yHAqCi5heWnZ9y+3dA= -github.com/gotk3/gotk3 v0.6.0/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q= -github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= +github.com/gotk3/gotk3 v0.6.2-0.20211107090813-1d544513fb74 h1:3ZID57DpPn1xRXRzXYl5Sm4OQ4LJG4IFlGo+1TT6xWQ= +github.com/gotk3/gotk3 v0.6.2-0.20211107090813-1d544513fb74/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= From 8cc8668642c884d4333880bb9478599b53fb9393 Mon Sep 17 00:00:00 2001 From: Subin Siby Date: Mon, 6 Dec 2021 00:45:24 +0530 Subject: [PATCH 3/5] Dockerized build for Ubuntu 14.04 --- docker/Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ docker/README.md | 14 ++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..ff893bc --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:trusty + +WORKDIR /root + +RUN apt-get update + +# Install gtk headers +RUN apt-get install -y wget libgtk-3-dev libcairo2-dev libglib2.0-dev + +# Install go +RUN wget -O go.tar.gz https://go.dev/dl/go1.17.4.linux-amd64.tar.gz; \ +tar -xf go.tar.gz; + +RUN apt-get install -y git build-essential clang pkg-config zip; + +RUN git clone https://github.com/varnamproject/govarnam.git; \ +git clone https://github.com/varnamproject/govarnam-ibus.git + +ENV PATH="/root/go/bin:${PATH}" + +WORKDIR /root/govarnam + +RUN CC=clang make; \ +sudo make install; \ +make release + +RUN mkdir -p /extract; \ +cp *.zip /extract + +WORKDIR /root/govarnam-ibus + +RUN git checkout gtk-3.10-ubuntu-14.04; \ +make ubuntu-14; \ +make release + +RUN cp *.zip /extract \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..4860b98 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,14 @@ +# Docker + +Builds `govarnam` & `govarnam-ibus` for Ubuntu 14.04 (GTK 3.10, glibc 2.19) & later versions: + +```bash +docker build -t varnam . +``` + +Copy built artifacts from container using: +```bash +id=$(docker create varnam) +docker cp $id:/extract/. ./ +docker rm -v $id +``` \ No newline at end of file From 7bc8ac9bf974ef25f3aeaa9ba00938d152060e25 Mon Sep 17 00:00:00 2001 From: Subin Siby Date: Wed, 8 Dec 2021 13:44:35 +0530 Subject: [PATCH 4/5] No need of gtk_deprecated - github.com / gotk3/gotk3 / issues/850 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 474c6c7..86b3749 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ ibus-xml: $(shell SCHEMES=("ml" "ta" "hi" "te" "ka" "bn"); for s in $${SCHEMES[@]}; do echo $s; ./${BIN} -s $$s -lang $$s -xml component/varnam-$$s.xml -prefix ${INSTALL_PREFIX}; done) ubuntu-14: - CGO_CFLAGS="-w" go build -tags "pango_1_36,gtk_3_10,glib_2_40,cairo_1_13,gdk_pixbuf_2_30,gtk_deprecated" -ldflags "-s -w" -o ${BIN} . + CGO_CFLAGS="-w" go build -tags "pango_1_36,gtk_3_10,glib_2_40,cairo_1_13,gdk_pixbuf_2_30" -ldflags "-s -w" -o ${BIN} . $(MAKE) ibus-xml $(MAKE) install-script From 087b9bb3d1d1b7961117dbc3f524826e3e8972d3 Mon Sep 17 00:00:00 2001 From: Subin Siby Date: Wed, 8 Dec 2021 14:38:40 +0530 Subject: [PATCH 5/5] Fix window default size --- Makefile | 2 +- docker/Dockerfile | 2 +- preferences.go | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 86b3749..38e2ace 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ ubuntu-14: $(MAKE) install-script ubuntu-18: - go build -tags pango_1_42,gtk_3_22 -ldflags "-s -w" -o ${BIN} . + go build -tags "pango_1_42,gtk_3_22,glib_2_66,cairo_1_15" -ldflags "-s -w" -o ${BIN} . $(MAKE) ibus-xml $(MAKE) install-script diff --git a/docker/Dockerfile b/docker/Dockerfile index ff893bc..b9a042b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,4 +33,4 @@ RUN git checkout gtk-3.10-ubuntu-14.04; \ make ubuntu-14; \ make release -RUN cp *.zip /extract \ No newline at end of file +RUN cp *.zip /extract diff --git a/preferences.go b/preferences.go index f60afa8..0cda9c1 100644 --- a/preferences.go +++ b/preferences.go @@ -409,9 +409,6 @@ func showPrefs() { return } - mainWin.SetDefaultSize(640, 480) - mainWin.SetResizable(false) - mainWin.SetPosition(gtk.WIN_POS_CENTER) mainWin.SetTitle("Varnam " + varnam.GetSchemeDetails().DisplayName + " Preferences (" + engineName + ")") mainWin.Connect("destroy", func() { gtk.MainQuit() @@ -436,6 +433,10 @@ func showPrefs() { win.Add(notebook) + mainWin.SetSizeRequest(640, 480) + mainWin.SetResizable(true) + mainWin.SetPosition(gtk.WIN_POS_CENTER) + // Recursively show all widgets contained in this window. mainWin.ShowAll()