Commit e0d1559591e7b49fe638775536fa66100f1b2163

Werner Lemberg 2006-05-10T13:44:47

* builds/freetype.mk (refdoc): Write-protect the `docmaker' directory to suppress generation of .pyc files. According to the Python docs there isn't a more elegant solution (currently). * builds/toplevel.mk (dist): New target which builds .tar.gz, .tar.bz2, and .zip files. Note that the version number is still hard-coded. (do-dist): Sub-target of `dist'. (CONFIG_GUESS, CONFIG_SUB): New variables. (.PHONY): Updated.

diff --git a/ChangeLog b/ChangeLog
index 95f0ba1..dd3a3fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,17 @@
 	given an empty, un-mmap()able file.  Reported and suggested fix in
 	Savannah bug #16555.
 
+	* builds/freetype.mk (refdoc): Write-protect the `docmaker'
+	directory to suppress generation of .pyc files.  According to the
+	Python docs there isn't a more elegant solution (currently).
+
+	* builds/toplevel.mk (dist): New target which builds .tar.gz,
+	.tar.bz2, and .zip files.  Note that the version number is still
+	hard-coded.
+	(do-dist): Sub-target of `dist'.
+	(CONFIG_GUESS, CONFIG_SUB): New variables.
+	(.PHONY): Updated.
+
 2006-05-09  Rajeev Pahuja  <rpahuja@esri.com>
 
 	* builds/win32/visualc/freetype.sln,
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 84da09b..2afd8c8 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -267,7 +267,11 @@ dll: $(PROJECT_LIBRARY) exported_symbols
 	$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
 
 
+# We write-protect the docmaker directory to suppress generation
+# of .pyc files.
+#
 refdoc:
+	-chmod -w $(SRC_DIR)/tools/docmaker
 	python $(SRC_DIR)/tools/docmaker/docmaker.py \
                --prefix=ft2                          \
                --title=FreeType-2.2.1                \
@@ -275,6 +279,7 @@ refdoc:
                $(PUBLIC_DIR)/*.h                     \
                $(PUBLIC_DIR)/config/*.h              \
                $(PUBLIC_DIR)/cache/*.h
+	-chmod +w $(SRC_DIR)/tools/docmaker
 
 
 .PHONY: clean_project_std distclean_project_std
diff --git a/builds/toplevel.mk b/builds/toplevel.mk
index 48a454c..6c39e0c 100644
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -34,7 +34,7 @@
 # details on host platform detection and library builds.
 
 
-.PHONY: all setup distclean modules
+.PHONY: all dist distclean modules setup
 
 
 # The `space' variable is used to avoid trailing spaces in defining the
@@ -158,4 +158,76 @@ modules:
 include $(TOP_DIR)/builds/modules.mk
 
 
+# This target builds the tarballs.
+#
+# Not to be run by a normal user -- there are no attempts to make it
+# generic.
+
+dist:
+	-rm -rf tmp
+	rm -f freetype-2.2.1.tar.gz
+	rm -f freetype-2.2.1.tar.bz2
+	rm -f ft221.zip
+
+	for d in `find . -wholename '*/CVS' -prune \
+	                 -o -type f \
+	                 -o -print` ; do \
+	  mkdir -p tmp/$$d ; \
+	done ;
+
+	currdir=`pwd` ; \
+	for f in `find . -wholename '*/CVS' -prune \
+	                 -o -name .cvsignore \
+	                 -o -type d \
+	                 -o -print` ; do \
+	  ln -s $$currdir/$$f tmp/$$f ; \
+	done
+
+	@# Prevent generation of .pyc files.  Python follows (soft) links if
+	@# the link's directory is write protected, so we have temporarily
+	@# disable write access here too.
+	chmod -w src/tools/docmaker
+
+	cd tmp ; \
+	$(MAKE) devel ; \
+	$(MAKE) do-dist
+
+	chmod +w src/tools/docmaker
+
+	mv tmp freetype-2.2.1
+
+	tar cfh - freetype-2.2.1 \
+	| gzip -c > freetype-2.2.1.tar.gz
+	tar cfh - freetype-2.2.1 \
+	| bzip2 -c > freetype-2.2.1.tar.bz2
+
+	@# Use CR/LF for zip files.
+	zip -lr ft221.zip freetype-2.2.1
+
+	rm -fr freetype-2.2.1
+
+
+# The locations of the latest `config.guess' and `config.sub' versions (from
+# GNU `config' CVS), relative to the `tmp' directory used during `make dist'.
+#
+CONFIG_GUESS = ../../../config/config.guess
+CONFIG_SUB   = ../../../config/config.sub
+
+
+# Don't say `make do-dist'.  Always use `make dist' instead.
+#
+.PHONY: do-dist
+
+do-dist: distclean refdoc
+	@# Without removing the files, `autoconf' and friends follow links.
+	rm -f builds/unix/aclocal.m4
+	rm -r builds/unix/configure.ac
+	rm -r builds/unix/configure
+
+	sh autogen.sh
+	rm -rf builds/unix/autom4te.cache
+
+	cp $(CONFIG_GUESS) builds/unix
+	cp $(CONFIG_SUB) builds/unix
+
 # EOF