File libut-shared.patch of Package uthash

Index: b/libut/Makefile
===================================================================
--- a/libut/Makefile
+++ b/libut/Makefile
@@ -1,33 +1,37 @@
-OBJS=libut.a
-all: $(OBJS) 
+SOURCES = src/libut.c src/ringbuf.c src/utmm.c src/utvector.c
+HEADERS = include/libut.h include/ringbuf.h include/utarray.h include/uthash.h include/utlist.h include/utmm.h include/utringbuffer.h include/utstring.h include/utvector.h
+OBJS=$(SOURCES:.c=.o)
+all: libut.a libut.so.2.0.1
 INCDIR=./include
+LIBDIR=/usr/lib
 CFLAGS+=-I$(INCDIR)
-CFLAGS+=-Wall -Wextra
-CFLAGS+=-g
+CFLAGS+=-Wall -Wextra -Werror -fPIC
+CFLAGS+=$(OPTFLAGS)
 
-libut.a: libut.o utvector.o utmm.o ringbuf.o
+libut.a: $(OBJS)
 	ar r $@ $^
 
-libut.o: src/libut.c $(INCDIR)/libut.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
-
-utvector.o: src/utvector.c $(INCDIR)/utvector.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
-
-utmm.o: src/utmm.c $(INCDIR)/utmm.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
-
-ringbuf.o: src/ringbuf.c $(INCDIR)/ringbuf.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+libut.so.2.0.1: $(OBJS)
+	$(CC) $(CFLAGS) -shared -Wl,-soname,libut.so.2 $^ -o $@
 
 .PHONY: clean tests install
 
 clean:
-	rm -f $(OBJS) *.o
+	rm -f *.o *.a *.so*
 	make -C tests clean
 
 tests: libut.a
 	make -C tests 
 
-install: libut.a
-	cp $< /usr/local/lib
+install: libut.a libut.so.2.0.1
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+	mkdir -p $(DESTDIR)/usr/include
+	cp libut.a $(DESTDIR)$(LIBDIR)
+	cp libut.so.2.0.1 $(DESTDIR)$(LIBDIR)
+	ln -sf $(LIBDIR)/libut.so.2.0.1 $(DESTDIR)$(LIBDIR)/libut.so.2
+	ln -sf $(LIBDIR)/libut.so.2.0.1 $(DESTDIR)$(LIBDIR)/libut.so
+	cp ./include/*.h $(DESTDIR)/usr/include
+	sed -i -e "s|VERSION|2.0.1|" uthash.pc.in
+	sed -i -e "s|LIBDIR|$(LIBDIR)|" uthash.pc.in
+	cp uthash.pc.in $(DESTDIR)$(LIBDIR)/pkgconfig/uthash.pc
Index: b/libut/tests/Makefile
===================================================================
--- a/libut/tests/Makefile
+++ b/libut/tests/Makefile
@@ -3,8 +3,8 @@ PROGS=test1 test2 test3 test4 test5 test
 OBJS=$(patsubst %,%.o,$(PROGS))
 
 CFLAGS += -I../include
-CFLAGS += -g
-CFLAGS += -Wall -Wextra
+CFLAGS += -Wall -Wextra -Werror -fPIC
+CFLAGS += $(OPTFLAGS)
 LDFLAGS += -L.. -lut
 
 TEST_TARGET=run_tests
Index: b/libut/uthash.pc.in
===================================================================
--- /dev/null
+++ b/libut/uthash.pc.in
@@ -0,0 +1,9 @@
+prefix=/usr
+libdir=LIBDIR
+includedir=/usr/include
+
+Name: uthash
+Description: C macros for hash tables and more 
+Version: VERSION
+Libs: -L${libdir} -lut
+Cflags: -I${includedir}
openSUSE Build Service is sponsored by