Skip to content

Commit

Permalink
Merge branch 'master' into destdir
Browse files Browse the repository at this point in the history
  • Loading branch information
subins2000 authored Nov 5, 2023
2 parents 3d03f4e + 63339ee commit 4db8ee8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,18 @@ 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:
./install.sh install

.PHONY: uninstall
uninstall: install-script
./install.sh uninstall



.PHONY: cli
cli:
go build -o ${CLI_BIN} -ldflags "-s -w" ./cli
Expand All @@ -60,6 +67,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
Expand Down Expand Up @@ -105,4 +113,4 @@ test:

.PHONY: clean
clean:
rm -f varnamcli libgovarnam.so libgovarnam.h govarnam.pc
rm -f varnamcli libgovarnam.* govarnam.pc install.sh
15 changes: 8 additions & 7 deletions install.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ SUDO=${SUDO:-sudo}
if [ "$ARG1" == "install" ]; then
"${SUDO}" mkdir -p "/usr/local/bin/"
"${SUDO}" cp "$SCRIPT_DIR/varnamcli" "${DESTDIR}@INSTALL_PREFIX@/bin/varnamcli"

"${SUDO}" mkdir -p "${DESTDIR}@INSTALL_PREFIX@/lib/pkgconfig"
"${SUDO}" cp "$SCRIPT_DIR/@LIB_NAME@" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@"
"${SUDO}" ln -s "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@"
"${SUDO}" ln -sf "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@"
"${SUDO}" ln -sf "@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@.@SO_NAME@"
"${SUDO}" cp "$SCRIPT_DIR/govarnam.pc" "${DESTDIR}@INSTALL_PREFIX@/lib/pkgconfig/"

"${SUDO}" mkdir -p "${DESTDIR}@INSTALL_PREFIX@/include/libgovarnam"
Expand All @@ -27,11 +28,11 @@ if [ "$ARG1" == "install" ]; then

notify-send "$msg" &> /dev/null || true
elif [ "$ARG1" == "uninstall" ]; then
"${SUDO}" rm "${DESTDIR}@INSTALL_PREFIX@/bin/varnamcli" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@" "${DESTDIR}@INSTALL_PREFIX@/lib/pkgconfig/govarnam.pc"
"${SUDO}" rm "${DESTDIR}@INSTALL_PREFIX@/include/libgovarnam/"*
"${SUDO}" rmdir "${DESTDIR}@INSTALL_PREFIX@/include/libgovarnam"
"${SUDO}" rm "${DESTDIR}@INSTALL_PREFIX@/share/varnam/schemes/"*
"${SUDO}" rmdir "${DESTDIR}@INSTALL_PREFIX@/share/varnam/schemes/"
"${SUDO}" rm -f "${DESTDIR}@INSTALL_PREFIX@/bin/varnamcli" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@.@VERSION@" "${DESTDIR}@INSTALL_PREFIX@/lib/@LIB_NAME@" "${DESTDIR}@INSTALL_PREFIX@/lib/pkgconfig/govarnam.pc"
"${SUDO}" rm -f "${DESTDIR}@INSTALL_PREFIX@/include/libgovarnam/"*
"${SUDO}" rmdir "${DESTDIR}@INSTALL_PREFIX@/include/libgovarnam" || true
"${SUDO}" rm -f "${DESTDIR}@INSTALL_PREFIX@/share/varnam/schemes/"*
"${SUDO}" rmdir "${DESTDIR}@INSTALL_PREFIX@/share/varnam/schemes/" || true

msg="Uninstallation finished"
echo $msg
Expand Down

0 comments on commit 4db8ee8

Please sign in to comment.