From f17a33a8e2d4b9f0db680b5bd9639d0d49355a10 Mon Sep 17 00:00:00 2001 From: Anoop S <40671157+anoop142@users.noreply.github.com> Date: Sun, 5 Nov 2023 23:20:30 +0530 Subject: [PATCH 1/3] symlink libgovarnam -> libgovarnam.so.$SO_NAME (#39) * symlink libgovarnam.so -> libgovarnam.so.$SO_NAME varnamcli looks for libgovarnam.so.SO_NAME and fails to find any. ldd varnamcli | grep libgovarnam libgovarnam.so.1 => not found 2 cases * make library: only libgovarnam.so is compiled, so symlink libgovarnam.so -> libgovarnam.so.SO_NAME for local varnamcli use. * make install: symlink libgovarnam.so.VERSION -> libgovarnam.so.SO_NAME * install: overwrite lib symlinks install fails if symlinks exist, so overwrite it. --- Makefile | 2 ++ install.sh.in | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ef565d9..0dec064 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ install-script: ${SED} "s#@INSTALL_PREFIX@#${INSTALL_PREFIX}#g" install.sh ${SED} "s#@VERSION@#${VERSION}#g" install.sh ${SED} "s#@LIB_NAME@#${LIB_NAME}#g" install.sh + ${SED} "s#@SO_NAME@#${SO_NAME}#g" install.sh chmod +x install.sh install: @@ -60,6 +61,7 @@ library-nosqlite: library: CGO_ENABLED=1 go build -tags "fts5" -buildmode=c-shared -ldflags "-s -w ${VERSION_STAMP_LDFLAGS}" -o ${LIB_NAME} . + ln -sf "$(realpath ./)/libgovarnam.so" "$(realpath ./)/libgovarnam.so.${SO_NAME}" library-mac-universal: GOOS=darwin GOARCH=arm64 $(MAKE) library diff --git a/install.sh.in b/install.sh.in index 93d49e1..49b40c7 100755 --- a/install.sh.in +++ b/install.sh.in @@ -13,7 +13,8 @@ if [ "$ARG1" == "install" ]; then "${SUDO}" mkdir -p "@INSTALL_PREFIX@/lib/pkgconfig" "${SUDO}" cp "$SCRIPT_DIR/@LIB_NAME@" "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" - "${SUDO}" ln -s "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "@INSTALL_PREFIX@/lib/@LIB_NAME@" + "${SUDO}" ln -sf "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "@INSTALL_PREFIX@/lib/@LIB_NAME@" + "${SUDO}" ln -sf "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "@INSTALL_PREFIX@/lib/@LIB_NAME@.@SO_NAME@" "${SUDO}" cp "$SCRIPT_DIR/govarnam.pc" "@INSTALL_PREFIX@/lib/pkgconfig/" "${SUDO}" mkdir -p "@INSTALL_PREFIX@/include/libgovarnam" From cd948af2dd09b7feb64f17d8241bad8f4600f421 Mon Sep 17 00:00:00 2001 From: Anoop S <40671157+anoop142@users.noreply.github.com> Date: Sun, 5 Nov 2023 23:20:58 +0530 Subject: [PATCH 2/3] Uninstall (#40) * uninstall: force delete uninstall script fails midway if dirs/files didn't exist don't exit if rmdir fails. * Makefile: add uninstall * Makefile: typo --- Makefile | 6 ++++++ install.sh.in | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0dec064..e990653 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,12 @@ install-script: install: ./install.sh install +.PHONY: uninstall +uninstall: install-script + ./install.sh uninstall + + + .PHONY: cli cli: go build -o ${CLI_BIN} -ldflags "-s -w" ./cli diff --git a/install.sh.in b/install.sh.in index 49b40c7..02f2041 100755 --- a/install.sh.in +++ b/install.sh.in @@ -28,11 +28,11 @@ if [ "$ARG1" == "install" ]; then notify-send "$msg" &> /dev/null || true elif [ "$ARG1" == "uninstall" ]; then - "${SUDO}" rm "@INSTALL_PREFIX@/bin/varnamcli" "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "@INSTALL_PREFIX@/lib/@LIB_NAME@" "@INSTALL_PREFIX@/lib/pkgconfig/govarnam.pc" - "${SUDO}" rm "@INSTALL_PREFIX@/include/libgovarnam/"* - "${SUDO}" rmdir "@INSTALL_PREFIX@/include/libgovarnam" - "${SUDO}" rm "@INSTALL_PREFIX@/share/varnam/schemes/"* - "${SUDO}" rmdir "@INSTALL_PREFIX@/share/varnam/schemes/" + "${SUDO}" rm -f "@INSTALL_PREFIX@/bin/varnamcli" "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "@INSTALL_PREFIX@/lib/@LIB_NAME@" "@INSTALL_PREFIX@/lib/pkgconfig/govarnam.pc" + "${SUDO}" rm -f "@INSTALL_PREFIX@/include/libgovarnam/"* + "${SUDO}" rmdir "@INSTALL_PREFIX@/include/libgovarnam" || true + "${SUDO}" rm -f "@INSTALL_PREFIX@/share/varnam/schemes/"* + "${SUDO}" rmdir "@INSTALL_PREFIX@/share/varnam/schemes/" || true msg="Uninstallation finished" echo $msg From 63339ee3d8ed556b602e3ab8797e1d32d5c053f2 Mon Sep 17 00:00:00 2001 From: Anoop S <40671157+anoop142@users.noreply.github.com> Date: Sun, 5 Nov 2023 23:21:15 +0530 Subject: [PATCH 3/3] Makefile: update clean (#41) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e990653..051dbb6 100644 --- a/Makefile +++ b/Makefile @@ -113,4 +113,4 @@ test: .PHONY: clean clean: - rm -f varnamcli libgovarnam.so libgovarnam.h govarnam.pc + rm -f varnamcli libgovarnam.* govarnam.pc install.sh