[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master c962db2 4/4: * builds/*/*: Prepare build system for d
From: |
Nikhil Ramakrishnan |
Subject: |
[freetype2] master c962db2 4/4: * builds/*/*: Prepare build system for docwriter. |
Date: |
Sat, 25 Aug 2018 06:56:13 -0400 (EDT) |
branch: master
commit c962db28ea59225f0105c03d907d4a9b71765687
Author: Nikhil Ramakrishnan <address@hidden>
Commit: Nikhil Ramakrishnan <address@hidden>
* builds/*/*: Prepare build system for docwriter.
Add checks, rules and variables to the build system for docwriter.
* Running `make' will warn if Python/PIP/docwriter are not available.
* Running `make refdoc' will generate static documentation site on the
current Python environment.
* Running `make refdoc-venv' will generate static documentation site
using a virtual environment, using the pip package `virtualenv'.
---
Jamfile | 3 ++-
builds/ansi/ansi-def.mk | 3 +++
builds/beos/beos-def.mk | 3 +++
builds/dos/dos-def.mk | 3 +++
builds/freetype.mk | 54 ++++++++++++++++++++++++++++++++++++---------
builds/os2/os2-def.mk | 4 ++++
builds/unix/configure.raw | 30 +++++++++++++++++++++++++
builds/unix/unix-def.in | 6 +++++
builds/unix/unixddef.mk | 4 ++++
builds/windows/win32-def.mk | 4 ++++
10 files changed, 103 insertions(+), 11 deletions(-)
diff --git a/Jamfile b/Jamfile
index 9078a5f..6546213 100644
--- a/Jamfile
+++ b/Jamfile
@@ -208,12 +208,13 @@ rule RefDoc
actions RefDoc
{
- python $(FT2_SRC)/tools/docmaker/docmaker.py
+ python -m docwriter
--prefix=ft2
--title=FreeType-2.9.1
--output=$(DOC_DIR)
$(FT2_INCLUDE)/freetype/*.h
$(FT2_INCLUDE)/freetype/config/*.h
+ $(FT2_INCLUDE)/freetype/cache/*.h
}
RefDoc refdoc ;
diff --git a/builds/ansi/ansi-def.mk b/builds/ansi/ansi-def.mk
index 1484f96..38571a5 100644
--- a/builds/ansi/ansi-def.mk
+++ b/builds/ansi/ansi-def.mk
@@ -19,6 +19,9 @@ SEP := /
BUILD_DIR := $(TOP_DIR)/builds/ansi
PLATFORM := ansi
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+BIN := bin
# The directory where all library files are placed.
#
diff --git a/builds/beos/beos-def.mk b/builds/beos/beos-def.mk
index 89c54dd..5a3b520 100644
--- a/builds/beos/beos-def.mk
+++ b/builds/beos/beos-def.mk
@@ -21,6 +21,9 @@ SEP := /
BUILD_DIR := $(TOP_DIR)/builds/beos
PLATFORM := beos
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+BIN := bin
# The directory where all library files are placed.
#
diff --git a/builds/dos/dos-def.mk b/builds/dos/dos-def.mk
index cb1154d..434f61b 100644
--- a/builds/dos/dos-def.mk
+++ b/builds/dos/dos-def.mk
@@ -19,6 +19,9 @@ SEP := $(strip \ )
BUILD_DIR := $(TOP_DIR)/builds/dos
PLATFORM := dos
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+BIN := Scripts
# The executable file extension (for tools), *with* leading dot.
#
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 6f68a0f..356aa70 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -75,7 +75,7 @@
# The targets `objects' and `library' are defined at the end of this
# Makefile after all other rules have been included.
#
-.PHONY: single multi objects library refdoc
+.PHONY: single multi objects library refdoc refdoc-venv
# default target -- build single objects and library
#
@@ -289,18 +289,52 @@ objects: $(OBJECTS_LIST)
library: $(PROJECT_LIBRARY)
-
+# Run `docwriter' in the current Python environment.
# Option `-B' disables generation of .pyc files (available since python 2.6)
#
-refdoc:
- python -B $(SRC_DIR)/tools/docmaker/docmaker.py \
- --prefix=ft2 \
- --title=FreeType-$(version) \
- --output=$(DOC_DIR) \
- $(PUBLIC_DIR)/*.h \
- $(PUBLIC_DIR)/config/*.h \
- $(PUBLIC_DIR)/cache/*.h
+PYTHON ?= python
+PIP ?= pip
+
+refdoc:
+ @echo Running docwriter...
+ $(PYTHON) -m docwriter \
+ --prefix=ft2 \
+ --title=FreeType-$(version) \
+ --output=$(DOC_DIR) \
+ $(PUBLIC_DIR)/*.h \
+ $(PUBLIC_DIR)/config/*.h \
+ $(PUBLIC_DIR)/cache/*.h
+ @echo Building static site...
+ cd $(DOC_DIR) && mkdocs build
+ @echo Done.
+
+# Variables for running refdoc with Python's `virtualenv'. The env is
+# created in `DOC_DIR/env' and is gitignored.
+# We still need to cd into `DOC_DIR' to build mkdocs because paths in
+# mkdocs.yml are relative to cwd.
+#
+VENV_NAME := env
+VENV_DIR := $(DOC_DIR)$(SEP)$(VENV_NAME)
+ENV_PYTHON := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PYTHON)
+ENV_PIP := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PIP)
+
+refdoc-venv:
+ @echo Setting up virtualenv for Python...
+ virtualenv $(VENV_DIR)
+ @echo Installing docwriter...
+ $(ENV_PIP) install docwriter
+ @echo Running docwriter...
+ $(ENV_PYTHON) -m docwriter \
+ --prefix=ft2 \
+ --title=FreeType-$(version) \
+ --output=$(DOC_DIR) \
+ $(PUBLIC_DIR)/*.h \
+ $(PUBLIC_DIR)/config/*.h \
+ $(PUBLIC_DIR)/cache/*.h
+ @echo Building static site...
+ cd $(DOC_DIR) && $(VENV_NAME)$(SEP)$(BIN)$(SEP)python -m mkdocs build
+ @echo Done.
.PHONY: clean_project_std distclean_project_std
diff --git a/builds/os2/os2-def.mk b/builds/os2/os2-def.mk
index 7ad1ffb..7c19a5c 100644
--- a/builds/os2/os2-def.mk
+++ b/builds/os2/os2-def.mk
@@ -19,6 +19,10 @@ SEP := $(strip \ )
BUILD_DIR := $(TOP_DIR)/builds/os2
PLATFORM := os2
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+BIN := Scripts
+
# The executable file extension (for tools), *with* leading dot.
#
E := .exe
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index f18bb3d..769c44e 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -968,6 +968,25 @@ case "$CFLAGS" in
;;
esac
+# Check for python and docwriter
+
+AC_CHECK_PROGS([PYTHON], [python3 python2 python], [missing])
+have_docwriter=no
+if test "x$PYTHON" != "xmissing"; then
+ AC_CHECK_PROGS([PIP], [pip3 pip2 pip], [missing])
+
+ if test "x$PIP" != "xmissing"; then
+ AC_MSG_CHECKING([for \`docwriter' Python module])
+ $PIP show -q docwriter
+ if test "x$?" = "x0"; then
+ have_docwriter=yes
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+fi
+
# entries in Requires.private are separated by commas;
REQUIRES_PRIVATE="$zlib_reqpriv, \
@@ -1112,4 +1131,15 @@ Library configuration:
harfbuzz: $have_harfbuzz
])
+# Warn if docwriter is not installed
+
+if test $have_docwriter = no; then
+ AC_MSG_NOTICE([
+ Warning: \`make refdoc' will fail since pip package \`docwriter' is not
+ installed. To install, run \`$PIP install docwriter', or to use a python
+ virtual environment, run \`make refdoc-venv' (requires pip package
+ \`virtualenv').
+ ])
+fi
+
# end of configure.raw
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index 6957053..7e824bc 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -21,6 +21,12 @@ DELDIR := rm -rf
CAT := cat
SEP := /
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+PYTHON := @PYTHON@
+PIP := @PIP@
+BIN := bin
+
# this is used for `make distclean' and `make install'
OBJ_BUILD ?= $(BUILD_DIR)
diff --git a/builds/unix/unixddef.mk b/builds/unix/unixddef.mk
index a8da63a..e45e751 100644
--- a/builds/unix/unixddef.mk
+++ b/builds/unix/unixddef.mk
@@ -23,6 +23,10 @@ DELETE := rm -f
CAT := cat
SEP := /
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+BIN := bin
+
# we use a special devel ftoption.h
DEVEL_DIR := $(TOP_DIR)/devel
diff --git a/builds/windows/win32-def.mk b/builds/windows/win32-def.mk
index f83d444..2a91847 100644
--- a/builds/windows/win32-def.mk
+++ b/builds/windows/win32-def.mk
@@ -19,6 +19,10 @@ SEP := $(strip \ )
BUILD_DIR := $(TOP_DIR)/builds/windows
PLATFORM := windows
+# This is used for `make refdoc' and `make refdoc-venv'
+#
+BIN := Scripts
+
# The executable file extension (for tools). NOTE: WE INCLUDE THE DOT HERE !!
#
E := .exe
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master c962db2 4/4: * builds/*/*: Prepare build system for docwriter.,
Nikhil Ramakrishnan <=