From ec402c3c4a991f564907ad3892a9b18fcc0c9e24 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Mon, 29 Jul 2019 12:45:38 +0200 Subject: [PATCH] reference idris_net library as idris_net.so for all OSes --- libs/network/Makefile | 20 +++++++------------- libs/network/Network/Socket/Data.idr | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/libs/network/Makefile b/libs/network/Makefile index 9ed11cc..33e1b6a 100644 --- a/libs/network/Makefile +++ b/libs/network/Makefile @@ -14,16 +14,7 @@ else OS :=unix endif -ifeq ($(OS),darwin) - SHLIB_SUFFIX :=.dylib - LIBFLAGS :=-dynamiclib -else ifeq ($(OS),windows) - SHLIB_SUFFIX :=.DLL - LIBFLAGS :=-shared -else - SHLIB_SUFFIX :=.so - LIBFLAGS :=-shared -endif +SHLIB_SUFFIX :=.so LIBNAME=idris_net OBJS = $(LIBNAME).o @@ -35,7 +26,7 @@ ifneq ($(OS), windows) CFLAGS += -fPIC endif -DYLIBTARGET = lib$(LIBNAME)$(SHLIB_SUFFIX) +DYLIBTARGET = $(LIBNAME)$(SHLIB_SUFFIX) LIBTARGET = $(LIBNAME).a TARGET=${HOME}/.idris2 @@ -48,16 +39,19 @@ $(DYLIBTARGET) : $(OBJS) $(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS) install: + @if [ -z "${IDRIS2}" ]; then echo 'variable $$IDRIS2 is not set, aborting'; exit 1; fi ${IDRIS2} --install network.ipkg - install $(DYLIBTARGET) $(HDRS) $(TARGET)/idris2/network + @if ! [ -d $(TARGET)/idris2/network/lib ]; then mkdir $(TARGET)/idris2/network/lib; fi + install $(DYLIBTARGET) $(HDRS) $(TARGET)/idris2/network/lib clean : rm -rf $(OBJS) $(LIBTARGET) $(DYLIBTARGET) build test: build test.c + cp $(DYLIBTARGET) lib$(DYLIBTARGET) # to make C linker happy $(CC) -o network-tests -L. -I. -l$(LIBNAME) test.c LD_LIBRARY_PATH=. ./network-tests - LD_LIBRARY_PATH=. ./lib-tests + ./lib-tests $(OBJS): $(HDRS) diff --git a/libs/network/Network/Socket/Data.idr b/libs/network/Network/Socket/Data.idr index 4070f83..70c4f1f 100644 --- a/libs/network/Network/Socket/Data.idr +++ b/libs/network/Network/Socket/Data.idr @@ -11,7 +11,7 @@ import Data.Strings -- ------------------------------------------------------------ [ Type Aliases ] -- FIXME should be generic name with OS-dependent suffix -%cg chez "libidris_net.dylib" +%cg chez "libidris_net.so" public export ByteLength : Type