# HG changeset patch # User Matti Hamalainen # Date 1690895878 -10800 # Node ID a01c82b8b7d28cc8adaf8b749f57a2bf67842ab4 # Parent 0b909a95d68957b2a9c013d69b3a90ac731d0291 Clean up the maps build process. diff -r 0b909a95d689 -r a01c82b8b7d2 world/Makefile --- a/world/Makefile Tue Jul 25 18:34:49 2023 +0300 +++ b/world/Makefile Tue Aug 01 16:17:58 2023 +0300 @@ -7,6 +7,7 @@ HAVE_CURL ?= $(shell curl --version > /dev/null 2>&1 && echo "yes") HAVE_WGET ?= $(shell wget --version > /dev/null 2>&1 && echo "yes") HAVE_PHP ?= $(shell php --version > /dev/null 2>&1 && echo "yes") +HAVE_GIMP_CONSOLE ?= $(shell gimp-console --version > /dev/null 2>&1 && echo "yes") ifeq ($(HAVE_CURL),yes) HTTPGET ?= curl -o @@ -100,12 +101,6 @@ $(RSCP) $? $(UPLOAD_URL) @touch $@ -# Open PNG files in Gimp -gimp: $(addsuffix .png,$(WORLD_MAPS)) - -@ls -lt $+ gimp - @gimp $+ && touch $@ - -@ls -lt $+ gimp - # Upload only *.loc files uploc: $(LOCFILES) $(EXTRA_UPLOAD) $(RSCP) $+ $(UPLOAD_URL) diff -r 0b909a95d689 -r a01c82b8b7d2 world/Makefile.inc --- a/world/Makefile.inc Tue Jul 25 18:34:49 2023 +0300 +++ b/world/Makefile.inc Tue Aug 01 16:17:58 2023 +0300 @@ -13,49 +13,73 @@ ### ### Intermediate file targets ### -%.tmp: %.map %.loc $(MKLOC_BIN) - $(MKLOC_BIN) -v -o $@ -m $< -l $(patsubst %.map,%.loc,$<) +%.tmp1: %.map %.loc $(MKLOC_BIN) + @echo "MKLOC $@" + @$(MKLOC_BIN) $(MKLOC_OPTS) -o $@ -m $< -l $(patsubst %.map,%.loc,$<) %.tmp2: %.map %.loc $(MKLOC_BIN) - $(MKLOC_BIN) -v -N -o $@ -m $< -l $(patsubst %.map,%.loc,$<) + @echo "MKLOC $@" + @$(MKLOC_BIN) $(MKLOC_OPTS) -N -o $@ -m $< -l $(patsubst %.map,%.loc,$<) %.tmp3: %.loc $(MKLOC_BIN) - $(MKLOC_BIN) -v -M -l $< -o $@ + @echo "MKLOC $@" + @$(MKLOC_BIN) $(MKLOC_OPTS) -M -l $< -o $@ + ### ### HTML format maps ### - -%.htm: %.tmp %.desc $(COLORMAP_BIN) - $(COLORMAP_BIN) $(COLORMAP_OPTS) $(COLORMAP_HTML) $(COLORMAP_EXTRA) -t "`cat $(patsubst %.tmp,%.desc,$<)`" -o $@ $< +%.htm: %.tmp1 %.desc $(COLORMAP_BIN) + @echo "COLORMAP $@" + @$(COLORMAP_BIN) $(COLORMAP_OPTS) $(COLORMAP_HTML) $(COLORMAP_EXTRA) -t "`cat $(patsubst %.tmp1,%.desc,$<)`" -o $@ $< %.html: %.tmp2 %.desc %.tmp3 $(COLORMAP_BIN) - $(COLORMAP_BIN) $(COLORMAP_OPTS) -J $(COLORMAP_HTML) -P $(COLORMAP_EXTRA) -t "`cat $(patsubst %.tmp2,%.desc,$<)`" $< | \ + @echo "COLORMAP $@" + @$(COLORMAP_BIN) $(COLORMAP_OPTS) -J $(COLORMAP_HTML) -P $(COLORMAP_EXTRA) -t "`cat $(patsubst %.tmp2,%.desc,$<)`" $< | \ sed -e "/@LOCATIONS@/r $(patsubst %.tmp2,%.tmp3,$<)" -e "s/@LOCATIONS@//g" > $@ ### ### ANSI text ### -%.ansi: %.tmp %.desc $(COLORMAP_BIN) - $(COLORMAP_BIN) $(COLORMAP_OPTS) $(COLORMAP_EXTRA) -f ansi -t "`cat $(patsubst %.tmp,%.desc,$<)`" -o $@ $< +%.ansi: %.tmp1 %.desc $(COLORMAP_BIN) + @echo "COLORMAP $@" + @$(COLORMAP_BIN) $(COLORMAP_OPTS) $(COLORMAP_EXTRA) -f ansi -t "`cat $(patsubst %.tmp1,%.desc,$<)`" -o $@ $< ### ### PNG images ### -%.script: %.map %.loc title.png $(MAP_FONT) - $(MKLOC_BIN) -S -m $< -l $(patsubst %.map,%.loc,$<) -f $(MAP_FONT_SCALE) -u $(MAP_UNIT_SIZE) -s $(MAP_SCALE) | \ +%.script: %.map %.loc title.png $(MAP_FONT) $(MKLOC_BIN) + @echo "MKLOC $@" + @$(MKLOC_BIN) $(MKLOC_OPTS) -S -m $< -l $(patsubst %.map,%.loc,$<) -f $(MAP_FONT_SCALE) -u $(MAP_UNIT_SIZE) -s $(MAP_SCALE) | \ sed -e "s/@OPTS_START@/-font $(MAP_FONT) -pointsize 14 -type TruecolorMatte/g" \ -e "s/@OPTS_END@/\t-geometry +0+0 title.png -composite -compose screen \\\\\n\t-pointsize 20 -fill white -box none -draw \"text 5,50 \'@PAF@\n\n\n/g" | \ sed -e "/@PAF@/r $(patsubst %.map,%.desc,$<)" -e "s/@PAF@//g" > $@ %.ppm: %.map - $(MAP2PPM_BIN) -s $(MAP_SCALE) $(COLORMAP_EXTRA) $< -o $@ + @echo "MAP2PPM $@" + @$(MAP2PPM_BIN) $(MAP2PPM_OPTS) -s $(MAP_SCALE) $(COLORMAP_EXTRA) $< -o $@ + +ifeq ($(HAVE_GIMP_CONSOLE),yes) +%_rgb.png: %.ppm %.script %.desc + @echo "PNG $@" + @/bin/sh $(patsubst %.ppm,%.script,$<) $< $@ +%.png: %_rgb.png + @echo "GIMP $@" + @gimp-console -c -d -i -b \ + "(let* ( \ + (img (car (file-png-load RUN-NONINTERACTIVE \"$<\" \"$<\"))) \ + (drawable (car (gimp-image-active-drawable img)))) \ + (gimp-convert-indexed img NO-DITHER MAKE-PALETTE 64 FALSE FALSE \"\") \ + (file-png-save2 RUN-NONINTERACTIVE img drawable \"$@\" \"$@\" 0 9 0 0 0 0 0 0 0))" \ + -b '(gimp-quit 0)' +else %.png: %.ppm %.script %.desc - /bin/sh $(patsubst %.ppm,%.script,$<) $< $@ - + @echo "PNG $@" + @/bin/sh $(patsubst %.ppm,%.script,$<) $< $@ +endif ### ### Diff target between .map file and .new file. Makes necessary changes in .map and .loc diff -r 0b909a95d689 -r a01c82b8b7d2 world/config.mak --- a/world/config.mak Tue Jul 25 18:34:49 2023 +0300 +++ b/world/config.mak Tue Aug 01 16:17:58 2023 +0300 @@ -2,8 +2,10 @@ ### Settings ### -#COLORMAP_OPTS=-u "../www/urchin.inc.php" -v -a -C -COLORMAP_OPTS=-v -a -C +MKLOC_OPTS= +MAP2PPM_OPTS= +#COLORMAP_OPTS=-u "../www/urchin.inc.php" -a -C +COLORMAP_OPTS=-a -C MAP_FONT=MonospaceBold.ttf MAP_FONT_SCALE=8.0