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] 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"