View Ticket
Not logged in
Ticket UUID: 786d01dc532813d0a635ec7c203f8503c2383609
Title: Fix some build issues on Windows
Status: Open Type: Build_Problem
Severity: Important Priority:
Subsystem: Resolution: Open
Last Modified: 2010-04-05 20:07:16
Version Found In: 1f607de1db
Description & Comments:
The attached patch against version [1f607de1db] fixes the following build issues on Windows:
  1. Fossil always gets built from the ground up.
  2. Added a flag to build a static binary.
  3. Determine the libraries to link with, according to the enabled flags (FOSSIL_BUILD_STATIC and FOSSIL_ENABLE_SSL).
Remember to execute makemake.tcl after applying this patch.

--tsbg


anonymous claiming to be tsbg added on 2010-04-05 20:07:16:
I didn't find a possibility to attach the patch. Now it follows after here:

diff -Naur -x _FOSSIL_ -x build fossil-org/Makefile.w32 fossil-src/Makefile.w32
--- fossil-org/Makefile.w32	2010-04-04 15:15:42 +0000
+++ fossil-src/Makefile.w32	2010-04-05 10:19:38 +0000
@@ -19,9 +19,13 @@
 #
 E = .exe
 
-#### Enable HTTPS support via OpenSSL (links to libssl and libcrypto)
+#### Make a binary with all libraries statically linked.
 #
-# FOSSIL_ENABLE_SSL=1
+# FOSSIL_BUILD_STATIC = 1
+
+#### Enable HTTPS support via OpenSSL.
+#
+# FOSSIL_ENABLE_SSL = 1
 
 #### C Compile and options for use in building executables that 
 #    will run on the target platform.  This is usually the same
@@ -41,18 +45,25 @@
 endif
 
 #### Extra arguments for linking the finished binary.  Fossil needs
-#    to link against the Z-Lib compression library.  There are no
-#    other dependencies.  We sometimes add the -static option here
-#    so that we can build a static executable that will run in a
-#    chroot jail.
-#
-#LIB = -lz
-#LIB = -lz -lws2_32
-LIB = -lmingwex -lz -lws2_32
+#    to link against the Z-Lib compression library and to the OpenSSL crypto
+#    libraries when FOSSIL_ENABLE_SSL is defined. There are no other
+#    dependencies.
+#
+ifdef FOSSIL_BUILD_STATIC
+  LIB += -static
+  SSLLIBS = -lssl -lcrypto -lgdi32
+else
+# SSLLIBS = -lssl32 -leay32  # OpenSSL Versions <  1.0.0
+  SSLLIBS = -lssl -lcrypto   # OpenSSL Versions >= 1.0.0
+endif
+#
 # OpenSSL:
 ifdef FOSSIL_ENABLE_SSL
-LIB += -lcrypto -lssl
+  LIB += $(SSLLIBS)
 endif
+#
+# Normal required libraries:
+LIB += -lmingwex -lz -lws2_32
 
 #### Tcl shell for use in running the fossil testsuite.
 #
diff -Naur -x _FOSSIL_ -x build fossil-org/src/makemake.tcl fossil-src/src/makemake.tcl
--- fossil-org/src/makemake.tcl	2010-04-04 15:18:11 +0000
+++ fossil-src/src/makemake.tcl	2010-04-05 10:42:39 +0000
@@ -114,7 +114,10 @@
   puts -nonewline " \\\n \$(OBJDIR)/$s.o"
 }
 puts "\n"
-puts "APPNAME = $name\$(E)"
+puts "APPNAME     = $name\$(E)"
+puts "TRANSLATE   = translate\$(E)"
+puts "MAKEHEADERS = makeheaders\$(E)"
+puts "MKINDEX     = mkindex\$(E)"
 puts "\n"
 
 puts {
@@ -126,13 +129,13 @@
 $(OBJDIR):
 	-mkdir $(OBJDIR)
 
-translate:	$(SRCDIR)/translate.c
+$(TRANSLATE):	$(SRCDIR)/translate.c
 	$(BCC) -o translate $(SRCDIR)/translate.c
 
-makeheaders:	$(SRCDIR)/makeheaders.c
+$(MAKEHEADERS):	$(SRCDIR)/makeheaders.c
 	$(BCC) -o makeheaders $(SRCDIR)/makeheaders.c
 
-mkindex:	$(SRCDIR)/mkindex.c
+$(MKINDEX):	$(SRCDIR)/mkindex.c
 	$(BCC) -o mkindex $(SRCDIR)/mkindex.c
 
 # WARNING. DANGER. Running the testsuite modifies the repository the
@@ -161,7 +164,7 @@
 
 clean:	
 	rm -f $(OBJDIR)/*.o *_.c $(APPNAME) VERSION.h
-	rm -f translate makeheaders mkindex page_index.h headers}
+	rm -f $(TRANSLATE) $(MAKEHEADERS) $(MKINDEX) page_index.h headers}
 
 set hfiles {}
 foreach s [lsort $src] {lappend hfiles $s.h}
@@ -175,23 +178,23 @@
 append mhargs " \$(SRCDIR)/sqlite3.h"
 append mhargs " \$(SRCDIR)/th.h"
 append mhargs " VERSION.h"
-puts "page_index.h: \$(TRANS_SRC) mkindex"
-puts "\t./mkindex \$(TRANS_SRC) >$@"
-puts "headers:\tpage_index.h makeheaders VERSION.h"
-puts "\t./makeheaders $mhargs"
+puts "page_index.h: \$(TRANS_SRC) \$(MKINDEX)"
+puts "\t./\$(MKINDEX) \$(TRANS_SRC) >$@"
+puts "headers:\tpage_index.h \$(MAKEHEADERS) VERSION.h"
+puts "\t./\$(MAKEHEADERS) $mhargs"
 puts "\ttouch headers"
 puts "headers: Makefile"
 puts "Makefile:"
 set extra_h(main) page_index.h
 
 foreach s [lsort $src] {
-  puts "${s}_.c:\t\$(SRCDIR)/$s.c translate"
-  puts "\t./translate \$(SRCDIR)/$s.c >${s}_.c\n"
+  puts "${s}_.c:\t\$(SRCDIR)/$s.c \$(TRANSLATE)"
+  puts "\t./\$(TRANSLATE) \$(SRCDIR)/$s.c >${s}_.c"
   puts "\$(OBJDIR)/$s.o:\t${s}_.c $s.h $extra_h($s) \$(SRCDIR)/config.h"
-  puts "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c ${s}_.c\n"
-  puts "$s.h:\theaders"
-#  puts "\t./makeheaders $mhargs\n\ttouch headers\n"
-#  puts "\t./makeheaders ${s}_.c:${s}.h\n"
+  puts "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c ${s}_.c"
+  puts "$s.h:\theaders\n"
+#  puts "\t./$(MAKEHEADERS) $mhargs\n\ttouch headers\n"
+#  puts "\t./$(MAKEHEADERS) ${s}_.c:${s}.h\n"
 }