From f57d643333c6309e92288e1140d451cd7f5c3838 Mon Sep 17 00:00:00 2001 From: Avril Date: Mon, 13 May 2019 00:21:33 +0100 Subject: [PATCH] more installation options --- Makefile | 17 ++++++++++++----- README | 18 +++++++++++++++--- libsipc/Makefile | 11 ++++++----- libsipc/src/{test.c => cli.c} | 0 4 files changed, 33 insertions(+), 13 deletions(-) rename libsipc/src/{test.c => cli.c} (100%) diff --git a/Makefile b/Makefile index 691f4ce..d5e7e34 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ - +HOME:=$(shell getent passwd `logname` | cut -d: -f6) +LOCAL_PROJECTS:=$(HOME)/quicklisp/local-projects ffi: cd libsipc && make libsipc-ffi @@ -7,8 +8,14 @@ clean: cd libsipc && make clean rm -f *.socket -install: ffi - cp -f libsipc.so /usr/lib/libsipc.so +install-ffi: + if [[ $(shell id -u) == 0 ]]; then cp -f libsipc.so /usr/lib/libsipc.so; fi + +install: ffi install-ffi + if [ -d "$(LOCAL_PROJECTS)" ]; then sudo -u `logname` ln -nsi "`pwd`" "$(LOCAL_PROJECTS)/cl-sipc"; fi + +uninstall-ffi: + if [[ $(shell id -u) == 0 ]]; then rm -f /usr/lib/libsipc.so; fi -uninstall: - rm -f /usr/lib/libsipc.so +uninstall: uninstall-ffi + if [ -L "$(LOCAL_PROJECTS)/cl-sipc" ] && [ "`readlink -f $(LOCAL_PROJECTS)/cl-sipc`" == "`pwd`" ]; then sudo -u `logname` rm -i $(LOCAL_PROJECTS)/cl-sipc; fi diff --git a/README b/README index 4feda54..53e6f37 100644 --- a/README +++ b/README @@ -3,10 +3,10 @@ cl-sipc (common lisp socket inter-process communication) Unix domain socket message passing for Common Lisp. Run `make' in this directory once to build the CFFI library. -Run `sudo make install' to install system-wide. - +Run `sudo make install-ffi' to install the ffi library system-wide. (`sudo make uninstall-ffi' to remove) + The symlinked libsipc.so will resolve after the ffi library is built and the package will work in this directory (the symlink is to libsipc/libsipc-ffi.so) -Additionally you can run `sudo make install' to make it work system-wide (installed to /usr/lib/libsipc.so) (`sudo make uninstall' to remove it) +Additionally you can run `sudo make install-ffi' to make it work system-wide (installed to /usr/lib/libsipc.so) (`sudo make uninstall' to remove it) Or you can copy/symlink libsipc/libsipc-ffi.so to wherever you need. Additional tools can be built by running `make all-ffi' in the libsipc/ directory. @@ -32,6 +32,18 @@ Functions: See `cl-sipc.lisp' for more documentation. +--- + +Other installation options + +Run `sudo make install' to install ffi library system-wide and attempt to symlink to ~/quicklisp/local-projects/cl-sipc (if it exists). Or run `sudo make install-ffi' to just install the library. (note: you can run `make install' without sudo, in which case it will just attempt to symlink and not install the library. the same is true for `make uninstall'.) + -> sudo make install ;; install ffi systemwide and symlink + -> make install ;; only symlink + -> sudo make install-ffi ;; insall only ffi + -> sudo make uninstall ;; uninstall ffi systemwide and remove symlink + -> make uninstall ;; only remove symlink + -> sudo make uninstall-ffi ;; only uninstall ffi + --- Example using sipcli (run `make all-ffi' in libsipc/ directory) diff --git a/libsipc/Makefile b/libsipc/Makefile index 190fe27..2064a00 100644 --- a/libsipc/Makefile +++ b/libsipc/Makefile @@ -1,7 +1,8 @@ TRANS:=src/sipc.c INCLUDE:=include/ -CFLAGS:= -c -Wall -fPIC -I$(INCLUDE) -STD:=--std=gnu11 +STD:=gnu11 +CFLAGS:= --std=$(STD) -Wall -pedantic -I$(INCLUDE) +LCFLAGS:= -c $(CFLAGS) -fPIC all: clean libsipc sipcli @@ -14,13 +15,13 @@ clean: rm -f *.socket libsipc: - gcc $(STD) $(CFLAGS) $(TRANS) + gcc $(LCFLAGS) $(TRANS) gcc -shared -o $@.so *.o libsipc-ffi: - gcc $(STD) $(CFLAGS) $(TRANS) src/ffi.c + gcc $(LCFLAGS) $(TRANS) src/ffi.c gcc -shared -o $@.so *.o sipcli: libsipc - gcc $(STD) -Wall -pedantic -I$(INCLUDE) -Wl,-rpath=./ src/test.c -o $@ -L./ -lsipc + gcc $(CFLAGS) -Wl,-rpath=./ src/cli.c -o $@ -L./ -lsipc ./$@ diff --git a/libsipc/src/test.c b/libsipc/src/cli.c similarity index 100% rename from libsipc/src/test.c rename to libsipc/src/cli.c