void-packages/srcpkgs/mongoose/patches/add-makefile.patch

51 lines
1.1 KiB
Diff

--- /dev/null
+++ Makefile
@@ -0,0 +1,47 @@
+PROG = mongoose
+LIB = lib$(PROG).so.0
+
+ifndef PREFIX
+ PREFIX=/usr/local
+endif
+
+ifndef DOCDIR
+ DOCDIR=$(PREFIX)/share/$(PROG)/doc
+endif
+
+CPPFLAGS+=-DMONGOOSE_ENABLE_THREADS -DMG_ENABLE_SSL
+CFLAGS+=-fPIC -c -Wall
+LDFLAGS+=-shared -lssl -pthread -lcrypto
+
+SRCS=mongoose.c
+OBJS=mongoose.o
+INCLUDE=.
+
+all: $(LIB)
+
+$(LIB): $(OBJS)
+ $(CC) $(OBJS) $(LDFLAGS) -o $(LIB)
+
+$(OBJS): $(SRCS)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -I$(INCLUDE) $(SRCS) -o $(OBJS)
+
+install:
+ install -d $(DESTDIR)$(PREFIX)/include
+ install -m644 mongoose.h $(DESTDIR)$(PREFIX)/include
+ install -d $(DESTDIR)$(PREFIX)/lib
+ ln -sf $(LIB) $(LIB).0; cp -a $(LIB).0 $(DESTDIR)$(PREFIX)/lib
+ ln -sf $(LIB) libmongoose.so; cp -a libmongoose.so $(DESTDIR)$(PREFIX)/lib
+ install -m755 $(LIB) $(DESTDIR)$(PREFIX)/lib
+ install -dm755 $(DESTDIR)$(DOCDIR)
+ cp -a examples $(DESTDIR)$(DOCDIR)
+ cp -a docs/* $(DESTDIR)$(DOCDIR)/
+
+
+test:
+ $(MAKE) -C test/
+clean:
+ rm -f $(OBJS) $(LIB)
+ $(MAKE) -C test/ clean
+
+.PHONY: clean test all
+