source: project/chicken/trunk/dist.cmake @ 5852

Last change on this file since 5852 was 5358, checked in by felix winkelmann, 13 years ago
  • renamed manual dir
  • can't get cmake to handle assembler file. I give up.
  • removed darcs link from site index
  • trivial build output changes
  • some more cleanup, trivialities
  • I'm out of ASCII banners
File size: 10.0 KB
Line 
1# Copyright (c) 2006 by Brandon J. Van Every under MIT-style license.
2# See LICENSE section at end of file for full license text.
3
4
5# inputs:
6#   Chicken_SOURCE_DIR
7#   DIST_DIR
8#   CHANGELOG_FILE
9#   BOOT_CFILES
10
11# Turn BOOT_CFILES back into a list.
12# This is not safe for filenames with spaces in them,
13# but we don't have any of those.
14SEPARATE_ARGUMENTS(BOOT_CFILES)
15
16# Files in the Chicken_SOURCE_DIR
17SET(SOURCE_DIR_FILES
18  autogen.sh
19  banner.scm
20  batch-driver.scm
21  build.scm
22  buildversion
23  c-backend.scm
24  c-platform.scm
25  ChangeLog.0-20040412
26  chicken-config-cmake.h.in
27  chicken-defaults.h.in
28  chicken-ffi-macros.scm
29  chicken-more-macros.scm
30  chicken-profile.1
31  chicken-profile.scm
32  chicken-setup.1
33  chicken-setup.scm
34  chicken-tar.exe
35  chicken-gzip.exe
36  chicken.1
37  chicken.h
38  chicken.ico
39  chicken.rc
40  chicken.scm
41  chicken.spec.in
42  CMakeLists.txt
43  compiler.scm
44  configure.in
45  csc.1
46  csc.scm
47  csi.1
48  csi.scm
49  csibatch.bat
50  dist.cmake
51  eval.scm
52  extras.scm
53  hen.el
54  INSTALL
55  INSTALL-CMake.txt
56  library.scm
57  LICENSE
58  lolevel.scm
59  Makefile.am
60  match.scm
61  NEWS
62  optimizer.scm
63  regex.scm
64  posixunix.scm
65  posixwin.scm
66  profiler.scm
67  README
68  runtime.c
69  scheduler.scm
70  srfi-1.scm
71  srfi-4.scm
72  srfi-13.scm
73  srfi-14.scm
74  srfi-18.scm
75  StackGrowsDownward.c
76  stub.scm
77  support.scm
78  tcp.scm
79  tweaks.scm
80  utils.scm
81  pcre/pcre_compile.c
82  pcre/pcre_get.c
83  pcre/pcre_printint.c
84  pcre/pcre_ucp_findchar.c
85  pcre/pcre_config.c
86  pcre/pcre_globals.c
87  pcre/pcre_refcount.c
88  pcre/pcre_valid_utf8.c
89  pcre/pcre_dfa_exec.c
90  pcre/pcre_info.c
91  pcre/pcre_study.c
92  pcre/pcre_version.c
93  pcre/pcre_exec.c
94  pcre/pcre_maketables.c
95  pcre/pcre_tables.c
96  pcre/pcre_xclass.c
97  pcre/pcre_fullinfo.c
98  pcre/pcre_ord2utf8.c
99  pcre/pcre_try_flipped.c
100  pcre/chartables.c
101  pcre/AUTHORS
102  pcre/COPYING
103  pcre/LICENCE
104  pcre/config.h
105  pcre/pcre.h
106  pcre/pcre_internal.h
107  pcre/ucpinternal.h
108  pcre/ucp.h
109  pcre/ucptable.c
110  pcre/ucp_findchar.c
111  apply-hack.ppc.s
112  apply-hack.x86.s
113  apply-hack.x86-64.s
114  static/CMakeLists.txt
115  benchmarks/boyer.scm
116  benchmarks/browse.scm
117  benchmarks/conform.scm
118  benchmarks/cpstak.scm
119  cscbench.scm
120  benchmarks/ctak.scm
121  benchmarks/dderiv.scm
122  benchmarks/deriv.scm
123  benchmarks/destructive.scm
124  benchmarks/div-iter.scm
125  benchmarks/div-rec.scm
126  benchmarks/dynamic.scm
127  benchmarks/earley.scm
128  benchmarks/fft.scm
129  benchmarks/fib.scm
130  benchmarks/fibc.scm
131  benchmarks/fprint.scm
132  benchmarks/fread.scm
133  benchmarks/hanoi.scm
134  benchmarks/lattice.scm
135  benchmarks/maze.scm
136  benchmarks/nqueens.scm
137  benchmarks/plists.scm
138  benchmarks/puzzle.scm
139  benchmarks/scheme.scm
140  benchmarks/stack-size.cmake
141  benchmarks/tak.scm
142  benchmarks/takl.scm
143  benchmarks/takr.scm
144  benchmarks/traverse.scm
145  benchmarks/travinit.scm
146  benchmarks/triangl.scm
147  benchmarks/others/except.scm
148  benchmarks/others/except2.scm
149  benchmarks/others/exception.cpp
150  benchmarks/others/Makefile
151  benchmarks/others/results.txt
152  benchmarks/others/setlongjmp.c
153  boot/CMakeLists.txt
154  tests/library-tests.scm
155  tests/locative-stress-test.scm
156  tests/r4rstest.scm
157  tests/runtests.sh
158  tests/srfi-18-tests.scm
159)
160
161# The BOOT_CFILES also need to be copied
162# from ${CMAKE_CURRENT_BINARY_DIR}/*.c
163# to ${CMAKE_CURRENT_BINARY_DIR}/boot/cfiles/*.c
164# so that we're booting from the most current Chicken.
165
166
167####################################################################
168#  INTEGRITY CHECK                                                 #
169####################################################################
170
171# Check if all distribution files are present.
172
173IF(NOT EXISTS ${CHANGELOG_FILE})
174  MESSAGE(FATAL_ERROR "ChangeLog file is missing: ${CHANGELOG_FILE}")
175ENDIF(NOT EXISTS ${CHANGELOG_FILE})
176FOREACH(f ${SOURCE_DIR_FILES})
177  IF(NOT EXISTS ${Chicken_SOURCE_DIR}/${f})
178    MESSAGE(FATAL_ERROR "Distribution file is missing: ${Chicken_SOURCE_DIR}/${f}")
179  ENDIF(NOT EXISTS ${Chicken_SOURCE_DIR}/${f})
180ENDFOREACH(f)
181FOREACH(f ${BOOT_CFILES})
182  IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${f})
183    MESSAGE(FATAL_ERROR "Distribution file is missing: ${CMAKE_CURRENT_BINARY_DIR}/${f}")
184  ENDIF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${f})
185ENDFOREACH(f)
186MESSAGE(STATUS "All distribution files are present.")
187
188
189####################################################################
190#  CREATE DISTRIBUTION TREE                                        #
191####################################################################
192
193# Start with an empty tree.
194IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR})
195  FILE(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR})
196ENDIF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR})
197
198EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy "${CHANGELOG_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}/ChangeLog")
199FOREACH(f ${SOURCE_DIR_FILES})
200  EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy "${Chicken_SOURCE_DIR}/${f}" "${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}/${f}")
201ENDFOREACH(f)
202FOREACH(f ${BOOT_CFILES})
203  EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${f}" "${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}/boot/cfiles/${f}")
204ENDFOREACH(f)
205
206
207####################################################################
208#   GNU AUTOMAKE                                                   #
209####################################################################
210
211# Since CMake is used to generate the canonical Chicken distribution,
212# it must invoke Automake so that ./configure et al are created.
213# This adds files to the distribution that we haven't previously checked above.
214# We do it now, rather than earlier, because "cmake -E copy" changes the timestamp.
215# This can cause Automake to run twice, which is annoying.
216# Also, doing it here, we can keep ${Chicken_SOURCE_DIR} free of Automake pollution.
217#
218# A Bourne shell "sh"
219# must be available, so that Automake can run.  We shouldn't have
220# to run CMakeLists.txt from a Bourne shell; we just need to have,
221# say, a sh.exe available in our path.  We aren't currently
222# doing any error checking on whether "sh" is available or working.
223# Nor whether Automake is installed, for that matter.  Not many people
224# need to build distros.
225#
226# As of Sept. 3rd, 2006, the various Autoconfs + Automakes
227# distributed with MSYS are complete garbage.  Don't waste your
228# time; I wasted an entire day before giving up.  The GNU Win32
229# distros din't help either.  A project called mingw-install
230# finally did the trick.  http://sourceforge.net/projects/mingw-install
231# Haibin Zhang has solved quite a number of irritating integration
232# issues.  Although, caveat emptor, it'll nuke your entire MinGW
233# installation including GCC, without warning you!  Proper steps:
234#
235# - install MinGW-5.0.3.exe
236# - install mingw-install-20060210/setup/MSYS-1.0.11-2004.04.30-1.exe
237# - install mingw-install-20060210/msys/install.sh
238# - comment out the nasty "rm -rf" statements in
239#   mingw-install-20060210/mingw/install.sh
240# - install mingw-install-20060210/mingw/install.sh
241
242EXECUTE_PROCESS(
243  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}
244  COMMAND sh autogen.sh
245  RESULT_VARIABLE AUTOGEN_ERROR
246)
247
248IF(AUTOGEN_ERROR)
249  MESSAGE(FATAL_ERROR "autogen.sh failed")
250ENDIF(AUTOGEN_ERROR)
251
252SET(AUTOMAKE_FILES aclocal.m4 compile config.guess config.sub configure install-sh Makefile.in missing ltmain.sh)
253FOREACH(f ${AUTOMAKE_FILES})
254  IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}/${f})
255    MESSAGE(FATAL_ERROR "Automake file failed to generate: ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}/${f}")
256  ENDIF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_DIR}/${f})
257ENDFOREACH(f)
258
259
260####################################################################
261#  CREATE TARBALL                                                  #
262####################################################################
263
264SET(DIST_TAR_NAME ${DIST_DIR}.tar.gz)
265MESSAGE(STATUS "Creating ${CMAKE_CURRENT_BINARY_DIR}/${DIST_TAR_NAME}")
266IF(EXISTS ${DIST_TAR_NAME})
267  FILE(REMOVE ${DIST_TAR_NAME})
268ENDIF(EXISTS ${DIST_TAR_NAME})
269EXECUTE_PROCESS(
270  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
271  COMMAND ${CMAKE_COMMAND} -E tar cfz ${DIST_TAR_NAME} ${DIST_DIR}
272)
273
274####################################################################
275#  CREATE ZIP                                                      #
276####################################################################
277
278FIND_PROGRAM(ZIP_EXE zip)
279IF(ZIP_EXE)
280  SET(DIST_ZIP_NAME ${DIST_DIR}.zip)
281  MESSAGE(STATUS "Creating ${CMAKE_CURRENT_BINARY_DIR}/${DIST_ZIP_NAME}")
282  IF(EXISTS ${DIST_ZIP_NAME})
283    FILE(REMOVE ${DIST_ZIP_NAME})
284  ENDIF(EXISTS ${DIST_ZIP_NAME})
285  EXECUTE_PROCESS(
286    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
287    COMMAND ${ZIP_EXE} -9 -q -r ${DIST_ZIP_NAME} ${DIST_DIR}
288  )
289ELSE(ZIP_EXE)
290  MESSAGE(SEND_ERROR "No zip available to make .zip distribution.")
291ENDIF(ZIP_EXE)
292
293
294####################################################################
295#   LICENSE                                                        #
296####################################################################
297
298# Copyright (c) 2006 by Brandon J. Van Every
299#
300# Permission is hereby granted, free of charge, to any person obtaining
301# a copy of this software and associated documentation files (the "Software"),
302# to deal in the Software without restriction, including without limitation
303# the rights to use, copy, modify, merge, publish, distribute, sublicense,
304# and/or sell copies of the Software, and to permit persons to whom the
305# Software is furnished to do so, subject to the following conditions:
306#
307# The above copyright notice and this permission notice shall be included in
308# all copies or substantial portions of the Software.
309#
310# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
311# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
312# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
313# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
314# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
315# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
316# IN THE SOFTWARE.
Note: See TracBrowser for help on using the repository browser.