diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-08-23 04:13:15 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-08-23 04:51:55 +0200 |
commit | ee9cf43587d5fef3a0f6d97ef50b8cf848945bcb (patch) | |
tree | 4e4bb285120f56c65292dfc9ae33d126bf06ad8e /contrib/scintilla.am | |
parent | e2c7c11066739cf1141f1d47dc3789a5e82eb9cd (diff) | |
download | sciteco-ee9cf43587d5fef3a0f6d97ef50b8cf848945bcb.tar.gz |
fully support out of tree builds
* You no longer have to copy contrib/scintilla, contrib/scinterm and contrib/lexilla
manually to the build directory.
* It turns out, that Scintilla/Lexilla was supporting this since 2016.
Scintilla allows pointing to a source directory (srdir) and Lexilla to a binary directory (DIR_O).
* For Scinterm I opened a pull request in order to add srcdir/basedir variables:
https://github.com/orbitalquark/scinterm/pull/21
* `make distcheck` is therefore now also fixed.
* The FreeBSD package is now allowed to build out of source.
I haven't tested it yet.
* See also https://github.com/ScintillaOrg/lexilla/issues/266
Diffstat (limited to 'contrib/scintilla.am')
-rw-r--r-- | contrib/scintilla.am | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/contrib/scintilla.am b/contrib/scintilla.am index 55511b0..9ba728b 100644 --- a/contrib/scintilla.am +++ b/contrib/scintilla.am @@ -1,33 +1,32 @@ # We use the existing Scintilla/Lexilla Makefile build system to # avoid redundancies and maintainance overhead. # These build systems produce static libraries (*.a). -# This however has two diadvantages: -# 1.) Out-of-tree builds are not straight forward and require -# manually cloning the submodules into the build system. -# `make distcheck` is consequently also broken. -# Lexilla already has DIR_O, that could be used for proper -# out of tree builds, but Scintilla is still lacking it. -# 2.) We cannot add plain static libraries to libtool convenience -# libraries using LIBADD. -# Therefore, we cannot wrap Scintilla and Lexilla into a convenience -# library. -# That's why this file must instead be included everywhere where -# scintilla.a and liblexilla.a are referenced and they must be added -# to programs using LDADD. +# This however has the following disadvantages: +# +# * We cannot add plain static libraries to libtool convenience +# libraries using LIBADD. +# Therefore, we cannot wrap Scintilla and Lexilla into a convenience +# library. +# That's why this file must instead be included everywhere where +# scintilla.a and liblexilla.a are referenced and they must be added +# to programs using LDADD. + +LIBSCINTILLA = @abs_top_builddir@/contrib/scintilla/bin/scintilla.a if INTERFACE_GTK -MAKE_SCINTILLA = $(MAKE) -C @SCINTILLA_PATH@/gtk \ +MAKE_SCINTILLA = $(MAKE) -C @top_builddir@/contrib/scintilla/bin \ + -f @SCINTILLA_PATH@/gtk/makefile \ + srcdir=@SCINTILLA_PATH@/gtk \ + COMPLIB=$(LIBSCINTILLA) \ GTK3=yes CONFIGFLAGS='@LIBGTK_CFLAGS@' \ CXXFLAGS='@SCINTILLA_CXXFLAGS@' else -# NOTE: The VPATH hack allows us to keep Scinterm separate from -# the Scintilla repo and avoid using recursive submodules. -# -# FIXME: There is currently no way to override the standard optimization -# flags of Scinterm, so we pass them in CURSES_FLAGS. -MAKE_SCINTILLA = $(MAKE) -C @SCINTILLA_PATH@/bin -f @SCINTERM_PATH@/Makefile \ - VPATH=@SCINTERM_PATH@ \ - CURSES_FLAGS='@PDCURSES_CFLAGS@ @XCURSES_CFLAGS@ @NCURSES_CFLAGS@ @SCINTILLA_CXXFLAGS@' +MAKE_SCINTILLA = $(MAKE) -C @top_builddir@/contrib/scintilla/bin \ + -f @SCINTERM_PATH@/Makefile \ + srcdir=@SCINTERM_PATH@ basedir=@SCINTILLA_PATH@ \ + scintilla=$(LIBSCINTILLA) \ + CXXFLAGS='@SCINTILLA_CXXFLAGS@' \ + CURSES_FLAGS='@PDCURSES_CFLAGS@ @XCURSES_CFLAGS@ @NCURSES_CFLAGS@' endif # Pass toolchain configuration to Scintilla. @@ -40,21 +39,33 @@ MAKE_SCINTILLA += CC='@CC@' CXX='@CXX@' \ # If it's up to date, the additional recursive # make call does not hurt. .PHONY: make-scintilla +# FIXME: deps.mak cannot be generated when building out-of-tree. +# Also this would draw in a Python dependency. +# It needs to be removed in clean-local-scintilla to appease `make distcheck`. make-scintilla: - $(MAKE_SCINTILLA) ../bin/scintilla.a + mkdir -p @top_builddir@/contrib/scintilla/bin + touch @top_builddir@/contrib/scintilla/bin/deps.mak + $(MAKE_SCINTILLA) $(LIBSCINTILLA) # scintilla.a itself is not phony. # This avoids unnecessary relinking if it is # up to date. # Also note the ; which defines this recipe as # empty. -@SCINTILLA_PATH@/bin/scintilla.a : make-scintilla; +$(LIBSCINTILLA) : make-scintilla; .PHONY: clean-local-scintilla clean-local-scintilla: + mkdir -p @top_builddir@/contrib/scintilla/bin $(MAKE_SCINTILLA) clean + test "@abs_top_srcdir" = "@abs_top_builddir@" || \ + $(RM) -f @top_builddir@/contrib/scintilla/bin/deps.mak + +LIBLEXILLA = @abs_top_builddir@/contrib/lexilla/bin/liblexilla.a MAKE_LEXILLA = $(MAKE) -C @LEXILLA_PATH@/src \ + DIR_O=@abs_top_builddir@/contrib/lexilla/bin \ + DIR_BIN=@abs_top_builddir@/contrib/lexilla/bin \ SCINTILLA_INCLUDE=@SCINTILLA_PATH@/include \ CXXFLAGS='@SCINTILLA_CXXFLAGS@' \ CC='@CC@' CXX='@CXX@' \ @@ -68,12 +79,14 @@ MAKE_LEXILLA += BASE_FLAGS='' .PHONY: make-lexilla make-lexilla: - $(MAKE_LEXILLA) ../bin/liblexilla.a + mkdir -p @top_builddir@/contrib/lexilla/bin + $(MAKE_LEXILLA) $(LIBLEXILLA) -@LEXILLA_PATH@/bin/liblexilla.a : make-lexilla; +$(LIBLEXILLA) : make-lexilla; .PHONY: clean-local-lexilla clean-local-lexilla: + mkdir -p @top_builddir@/contrib/lexilla/bin $(MAKE_LEXILLA) clean # NOTE: using a separate `clean-local-scintilla` |