File: docbook-xml_CMakeLists.txt

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (178 lines) | stat: -rw-r--r-- 8,242 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Top-level CMakeLists.txt for the CMake-based build system
# of the docbook-xml software.

# Copyright (C) 2013 Alan W. Irwin

# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this file; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

project(docbook-xml NONE)

message(STATUS "CMake version = ${CMAKE_VERSION}")
message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")

cmake_minimum_required(VERSION 2.8.10.2 FATAL_ERROR)

# CATALOG_CMAKE_INSTALL_PREFIX prepends a "/" to CMAKE_INSTALL_PREFIX if the
# latter doesn't start with "/", (i.e, the drive letter
# on Microsoft systems).  This makes the URI file:/// form come out
# right for catalog entries.
if(CMAKE_INSTALL_PREFIX MATCHES "^[^/]")
  set(CATALOG_CMAKE_INSTALL_PREFIX /${CMAKE_INSTALL_PREFIX})
else(CMAKE_INSTALL_PREFIX MATCHES "^[^/]")
  set(CATALOG_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
endif(CMAKE_INSTALL_PREFIX MATCHES "^[^/]")
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
message(STATUS "CATALOG_CMAKE_INSTALL_PREFIX=${CATALOG_CMAKE_INSTALL_PREFIX}")

# Define useful function.
find_program(XMLCATALOG_EXECUTABLE xmlcatalog)
function(install_xml_catalog arguments_LIST3 catalog)
  # Install an XML catalog using the information supplied in
  # arguments_LIST3, which is a list of arguments grouped by
  # threes where each group of three arguments correspond to
  # the three arguments of the "xmlcatalog --add" command.
  
  # Create the catalog if it does not exist.
  install(CODE "
if(NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/etc/xml/${catalog}\")
message(STATUS \"Creating \${CMAKE_INSTALL_PREFIX}/etc/xml/${catalog}\")
execute_process(COMMAND ${XMLCATALOG_EXECUTABLE} --noout 
  --create 
  \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/etc/xml/${catalog}\")
endif(NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/etc/xml/${catalog}\")
")

  list(LENGTH ${arguments_LIST3} narguments_LIST3)
  set(group_size 3)
  set(remove_indices 0 1 2)
  math(EXPR max_index "(${narguments_LIST3}/${group_size}) - 1")
  foreach(index RANGE 0 ${max_index})
    list(GET ${arguments_LIST3} 0 type)
    list(GET ${arguments_LIST3} 1 orig)
    list(GET ${arguments_LIST3} 2 replace)
    list(REMOVE_AT ${arguments_LIST3} ${remove_indices})
    install(CODE "
message(STATUS \"Updating \${CMAKE_INSTALL_PREFIX}/etc/xml/${catalog}\")
execute_process(COMMAND ${XMLCATALOG_EXECUTABLE} --noout
  --add \"${type}\" \"${orig}\" \"${replace}\" 
  \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/etc/xml/${catalog}\")
"
      )
  endforeach(index RANGE 0 ${max_index})
endfunction(install_xml_catalog)

# Nothing to build.  Just follow directions at
# http://www.linuxfromscratch.org/blfs/view/svn/pst/DocBook.html to
# install files that are in the source tree.

# Install top-level source tree files.
set(globs
  ${CMAKE_SOURCE_DIR}/docbook.cat
  ${CMAKE_SOURCE_DIR}/*.dtd
  ${CMAKE_SOURCE_DIR}/*.mod
  )
# Make elements of path_list absolute PATH names.
file(GLOB path_list
  ${globs}
  )
# Add the ent subdirectory to path_list
list(APPEND path_list ${CMAKE_SOURCE_DIR}/ent)

find_program(INSTALL_EXECUTABLE install)
find_program(CP_EXECUTABLE cp)

install(CODE "
message(STATUS \"Installing \${CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5\")
execute_process(
COMMAND ${INSTALL_EXECUTABLE} -v -d -m755 
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5\")
"
  )

install(CODE "
execute_process(
COMMAND ${CP_EXECUTABLE} -v -af ${path_list}
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5\")
"
  )

install(CODE "
message(STATUS \"Installing \${CMAKE_INSTALL_PREFIX}/etc/xml\")
execute_process(
COMMAND ${INSTALL_EXECUTABLE} -v -d -m755 
\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/etc/xml\")
"
  )

set(commands
"public" "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
"public" "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/calstblx.dtd"
"public" "-//OASIS//DTD XML Exchange Table Model 19990315//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/soextblx.dtd"
"public" "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod"
"public" "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/dbhierx.mod"
"public" "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/htmltblx.mod"
"public" "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod"
"public" "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/dbcentx.mod"
"public" "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5/dbgenent.mod"
"rewriteSystem" "http://www.oasis-open.org/docbook/xml/4.5" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5"
"rewriteURI" "http://www.oasis-open.org/docbook/xml/4.5" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5")

install_xml_catalog(commands "docbook")

# Do this for every pattern above so using the catalog file as the catalog
# is equivalent to using the docbook file as the catalog.
set(commands
"delegatePublic" "-//OASIS//DTD DocBook XML" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
"delegatePublic" "-//OASIS//DTD XML Exchange" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
"delegatePublic" "-//OASIS//ENTITIES DocBook XML" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
"delegatePublic" "-//OASIS//ELEMENTS DocBook XML" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
"delegateSystem" "http://www.oasis-open.org/docbook/" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
"delegateURI" "http://www.oasis-open.org/docbook/" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
)

install_xml_catalog(commands "catalog")

# LFS instructions at 
# http://www.linuxfromscratch.org/blfs/view/svn/pst/DocBook.html
# are open to interpretation for this part, but I think it means
# these previous versions should be dropped if they are handled
# a different way.  But I am not doing that so leave them in
# unless some issue is found in the future that I am not aware of
# now.

set(previous_versions
  4.1.2
  4.2
  4.3
  4.4
  )

foreach(DTDVERSION ${previous_versions})
  set(commands
    "public" "-//OASIS//DTD DocBook XML V${DTDVERSION}//EN" "http://www.oasis-open.org/docbook/xml/${DTDVERSION}/docbookx.dtd"
    "rewriteSystem" "http://www.oasis-open.org/docbook/xml/${DTDVERSION}" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5"
    "rewriteURI" "http://www.oasis-open.org/docbook/xml/${DTDVERSION}" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/share/xml/docbook/xml-dtd-4.5"
    )
  install_xml_catalog(commands "docbook")

  # Do this for every pattern above except the "public" one which has already
  # been taken care of so using the catalog file as the catalog
  # is equivalent to using the docbook file as the catalog.
  set(commands
    "delegateSystem" "http://www.oasis-open.org/docbook/xml/${DTDVERSION}/" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
    "delegateURI" "http://www.oasis-open.org/docbook/xml/${DTDVERSION}/" "file://${CATALOG_CMAKE_INSTALL_PREFIX}/etc/xml/docbook"
    )
  install_xml_catalog(commands "catalog")

endforeach(DTDVERSION ${previous_versions})