Use pre-built flex and bison on Windows for MinGW

This commit is contained in:
Thomas Jensen 2021-03-31 21:12:34 +02:00
parent b01fdcecf5
commit e360bfde4e
No known key found for this signature in database
GPG Key ID: A4ACEE270D0FB7DB
4 changed files with 24 additions and 12 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@
/doc/boxes.1.raw.html
/doc/boxes.1.html
/pcre2-*/
/flex_bison_*/
/out/
*.o
*.a

View File

@ -30,6 +30,7 @@
"**/.github/**",
"**/_site/**",
"**/_support/**",
"**/flex_bison_*/**",
"**/pcre2-*/**"
],
"todo-tree.general.statusBar": "total",

View File

@ -28,29 +28,41 @@ DOC_FILES = doc/boxes.1 doc/boxes.el
PKG_NAME = boxes-$(BVERSION)
OUT_DIR = out
WIN_PCRE2_VERSION = 10.36
WIN_PCRE2_DIR = pcre2-$(WIN_PCRE2_VERSION)
WIN_PCRE2_VERSION = 10.36
WIN_PCRE2_DIR = pcre2-$(WIN_PCRE2_VERSION)
WIN_FLEX_BISON_VERSION = 2.5.24
WIN_FLEX_BISON_DIR = flex_bison_$(WIN_FLEX_BISON_VERSION)
.PHONY: clean build win32 debug win32.debug win32.pcre infomsg replaceinfos test package win32.package package_common
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
build debug: infomsg replaceinfos
$(MAKE) -C src BOXES_PLATFORM=unix $@
$(MAKE) -C src BOXES_PLATFORM=unix LEX=flex YACC=bison $@
win32: infomsg replaceinfos
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(WIN_PCRE2_DIR)/src LDFLAGS=-L../$(WIN_PCRE2_DIR)/.libs build
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(WIN_PCRE2_DIR)/src LDFLAGS=-L../$(WIN_PCRE2_DIR)/.libs \
LEX=../$(WIN_FLEX_BISON_DIR)/win_flex.exe YACC=../$(WIN_FLEX_BISON_DIR)/win_bison.exe build
win32.debug: infomsg replaceinfos
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(WIN_PCRE2_DIR)/src LDFLAGS=-L../$(WIN_PCRE2_DIR)/.libs debug
$(MAKE) -C src BOXES_PLATFORM=win32 C_INCLUDE_PATH=../$(WIN_PCRE2_DIR)/src LDFLAGS=-L../$(WIN_PCRE2_DIR)/.libs \
LEX=../$(WIN_FLEX_BISON_DIR)/win_flex.exe YACC=../$(WIN_FLEX_BISON_DIR)/win_bison.exe debug
win32.pcre:
# build the pcre2 dependency (only needed on Windows MinGW)
curl -LO https://ftp.pcre.org/pub/pcre/$(WIN_PCRE2_DIR).tar.gz
win32.prereq:
# download components
curl -LO https://ftp.pcre.org/pub/pcre/pcre2-$(WIN_PCRE2_VERSION).tar.gz
curl -LO https://downloads.sourceforge.net/project/winflexbison/win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip
# unpack components
tar xfz $(WIN_PCRE2_DIR).tar.gz
cd $(WIN_PCRE2_DIR)
./configure --disable-pcre2-8 --disable-pcre2-16 --enable-pcre2-32 --disable-shared --enable-never-backslash-C --enable-newline-is-anycrlf
unzip win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip -d $(WIN_FLEX_BISON_DIR)
# build the pcre2 dependency (only needed on Windows MinGW)
cd $(WIN_PCRE2_DIR) ; \
./configure --disable-pcre2-8 --disable-pcre2-16 --enable-pcre2-32 --disable-shared \
--enable-never-backslash-C --enable-newline-is-anycrlf ; \
$(MAKE)
# remove downloaded archives
rm pcre2-$(WIN_PCRE2_VERSION).tar.gz
rm win_flex_bison-$(WIN_FLEX_BISON_VERSION).zip
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -18,8 +18,6 @@
#============================================================================
LEX = flex
YACC = bison
CC = gcc
OUT_DIR = ../out