Skip to content

Commit

Permalink
Add support for including zlib in the shell when compiling with MSVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Mistachkin committed Dec 5, 2017
1 parent 1bfb593 commit 203349a
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 5 deletions.
1 change: 1 addition & 0 deletions .fossil-settings/empty-dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
compat
1 change: 1 addition & 0 deletions .fossil-settings/ignore-glob
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
compat/*
83 changes: 78 additions & 5 deletions Makefile.msc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ SPLIT_AMALGAMATION = 0
!ENDIF

# <<mark>>
# Set this non-0 to use zlib, possibly compiling it from source code.
#
!IFNDEF USE_ZLIB
USE_ZLIB = 0
!ENDIF

# Set this non-0 to build zlib from source code. This is enabled by
# default and in that case it will be assumed that the ZLIBDIR macro
# points to the top-level source code directory for zlib.
#
!IFNDEF BUILD_ZLIB
BUILD_ZLIB = 1
!ENDIF

# Set this non-0 to use the International Components for Unicode (ICU).
#
!IFNDEF USE_ICU
Expand Down Expand Up @@ -612,6 +626,14 @@ SHELL_CORE_DEP =
!ENDIF
!ENDIF

# <<mark>>
# If zlib support is enabled, add the shell dependency for it.
#
!IF $(USE_ZLIB)!=0 && $(BUILD_ZLIB)!=0
SHELL_CORE_DEP = zlib $(SHELL_CORE_DEP)
!ENDIF
# <</mark>>

# This is the core library that the shell executable should link with.
#
!IFNDEF SHELL_CORE_LIB
Expand Down Expand Up @@ -802,12 +824,16 @@ RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
# prior to running nmake in order to match the actual installed location and
# version on this machine.
#
!IFNDEF TCLDIR
TCLDIR = c:\tcl
!ENDIF

!IFNDEF TCLINCDIR
TCLINCDIR = c:\tcl\include
TCLINCDIR = $(TCLDIR)\include
!ENDIF

!IFNDEF TCLLIBDIR
TCLLIBDIR = c:\tcl\lib
TCLLIBDIR = $(TCLDIR)\lib
!ENDIF

!IFNDEF LIBTCL
Expand All @@ -819,20 +845,49 @@ LIBTCLSTUB = tclstub86.lib
!ENDIF

!IFNDEF LIBTCLPATH
LIBTCLPATH = c:\tcl\bin
LIBTCLPATH = $(TCLDIR)\bin
!ENDIF

# The locations of the zlib header and library files. These variables
# (ZLIBINCDIR, ZLIBLIBDIR, and ZLIBLIB) may be overridden via the environment
# prior to running nmake in order to match the actual installed (or source
# code) location on this machine.
#
!IFNDEF ZLIBDIR
ZLIBDIR = $(TOP)\compat\zlib
!ENDIF

!IFNDEF ZLIBINCDIR
ZLIBINCDIR = $(ZLIBDIR)
!ENDIF

!IFNDEF ZLIBLIBDIR
ZLIBLIBDIR = $(ZLIBDIR)
!ENDIF

!IFNDEF ZLIBLIB
!IF $(DYNAMIC_SHELL)!=0
ZLIBLIB = zdll.lib
!ELSE
ZLIBLIB = zlib.lib
!ENDIF
!ENDIF

# The locations of the ICU header and library files. These variables
# (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment
# prior to running nmake in order to match the actual installed location on
# this machine.
#
!IFNDEF ICUDIR
ICUDIR = C:\icu
!ENDIF

!IFNDEF ICUINCDIR
ICUINCDIR = c:\icu\include
ICUINCDIR = $(ICUDIR)\include
!ENDIF

!IFNDEF ICULIBDIR
ICULIBDIR = c:\icu\lib
ICULIBDIR = $(ICUDIR)\lib
!ENDIF

!IFNDEF LIBICU
Expand Down Expand Up @@ -951,6 +1006,15 @@ BCC = $(BCC) -Zi
!ENDIF

# <<mark>>
# If zlib support is enabled, add the compiler options for it.
#
!IF $(USE_ZLIB)!=0
TCC = $(TCC) -DSQLITE_HAVE_ZLIB=1
RCC = $(RCC) -DSQLITE_HAVE_ZLIB=1
TCC = $(TCC) -I$(ZLIBINCDIR)
RCC = $(RCC) -I$(ZLIBINCDIR)
!ENDIF

# If ICU support is enabled, add the compiler options for it.
#
!IF $(USE_ICU)!=0
Expand Down Expand Up @@ -1075,6 +1139,13 @@ LTLIBPATHS = /LIBPATH:$(TCLLIBDIR)
LTLIBS = $(LTLIBS) $(LIBTCL)
!ENDIF

# If zlib support is enabled, add the linker options for it.
#
!IF $(USE_ZLIB)!=0
LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:$(ZLIBLIBDIR)
LTLIBS = $(LTLIBS) $(ZLIBLIB)
!ENDIF

# If ICU support is enabled, add the linker options for it.
#
!IF $(USE_ICU)!=0
Expand Down Expand Up @@ -1987,6 +2058,8 @@ SHELL_SRC = \
shell.c: $(SHELL_SRC) $(TOP)\tool\mkshellc.tcl
$(TCLSH_CMD) $(TOP)\tool\mkshellc.tcl > shell.c

zlib:
pushd $(ZLIBDIR) && $(MAKE) /f win32\Makefile.msc $(ZLIBLIB) && popd

# Rules to build the extension objects.
#
Expand Down
1 change: 1 addition & 0 deletions autoconf/Makefile.msc
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ SHELL_CORE_DEP =
!ENDIF
!ENDIF


# This is the core library that the shell executable should link with.
#
!IFNDEF SHELL_CORE_LIB
Expand Down

0 comments on commit 203349a

Please sign in to comment.