void-packages/srcpkgs/mongoose/patches/add-makefile.patch
Đoàn Trần Công Danh 765e304c4b srcpkgs/m*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

50 lines
1.1 KiB
Diff

--- /dev/null
+++ b/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
+