1999-08-14 01:45:34 +02:00
|
|
|
#
|
2019-02-15 21:24:31 +01:00
|
|
|
# boxes - Command line filter to draw/remove ASCII boxes around text
|
2023-03-26 21:32:08 +02:00
|
|
|
# Copyright (c) 1999-2023 Thomas Jensen and the boxes contributors
|
2019-02-15 21:24:31 +01:00
|
|
|
#
|
2022-09-18 14:56:30 +02:00
|
|
|
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
|
|
|
# License, version 3, as published by the Free Software Foundation.
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
# details.
|
|
|
|
# You should have received a copy of the GNU General Public License along with this program.
|
|
|
|
# If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#____________________________________________________________________________________________________________________
|
|
|
|
#====================================================================================================================
|
1999-08-14 01:45:34 +02:00
|
|
|
|
|
|
|
|
1999-08-22 13:43:55 +02:00
|
|
|
# The following line (GLOBALCONF) is the only line you should need to edit!
|
2006-07-23 18:50:09 +02:00
|
|
|
GLOBALCONF = /usr/share/boxes
|
2021-04-21 22:16:59 +02:00
|
|
|
GIT_STATUS = $(shell git describe --dirty --always 2>/dev/null || echo "n/a")
|
2022-09-20 22:12:05 +02:00
|
|
|
BVERSION = 2.2.0
|
1999-08-22 01:39:01 +02:00
|
|
|
|
2021-02-28 22:02:07 +01:00
|
|
|
ALL_FILES = LICENSE README.md boxes-config
|
2014-10-07 23:57:44 +02:00
|
|
|
DOC_FILES = doc/boxes.1 doc/boxes.el
|
|
|
|
PKG_NAME = boxes-$(BVERSION)
|
2021-02-28 22:02:07 +01:00
|
|
|
OUT_DIR = out
|
2014-10-07 23:57:44 +02:00
|
|
|
|
2022-09-23 22:06:47 +02:00
|
|
|
PCRE2_VERSION = 10.40
|
|
|
|
PCRE2_DIR = vendor/pcre2-$(PCRE2_VERSION)
|
|
|
|
LIBUNISTRING_VERSION = 1.0
|
|
|
|
LIBUNISTRING_DIR = vendor/libunistring-$(LIBUNISTRING_VERSION)
|
2023-05-08 21:12:00 +02:00
|
|
|
LIBNCURSES_VERSION = 6.4
|
|
|
|
LIBNCURSES_DIR = vendor/ncurses-$(LIBNCURSES_VERSION)
|
2021-03-31 21:12:34 +02:00
|
|
|
WIN_FLEX_BISON_VERSION = 2.5.24
|
2021-11-01 14:18:50 +01:00
|
|
|
WIN_FLEX_BISON_DIR = vendor/flex_bison_$(WIN_FLEX_BISON_VERSION)
|
2021-10-20 22:28:34 +02:00
|
|
|
WIN_CMOCKA_VERSION = 1.1.0
|
2021-11-01 14:18:50 +01:00
|
|
|
WIN_CMOCKA_DIR = vendor/cmocka-$(WIN_CMOCKA_VERSION)
|
2021-02-12 21:11:45 +01:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
.PHONY: clean build cov win32 debug win32.debug win32.pcre infomsg replaceinfos test covtest \
|
2022-09-23 22:06:47 +02:00
|
|
|
package win32.package package_common utest win32.utest static
|
2014-10-07 23:57:44 +02:00
|
|
|
|
1999-08-22 01:39:01 +02:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Build
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
|
|
build cov debug: infomsg replaceinfos
|
2021-03-31 21:12:34 +02:00
|
|
|
$(MAKE) -C src BOXES_PLATFORM=unix LEX=flex YACC=bison $@
|
1999-08-14 01:45:34 +02:00
|
|
|
|
2014-10-07 23:57:44 +02:00
|
|
|
win32: infomsg replaceinfos
|
2022-09-23 22:06:47 +02:00
|
|
|
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
|
2021-03-31 21:12:34 +02:00
|
|
|
LEX=../$(WIN_FLEX_BISON_DIR)/win_flex.exe YACC=../$(WIN_FLEX_BISON_DIR)/win_bison.exe build
|
1999-08-14 01:45:34 +02:00
|
|
|
|
2014-10-07 23:57:44 +02:00
|
|
|
win32.debug: infomsg replaceinfos
|
2022-09-23 22:06:47 +02:00
|
|
|
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src LDFLAGS=-L../$(PCRE2_DIR)/.libs \
|
2021-03-31 21:12:34 +02:00
|
|
|
LEX=../$(WIN_FLEX_BISON_DIR)/win_flex.exe YACC=../$(WIN_FLEX_BISON_DIR)/win_bison.exe debug
|
|
|
|
|
2022-10-04 17:21:00 +02:00
|
|
|
win32.prereq: $(PCRE2_DIR)/.libs/libpcre2-32.a vendor/win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip \
|
|
|
|
vendor/cmocka-$(WIN_CMOCKA_VERSION)-mingw.zip
|
|
|
|
unzip -n vendor/win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip -d $(WIN_FLEX_BISON_DIR)
|
|
|
|
unzip -n vendor/cmocka-$(WIN_CMOCKA_VERSION)-mingw.zip -d vendor
|
|
|
|
|
|
|
|
vendor/win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip: | vendor
|
|
|
|
curl -L https://downloads.sourceforge.net/project/winflexbison/win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip --output $@
|
|
|
|
|
|
|
|
vendor/cmocka-$(WIN_CMOCKA_VERSION)-mingw.zip: | vendor
|
|
|
|
curl -L https://cmocka.org/files/$(WIN_CMOCKA_VERSION:%.0=%)/cmocka-$(WIN_CMOCKA_VERSION)-mingw.zip --output $@
|
|
|
|
|
|
|
|
vendor/pcre2-$(PCRE2_VERSION).tar.gz: | vendor
|
|
|
|
curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$(PCRE2_VERSION)/pcre2-$(PCRE2_VERSION).tar.gz --output $@
|
|
|
|
|
|
|
|
$(PCRE2_DIR)/.libs/libpcre2-32.a: vendor/pcre2-$(PCRE2_VERSION).tar.gz
|
|
|
|
tar -xzf vendor/pcre2-$(PCRE2_VERSION).tar.gz -C vendor
|
2022-09-23 22:06:47 +02:00
|
|
|
cd $(PCRE2_DIR) ; \
|
2022-10-04 17:21:00 +02:00
|
|
|
./configure --disable-pcre2-8 --disable-pcre2-16 --enable-pcre2-32 --enable-static --disable-shared \
|
|
|
|
--enable-never-backslash-C --enable-newline-is-anycrlf ; \
|
2021-02-12 21:11:45 +01:00
|
|
|
$(MAKE)
|
1999-08-14 01:45:34 +02:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
1999-08-22 01:39:01 +02:00
|
|
|
|
2014-10-07 23:57:44 +02:00
|
|
|
infomsg:
|
|
|
|
@echo "| For compilation info please refer to the boxes compilation FAQ"
|
2021-05-29 20:56:55 +02:00
|
|
|
@echo "| at https://boxes.thomasjensen.com/faq.html#q5"
|
2014-10-07 23:57:44 +02:00
|
|
|
|
2021-03-06 13:40:26 +01:00
|
|
|
$(OUT_DIR):
|
|
|
|
mkdir $(OUT_DIR)
|
2014-10-07 23:57:44 +02:00
|
|
|
|
2021-03-06 13:40:26 +01:00
|
|
|
replaceinfos: $(OUT_DIR)/boxes.h doc/boxes.1
|
|
|
|
|
|
|
|
$(OUT_DIR)/boxes.h: src/boxes.in.h Makefile | $(OUT_DIR)
|
2021-04-21 22:16:59 +02:00
|
|
|
$(eval VERSION_STRING := $(shell if [ "${GIT_STATUS}" = "n/a" ]; then echo "${BVERSION}"; else echo "${BVERSION} (${GIT_STATUS})"; fi))
|
|
|
|
sed -e 's/--BVERSION--/$(VERSION_STRING)/; s/--GLOBALCONF--/$(subst /,\/,$(GLOBALCONF))/' src/boxes.in.h > $(OUT_DIR)/boxes.h
|
1999-08-22 01:39:01 +02:00
|
|
|
|
|
|
|
doc/boxes.1: doc/boxes.1.in Makefile
|
|
|
|
sed -e 's/--BVERSION--/$(BVERSION)/; s/--GLOBALCONF--/$(subst /,\/,$(GLOBALCONF))/' doc/boxes.1.in > doc/boxes.1
|
|
|
|
|
2021-02-15 21:35:52 +01:00
|
|
|
doc/boxes.1.html: doc/boxes.1
|
|
|
|
cat doc/boxes.1 | groff -mandoc -Thtml > doc/boxes.1.raw.html
|
2021-05-29 20:56:55 +02:00
|
|
|
sed -E -e 's/<URL:([^&]+)>/<a href="\1">\1<\/a>/g' < doc/boxes.1.raw.html > doc/boxes.1.html
|
2021-02-15 21:35:52 +01:00
|
|
|
rm -f doc/boxes.1.raw.html
|
2021-02-28 22:02:07 +01:00
|
|
|
@echo "Conversion complete. Excessive manual work remains."
|
2021-02-15 21:35:52 +01:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
|
2022-09-23 22:06:47 +02:00
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Static Build (Unix)
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
|
|
vendor:
|
|
|
|
mkdir -p vendor
|
|
|
|
|
|
|
|
vendor/libunistring-$(LIBUNISTRING_VERSION).tar.gz: | vendor
|
|
|
|
curl -L https://ftp.gnu.org/gnu/libunistring/libunistring-$(LIBUNISTRING_VERSION).tar.gz --output $@
|
|
|
|
|
|
|
|
$(LIBUNISTRING_DIR)/lib/.libs/libunistring.a: vendor/libunistring-$(LIBUNISTRING_VERSION).tar.gz
|
|
|
|
tar -C vendor -xzf vendor/libunistring-$(LIBUNISTRING_VERSION).tar.gz
|
|
|
|
cd $(LIBUNISTRING_DIR) ; ./configure --enable-static ; $(MAKE)
|
|
|
|
|
2023-05-08 21:12:00 +02:00
|
|
|
vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz: | vendor
|
|
|
|
curl -L http://invisible-mirror.net/archives/ncurses/ncurses-$(LIBNCURSES_VERSION).tar.gz --output $@
|
|
|
|
|
|
|
|
$(LIBNCURSES_DIR)/lib/libncurses.a: vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz
|
|
|
|
tar -C vendor -xzf vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz
|
|
|
|
cd $(LIBNCURSES_DIR) ; ./configure --enable-static ; $(MAKE)
|
|
|
|
|
|
|
|
static: infomsg replaceinfos $(LIBUNISTRING_DIR)/lib/.libs/libunistring.a $(PCRE2_DIR)/.libs/libpcre2-32.a $(LIBNCURSES_DIR)/lib/libncurses.a
|
|
|
|
$(MAKE) -C src BOXES_PLATFORM=static LEX=flex YACC=bison LIBUNISTRING_DIR=$(LIBUNISTRING_DIR) PCRE2_DIR=$(PCRE2_DIR) LIBNCURSES_DIR=$(LIBNCURSES_DIR) $@
|
2022-09-23 22:06:47 +02:00
|
|
|
|
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Standalone Packaging (Unix / Windows)
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
1999-08-22 01:39:01 +02:00
|
|
|
|
2021-02-28 22:02:07 +01:00
|
|
|
$(OUT_DIR)/$(PKG_NAME).tar.gz:
|
|
|
|
mkdir -p $(OUT_DIR)/$(PKG_NAME)/doc
|
|
|
|
cp $(ALL_FILES) $(OUT_DIR)/$(PKG_NAME)/
|
|
|
|
cp $(DOC_FILES) $(OUT_DIR)/$(PKG_NAME)/doc/
|
|
|
|
$(MAKE) -C $(OUT_DIR) -f ../src/Makefile PKG_NAME=$(PKG_NAME) BOXES_PLATFORM=$(BOXES_PLATFORM) flags_$(BOXES_PLATFORM) package
|
|
|
|
if which gtar >/dev/null 2>&1 ; then cd $(OUT_DIR) ; gtar cfvz $(PKG_NAME).tar.gz $(PKG_NAME)/* ; \
|
|
|
|
else cd $(OUT_DIR) ; tar cfvz $(PKG_NAME).tar.gz $(PKG_NAME)/* ; fi
|
|
|
|
rm -rf $(OUT_DIR)/$(PKG_NAME)/
|
|
|
|
|
|
|
|
$(OUT_DIR)/zip/$(PKG_NAME).zip:
|
|
|
|
mkdir -p $(OUT_DIR)/zip/$(PKG_NAME)
|
|
|
|
unix2dos -n LICENSE $(OUT_DIR)/zip/$(PKG_NAME)/LICENSE.txt
|
|
|
|
unix2dos -n boxes-config $(OUT_DIR)/zip/$(PKG_NAME)/boxes.cfg
|
|
|
|
unix2dos -n README.md $(OUT_DIR)/zip/$(PKG_NAME)/README.md
|
|
|
|
unix2dos -n README.Win32.md $(OUT_DIR)/zip/$(PKG_NAME)/README.Win32.md
|
|
|
|
unix2dos -n doc/boxes.1 $(OUT_DIR)/zip/$(PKG_NAME)/boxes.1
|
|
|
|
unix2dos -n doc/boxes.1.html $(OUT_DIR)/zip/$(PKG_NAME)/boxes-man-1.html
|
|
|
|
cp -a $(OUT_DIR)/boxes.exe $(OUT_DIR)/zip/$(PKG_NAME)/
|
|
|
|
cd $(OUT_DIR)/zip ; zip $(PKG_NAME).zip $(PKG_NAME)/*
|
|
|
|
@echo Windows ZIP file created at $(OUT_DIR)/zip/$(PKG_NAME).zip
|
2014-10-07 23:57:44 +02:00
|
|
|
|
|
|
|
package: build
|
|
|
|
$(MAKE) BOXES_PLATFORM=unix $(PKG_NAME).tar.gz
|
|
|
|
|
2021-02-28 22:02:07 +01:00
|
|
|
win32.package: win32 $(OUT_DIR)/zip/$(PKG_NAME).zip
|
2014-10-07 23:57:44 +02:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Chocolatey Packaging (Windows)
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-03-28 21:57:56 +01:00
|
|
|
|
2019-04-04 11:22:00 +02:00
|
|
|
choco: tools/LICENSE.txt tools/boxes.cfg tools/boxes.exe
|
2019-03-28 21:57:56 +01:00
|
|
|
choco pack --version=$(BVERSION)
|
|
|
|
|
|
|
|
tools/LICENSE.txt: LICENSE
|
2021-02-18 21:35:20 +01:00
|
|
|
unix2dos -n LICENSE tools/LICENSE.txt
|
2019-03-28 21:57:56 +01:00
|
|
|
|
|
|
|
tools/boxes.cfg: boxes-config
|
2021-02-18 21:35:20 +01:00
|
|
|
unix2dos -n boxes-config tools/boxes.cfg
|
2019-03-28 21:57:56 +01:00
|
|
|
|
2021-03-06 13:40:26 +01:00
|
|
|
tools/boxes.exe: $(OUT_DIR)/boxes.exe
|
|
|
|
cp $(OUT_DIR)/boxes.exe tools/
|
2019-03-28 21:57:56 +01:00
|
|
|
|
2021-03-06 13:40:26 +01:00
|
|
|
$(OUT_DIR)/boxes.exe: win32
|
2019-03-28 21:57:56 +01:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Test
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
|
|
|
|
test:
|
|
|
|
cd test; ./testrunner.sh --suite
|
|
|
|
|
|
|
|
covtest:
|
|
|
|
cd test; ./testrunner.sh --suite --coverage
|
|
|
|
|
2021-10-20 22:28:34 +02:00
|
|
|
utest:
|
|
|
|
$(MAKE) -C utest BOXES_PLATFORM=unix utest
|
|
|
|
|
2021-11-01 14:18:50 +01:00
|
|
|
win32.utest: $(OUT_DIR)
|
2021-10-20 22:28:34 +02:00
|
|
|
cp $(WIN_CMOCKA_DIR)/bin/cmocka.dll $(OUT_DIR)/
|
2022-09-23 22:06:47 +02:00
|
|
|
$(MAKE) -C utest BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(PCRE2_DIR)/src:../$(WIN_CMOCKA_DIR)/include \
|
|
|
|
LDFLAGS_ADDTL="-L../$(PCRE2_DIR)/.libs -L../$(WIN_CMOCKA_DIR)/lib" utest
|
2021-09-09 21:44:49 +02:00
|
|
|
|
2022-09-17 16:02:42 +02:00
|
|
|
|
2021-09-09 21:44:49 +02:00
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Cleanup
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-07 23:57:44 +02:00
|
|
|
|
1999-08-22 01:39:01 +02:00
|
|
|
clean:
|
2021-03-06 13:40:26 +01:00
|
|
|
rm -f $(OUT_DIR)/boxes.h tools/boxes.cfg tools/LICENSE.txt tools/boxes.exe tools/README*.md boxes.portable.*.nupkg
|
2021-02-15 21:35:52 +01:00
|
|
|
rm -f doc/boxes.1 doc/boxes.1.raw.html doc/boxes.1.html
|
2022-10-04 17:21:00 +02:00
|
|
|
rm -rf vendor
|
1999-08-22 01:39:01 +02:00
|
|
|
$(MAKE) -C src clean
|
|
|
|
|
1999-08-14 01:45:34 +02:00
|
|
|
|
|
|
|
#EOF
|