void-packages/srcpkgs/Brainfunk/patches/deharcode-compiler.patch
Đoàn Trần Công Danh ec4c2d75fa srcpkgs/[A-Z]*: 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

48 lines
1.2 KiB
Diff

--- a/Makefile 2018-11-04 13:26:07.744752852 -0700
+++ b/Makefile 2018-11-04 13:27:46.074222441 -0700
@@ -1,25 +1,26 @@
-CFLAGS=-O3 --std=gnu++11
-LFLAGS=-s -lpng
+CFLAGS+= -O3 --std=gnu++11
+LFLAGS+= -s -lpng
SRCD = source
SRC = $(wildcard $(SRCD)/*.cpp)
OBJD = obj
OBJ = $(patsubst $(SRCD)/%.cpp,$(OBJD)/%.o,$(SRC))
TSTD = tests
-INSTALL_PATH=/usr/local
+PREFIX?=/usr/local
+target=$(DESTDIR)$(PREFIX)
$(shell mkdir -p $(OBJD) >/dev/null)
bfk: $(OBJD) $(OBJ)
@echo Linking: $@
- @g++ -o bfk $(OBJ) $(LFLAGS)
+ @$(CXX) -o bfk $(OBJ) $(LFLAGS)
$(OBJD)/%.o: $(SRCD)/%.cpp
@echo Compiling: $(<F)
- @g++ $(CFLAGS) -c -o $@ $<
+ @$(CXX) $(CFLAGS) -c -o $@ $<
$(OBJD)/%.d: $(SRCD)/%.cpp
@set -e; rm -f $@; \
- g++ --std=gnu++11 -MM -MT $(OBJD)/$(*F).o $(CPPFLAGS) $< > $@.$$$$; \
+ $(CXX) --std=gnu++11 -MM -MT $(OBJD)/$(*F).o $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
@@ -34,10 +35,10 @@
@$(MAKE) --silent -C $(TSTD)/ clean
install: bfk
- @install -m 0755 bfk $(INSTALL_PATH)/bin/
+ @install -m 0755 bfk $(target)/bin
remove:
- @rm -fv $(INSTALL_PATH)/bin/bfk
+ @rm -fv $(target)/bin/bfk
test: bfk
@sync bfk