chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] CMake MinGW MSYS build


From: Brandon J. Van Every
Subject: [Chicken-users] CMake MinGW MSYS build
Date: Sat, 25 Feb 2006 01:30:22 -0800
User-agent: Thunderbird 1.5 (Windows/20051201)

Sorry I haven't had time to figure out Darcs in the past couple of days. For those who might want them, here are my latest CMakeLists.txt and INSTALL-MinGW.txt. Note that you need CMake 2.3 to build, and this is a development version of CMake. If you don't want to build it yourself, e-mail me for a binary.

Cheers,
Brandon Van Every

CMAKE_MINIMUM_REQUIRED(VERSION 2.3)
PROJECT(Chicken)


INCLUDE_DIRECTORIES(${Chicken_SOURCE_DIR}) 


# I removed some of the -D options you had,
# you may want to add some back, but make sure to use TRY_COMPILE stuff so
# this works on all platforms.   


#All our various optional libraries go in here.
SET(EXTRA_LIBS )


# The autoconf build uses this define.
# How is it supposed to be determined?
#ADD_DEFINITIONS(-DC_STACK_GROWS_DOWNWARD)


# Get rid of gazillion MSVC warnings
IF(MSVC)
  # only tell us once about unused local variables
  # unfortunately, MSVC receives this flag and ignores it.  Bah!
  ADD_DEFINITIONS(/Wo4101)
ENDIF(MSVC)


# Does MinGW need some of these flags?
IF(MSVC)
  ADD_DEFINITIONS(-DC_DEFAULT_TARGET_STACK_SIZE=300000)
  ADD_DEFINITIONS(-DHAVE_LOADLIBRARY)
  ADD_DEFINITIONS(-DHAVE_GETPROCADDRESS)
ENDIF(MSVC)


# check for socklen_t type
INCLUDE(CheckTypeSize)
IF(WIN32 AND NOT CYGWIN)
  # This isn't working.
  SET(CMAKE_EXTRA_INCLUDE_FILES WS2tcpip.h)
ELSE(WIN32 AND NOT CYGWIN)
  SET(CMAKE_EXTRA_INCLUDE_FILES netdb.h)
ENDIF(WIN32 AND NOT CYGWIN)
CHECK_TYPE_SIZE(socklen_t SIZEOF_SOCKLEN_T)
IF(NOT SIZEOF_SOCKLEN_T)
#  Generates an error on MSVC.
#  Need a cleaner, mo' betta way to do this.
#  Probably means doing more work to find the right .h files.
#  ADD_DEFINITIONS(-Dsocklen_t=int)
ENDIF(NOT SIZEOF_SOCKLEN_T)


# check for grp.h
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE(grp.h HAVE_GRP_H)
IF(HAVE_GRP_H)
  ADD_DEFINITIONS(-DHAVE_GRP_H)
ENDIF(HAVE_GRP_H)


# check for pcre.h
CHECK_INCLUDE_FILE(pcre.h HAVE_PCRE_H)
IF(HAVE_PCRE_H)
  ADD_DEFINITIONS(-DHAVE_PCRE_H)
  SET(REGEX_SOURCE pcre.c)
  SET(REGEX_UNSAFE_SOURCE upcre.c)
  SET(EXTRA_LIBS ${EXTRA_LIBS} pcre)
ELSE(HAVE_PCRE_H)
  IF(WIN32 AND NOT CYGWIN)
    SET(REGEX_SOURCE pregexp.c)
    SET(REGEX_UNSAFE_SOURCE upregexp.c)
  ELSE(WIN32 AND NOT CYGWIN)
    SET(REGEX_SOURCE regex.c)
    SET(REGEX_UNSAFE_SOURCE uregex.c)
  ENDIF(WIN32 AND NOT CYGWIN)
ENDIF(HAVE_PCRE_H)


# check for dlfcn.h or dl.h
CHECK_INCLUDE_FILE(dlcfn.h HAVE_DLFCN_H)
IF(HAVE_DLFCN_H)
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
  SET(EXTRA_LIBS ${EXTRA_LIBS} dl)
ENDIF(HAVE_DLFCN_H)
CHECK_INCLUDE_FILE(dl.h HAVE_DL_H)
IF(HAVE_DL_H)
  ADD_DEFINITIONS(-DHAVE_DL_H)
  SET(EXTRA_LIBS ${EXTRA_LIBS} ldl)
ENDIF(HAVE_DL_H)


# check for ffi.h
CHECK_INCLUDE_FILE(ffi.h HAVE_FFI_H)
IF(HAVE_FFI_H)
  ADD_DEFINITIONS(-DHAVE_FFI_H)
  SET(EXTRA_LIBS ${EXTRA_LIBS} ffi)
ENDIF(HAVE_FFI_H)


# check for windows.h
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
IF(HAVE_WINDOWS_H)
  ADD_DEFINITIONS(-DHAVE_WINDOWS_H)
ENDIF(HAVE_WINDOWS_H)


# give the user an option to enable support for procedure-serialiazation
OPTION(ENABLE_PROCEDURE_TABLES "enable support for serialization of procedures" 
FALSE)
IF(ENABLE_PROCEDURE_TABLES)
  ADD_DEFINITIONS(-DC_ENABLE_PTABLES)
ENDIF(ENABLE_PROCEDURE_TABLES)


# create a list of all the sources
SET (CHICKEN_LIB_SOURCES    
    runtime.c           library.c 
    eval.c              profiler.c 
    scheduler.c         extras.c
    match-support.c     lolevel.c
    stub.c              tinyclos.c
    ${REGEX_SOURCE}     utils.c
    tcp.c               
    srfi-1.c            srfi-4.c
    srfi-13.c           srfi-14.c
    srfi-18.c)
SET (CHICKEN_UNSAFE_LIB_SOURCES    
    runtime.c           ulibrary.c 
    ueval.c              profiler.c 
    scheduler.c         uextras.c
    umatch-support.c     ulolevel.c
    stub.c              utinyclos.c
    ${REGEX_UNSAFE_SOURCE}     uutils.c
    utcp.c               
    usrfi-1.c            usrfi-4.c
    usrfi-13.c           usrfi-14.c
    usrfi-18.c)
SET (CHICKEN_GUI_LIB_SOURCES    
    runtime.c           gui-library.c 
    eval.c              profiler.c 
    scheduler.c         extras.c
    match-support.c    lolevel.c
    stub.c              tinyclos.c
    ${REGEX_SOURCE}     utils.c
    tcp.c               
    srfi-1.c            srfi-4.c
    srfi-13.c           srfi-14.c
    srfi-18.c)


# add a posix source based on OS
IF(WIN32 AND NOT CYGWIN)
  SET (CHICKEN_LIB_SOURCES    ${CHICKEN_LIB_SOURCES}  posixwin.c)
  SET (CHICKEN_UNSAFE_LIB_SOURCES    ${CHICKEN_UNSAFE_LIB_SOURCES}  uposixwin.c)
ENDIF(WIN32 AND NOT CYGWIN)
IF(UNIX)
  SET (CHICKEN_LIB_SOURCES ${CHICKEN_LIB_SOURCES} posix.c)
  SET (CHICKEN_UNSAFE_LIB_SOURCES ${CHICKEN_UNSAFE_LIB_SOURCES} uposix.c)
ENDIF(UNIX)


# since libchicken has to be the name of the dll or .so to load
# On unix lib is the default prefix added to any library.
# For windows we change the name of the library to be libchicken.
# Note: GCC based compilers, i.e. Cygwin, MinGW, behave like Unix.
# In general, be careful about whether NOT CYGWIN or
# NOT CMAKE_COMPILER_IS_GNUCC is really intended.
# Setting the PREFIX to "" works on all platforms.


# create the chicken library
ADD_LIBRARY(libchicken SHARED ${CHICKEN_LIB_SOURCES})
SET_TARGET_PROPERTIES(libchicken PROPERTIES
  PREFIX "" IMPORT_PREFIX "")
ADD_LIBRARY(libchicken-static STATIC ${CHICKEN_LIB_SOURCES})
SET_TARGET_PROPERTIES(libchicken-static PROPERTIES
  PREFIX "" IMPORT_PREFIX "")
ADD_LIBRARY(libuchicken SHARED ${CHICKEN_UNSAFE_LIB_SOURCES})
SET_TARGET_PROPERTIES(libuchicken PROPERTIES
  PREFIX "" IMPORT_PREFIX "")
ADD_LIBRARY(libuchicken-static STATIC ${CHICKEN_UNSAFE_LIB_SOURCES})
SET_TARGET_PROPERTIES(libuchicken-static PROPERTIES
  PREFIX "" IMPORT_PREFIX "")
IF(WIN32 AND NOT CYGWIN)
  ADD_LIBRARY(libchicken_gui SHARED ${CHICKEN_LIB_SOURCES})
  SET_TARGET_PROPERTIES(libchicken_gui PROPERTIES
    PREFIX "" IMPORT_PREFIX "")
  ADD_LIBRARY(libchicken_gui-static STATIC ${CHICKEN_LIB_SOURCES})
  SET_TARGET_PROPERTIES(libchicken_gui-static PROPERTIES
    PREFIX "" IMPORT_PREFIX "")
ENDIF(WIN32 AND NOT CYGWIN)


# Shared and static libraries are built with different flags.
# In CMake, SET(x a b c) produces x="a;b;c"
# SET(x "a b c") produces x="a b c", which is what we want.
SET(SHARED_FLAGS -DPIC)
  IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    SET(SHARED_FLAGS "${SHARED_FLAGS} -fno-common -no-cpp-precomp")
  ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(STATIC_FLAGS -DC_NO_PIC_NO_DLL)

# tell it to define C_BUILDING_LIBCHICKEN when building .o files that go in 
chicken_lib
SET_TARGET_PROPERTIES(libchicken PROPERTIES COMPILE_FLAGS
  "-DC_BUILDING_LIBCHICKEN ${SHARED_FLAGS}")
SET_TARGET_PROPERTIES(libchicken-static PROPERTIES COMPILE_FLAGS
  "-DC_BUILDING_LIBCHICKEN ${STATIC_FLAGS}")
SET_TARGET_PROPERTIES(libuchicken PROPERTIES COMPILE_FLAGS
  "-DC_BUILDING_LIBCHICKEN -DC_UNSAFE_RUNTIME ${SHARED_FLAGS}")
SET_TARGET_PROPERTIES(libuchicken-static PROPERTIES COMPILE_FLAGS
  "-DC_BUILDING_LIBCHICKEN -DC_UNSAFE_RUNTIME ${STATIC_FLAGS}")
IF(WIN32 AND NOT CYGWIN)
  SET_TARGET_PROPERTIES(libchicken_gui PROPERTIES COMPILE_FLAGS
    "-DC_BUILDING_LIBCHICKEN -DC_WINDOWS_GUI ${SHARED_FLAGS}")
  SET_TARGET_PROPERTIES(libchicken_gui-static PROPERTIES COMPILE_FLAGS
    "-DC_BUILDING_LIBCHICKEN -DC_WINDOWS_GUI ${STATIC_FLAGS}")
ENDIF(WIN32 AND NOT CYGWIN)



# add ws2_32 for windows and -lm for unix
IF(WIN32)
  # Here, we actually want set(x a b c), no quotes
  SET(EXTRA_LIBS ${EXTRA_LIBS} ws2_32)
ELSE(WIN32)
  # Here, we actually want set(x a b c), no quotes
  SET(EXTRA_LIBS ${EXTRA_LIBS} m)
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(libchicken ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(libchicken-static ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(libuchicken ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(libuchicken-static ${EXTRA_LIBS})

# only need libchicken_gui.lib on Windows
# apparently EXTRA_LIBS not needed here?
IF(WIN32 AND NOT CYGWIN)
  # Here, we actually want set(x a b c), no quotes
  SET(GUI_LIBS kernel32 user32 gdi32 ws2_32)
  TARGET_LINK_LIBRARIES(libchicken_gui ${GUI_LIBS})
  TARGET_LINK_LIBRARIES(libchicken_gui-static ${GUI_LIBS})
ENDIF(WIN32 AND NOT CYGWIN)


# source files for chicken.exe 
SET (CHICKEN_EXE_SOURCES 
    chicken.c       support.c
    partition.c     easyffi.c
    compiler.c      optimizer.c
    batch-driver.c  c-platform.c
    c-backend.c     chicken.rc)
# create chicken executable
ADD_EXECUTABLE(chicken ${CHICKEN_EXE_SOURCES})
SET_TARGET_PROPERTIES(chicken PROPERTIES COMPILE_FLAGS "${SHARED_FLAGS}")
TARGET_LINK_LIBRARIES(chicken libchicken)

ADD_EXECUTABLE(chicken-static ${CHICKEN_EXE_SOURCES})
SET_TARGET_PROPERTIES(chicken-static PROPERTIES COMPILE_FLAGS "${STATIC_FLAGS}")
TARGET_LINK_LIBRARIES(chicken-static libchicken-static)


# get the path for chicken after it is built to be used in custom commands
GET_TARGET_PROPERTY(CHICKEN_PATH chicken LOCATION)


# create csc.scm
CONFIGURE_FILE(${Chicken_SOURCE_DIR}/csc.scm.in ${Chicken_BINARY_DIR}/csc.scm)

# Is this macro affected by shared vs. static library flags?
# Where is 'unsafe' getting its input from?
MACRO(GENERATE_CHICKEN_FILE input output prologue)
  IF(${prologue})
    SET(PROLOGUE -prologue ${prologue})
  ELSE(${prologue})
    SET(PROLOGUE )
  ENDIF(${prologue})
  IF(${unsafe})
    SET(UNSAFE -unsafe)
  ELSE(${unsafe})
    SET(UNSAFE )
  ENDIF(${unsafe})
  ADD_CUSTOM_COMMAND(OUTPUT ${output}
    COMMAND ${CHICKEN_PATH}
    ARGS ${input}
    -optimize-level 2 -no-trace -quiet
    -include-path ${Chicken_SOURCE_DIR} 
    -output-file ${output}
    ${UNSAFE}
    ${PROLOGUE}
    DEPENDS ${CHICKEN_PATH}
    )
  SET_SOURCE_FILES_PROPERTIES( ${output} PROPERTIES GENERATED true)    
ENDMACRO(GENERATE_CHICKEN_FILE)


# create csi.c with chicken 
GENERATE_CHICKEN_FILE(
  ${Chicken_SOURCE_DIR}/csi.scm
  ${Chicken_BINARY_DIR}/csi.c
  ${Chicken_SOURCE_DIR}/build.scm)
ADD_EXECUTABLE(csi ${Chicken_BINARY_DIR}/csi.c)
ADD_DEPENDENCIES(csi chicken)
SET_TARGET_PROPERTIES(csi PROPERTIES COMPILE_FLAGS "${SHARED_FLAGS}")
TARGET_LINK_LIBRARIES(csi libchicken)

ADD_EXECUTABLE(csi-static ${Chicken_BINARY_DIR}/csi.c)
ADD_DEPENDENCIES(csi-static chicken)
SET_TARGET_PROPERTIES(csi-static PROPERTIES COMPILE_FLAGS "${STATIC_FLAGS}")
TARGET_LINK_LIBRARIES(csi-static libchicken-static)


# create csc.c with chicken
GENERATE_CHICKEN_FILE(
  ${Chicken_BINARY_DIR}/csc.scm
  ${Chicken_BINARY_DIR}/csc.c
  0)
ADD_EXECUTABLE(csc ${Chicken_BINARY_DIR}/csc.c)
ADD_DEPENDENCIES(csc chicken)
SET_TARGET_PROPERTIES(csc PROPERTIES COMPILE_FLAGS "${SHARED_FLAGS}")
TARGET_LINK_LIBRARIES(csc libchicken)
# Felix says csc-static isn't necessary.

# create chicken-profile.c with chicken
GENERATE_CHICKEN_FILE(
  ${Chicken_SOURCE_DIR}/chicken-profile.scm 
  ${Chicken_BINARY_DIR}/chicken-profile.c
  0)
ADD_EXECUTABLE(chicken-profile ${Chicken_BINARY_DIR}/chicken-profile.c)
ADD_DEPENDENCIES(chicken-profile chicken)
SET_TARGET_PROPERTIES(chicken-profile PROPERTIES COMPILE_FLAGS 
"${SHARED_FLAGS}")
TARGET_LINK_LIBRARIES(chicken-profile libchicken)


# create chicken-setup.c with chicken
GENERATE_CHICKEN_FILE(
  ${Chicken_SOURCE_DIR}/chicken-setup.scm 
  ${Chicken_BINARY_DIR}/chicken-setup.c
  0)
ADD_EXECUTABLE(chicken-setup ${Chicken_BINARY_DIR}/chicken-setup.c)
ADD_DEPENDENCIES(chicken-setup chicken)
SET_TARGET_PROPERTIES(chicken-setup PROPERTIES COMPILE_FLAGS "${SHARED_FLAGS}")
TARGET_LINK_LIBRARIES(chicken-setup libchicken)


# installation targets
INSTALL_TARGETS(/
  chicken chicken-setup csi chicken-profile csc
  chicken-static csi-static)
INSTALL_FILES(/ .scm chicken-ffi-macros chicken-match-macros 
chicken-more-macros)
IF(WIN32)
  INSTALL_FILES(/ .bat csibatch)
ENDIF(WIN32)


#INSTALL_TARGETS(/ RUNTIME_DIRECTORY /
#  libchicken libuchicken libchicken-static libuchicken-static)
INSTALL(TARGETS libchicken libuchicken RUNTIME DESTINATION "")
INSTALL(TARGETS libchicken-static libuchicken-static DESTINATION "")
IF(WIN32 AND NOT CYGWIN)
#  INSTALL_TARGETS(/ RUNTIME_DIRECTORY /
#    libchicken_gui libchicken_gui-static)
   INSTALL(TARGETS libchicken_gui RUNTIME DESTINATION "")
   INSTALL(TARGETS libchicken_gui-static DESTINATION "")
ENDIF(WIN32 AND NOT CYGWIN)

INSTALL_FILES(/ .h chicken)
INSTALL_FILES(/ .1 chicken csi csc chicken-setup chicken-profile)
INSTALL_FILES(/ .pdf chicken)


#
# TODO: 
#
# - nsample + nursery benchmarking
# - patching of csc
#
How to build Chicken Scheme using CMake and MinGW
-------------------------------------------------

by Brandon Van Every
Windows buildmaster for Chicken
last updated February 3, 2006

If in trouble, please contact me through the Chicken mailing list.  You can 
subscribe to the list from the Chicken homepage, 
http://call-with-current-continuation.org.



EXECUTIVE SUMMARY
-----------------

- Install MinGW
- Install MSYS
- Install CMake
- Install the Microsoft Platform SDK and set environment variables for MSYS
- Test your installed tools
- unpack a Chicken release or snapshot tarball
- run cmakesetup from a MSYS shell, select "Unix Makefiles" and generate them
- make; make install
- test your Chicken installation


BENEFITS OF CMake
-----------------

In principle, a CMake build is no more difficult than running a GNU Autoconf 
.\configure script.  CMake is designed to replace Autoconf.  It provides the 
same functionality of querying the system and available libraries.  It can 
generate Makefiles, and unlike Autoconf, it can also generate Visual C++ 
project files, Windows nmake files, and even Borland makefiles.  Watcom file 
generation is also in development.  CMake is a true cross-platform build tool, 
not just a Unix build tool.  It's what us Windows guys *wish* GNU Autoconf was, 
so now we can stop wishing!  Unixen may find it convenient as well, if they are 
not too settled in their ways.  Also GCC is supported on the Mac under Darwin, 
although I'm unsure how robust it is.  For full details on CMake and supported 
platforms, look at http://cmake.org.

These instructions can, in principle, be used to build Chicken with any 
compiler on any platform that CMake supports.  In practice, if the combo isn't 
tested then it won't work.  Currently these instructions only ensure a MinGW 
build.  I plan to add Visual Studio and Cygwin builds once the MinGW build is 
perfected.



INSTALL MinGW
-------------

The least painful way to install MinGW is to install the Dev-C++ IDE.  It's 
free, and even if you don't use it, the packaging mechanism is excellent.  You 
will find the packaging comes in very handy when you need MinGW versions of 
open source libraries; compiling them yourself on Windows is usually a PITA.  
The packaging mechanism can even be used in a standalone fashion if you really 
really resent the IDE.  Get Dev-C++ from 
http://www.bloodshed.net/dev/devcpp.html.  Get the version that includes MinGW.



INSTALL MSYS
------------

Goto http://mingw.org download section, grab MSYS, and install it.

During the install, a command shell will pop up and perform a "post install" 
operation to rectify MSYS with your MinGW installation.  This is because the 
Make utility is different for MinGW and MSYS.  When using MSYS, you want to use 
MSYS's version of it.  You will be asked some questions; answer them in a 
straightforward manner, similar to the following:

  "Do you want to continue with the post install?" YES [y]
  "Do you have MinGW installed?" YES [y]
  "Where is your MinGW installation?"  C:/Dev-Cpp
  "Oh joy, you do not have C:/Dev-Cpp/bin/make.exe.  Keep it that way."
  [alternately it may rename make.exe to mingw32-make.exe]
  "Press any key to continue . . ."  [DO SO]

The command prompt now goes away, you are returned to the MSYS Setup.exe 
installer, and you can Click Finish to exit Setup.



INSTALL CMake
----------------

Goto http://cmake.org download section, grab CMake, and install it.  CMake 2.3 
or later is required.  

INTERIM NOTE: CMake 2.3 is a development version that has to be compiled from 
source.  Once CMake 2.4 ships, this interim note will go away.  Contact me via 
the Chicken mailing list to obtain a working binary, if you don't want to 
download from CVS and compile from source.  Be advised that the Windows version 
of CMake relies on Microsoft Foundation Classes, and consequently a 
commercially licensed copy of Visual C++ is needed to build it.  The free 
VCToolkit, and the free Visual Express development environment, do not include 
MFC.  The Platform SDK has a version of MFC for AMD64, but it cannot build a 
"regular" MFC without significant alterations to the source code.  Don't try 
that; you will suffer needless pain.  



INSTALL The Microsoft Platform SDK
----------------------------------

Goto http://msdn.microsoft.com and grab one of the following Platform SDK 
packages:

  Windows Server 2003 SP1 Platform SDK ISO Install    [for burning a CD image]
  Windows Server 2003 SP1 Platform SDK Full Download  [a series of 25MB files]
  Windows Server 2003 SP1 Platform SDK Web Install    [for installing over the 
web]

Microsoft changes their website a lot, so there's no point in giving you an 
exact URL.  Who knows, the name of the "Platform SDK" may also change.  As of 
February 2006, this is what you want if you are going to build stuff on Windows 
2000 or XP.

Install the package.  During the install, be sure to REGISTER ENVIRONMENT 
VARIABLES.  They are not registered by default.  For this you will need to do 
"Custom Installation.. Configuration Options.. Register Environment Variables.. 
Will Be Installed On Local Hard Drive."

The PSDK provides a SetEnv.Cmd file to set the environment variables, but it 
has the annoying habit of searching for VC++.  If found, it adds lotsa VC++ 
environment variables.  You don't want these for a MinGW build, they could 
cause problems.  There's no clean way to disentangle this behavior; Microsoft 
believes you want to use VC++.  ;-)  So, be sure to REGISTER ENVIRONMENT 
VARIABLES.

Why is the PSDK needed at all?  Well, if you don't have it, then chicken.exe 
gets built, but fails immediately with a memory write error the first time it 
is used during the build.  I don't know what the dependency is exactly, 
although I've deduced that it's an include and library dependency, not a PATH 
dependency.  Removing the PSDK from your PATH will not affect the build, but 
INCLUDE, LIB, MSSDK, and MSTOOLS all seem to be needed.



TEST YOUR PSDK, MinGW, and MSYS INSTALLATIONS
---------------------------------------------

Open a MSYS shell.  There's probably an icon on your desktop to do this.  Type:

  set

You should see environment variables like:

COMMONPROGRAMFILES='C:\Program Files\Common Files'
INCLUDE='C:\Program Files\Microsoft Platform SDK\Include\.'
INETSDK='C:\Program Files\Microsoft Platform SDK\.'
LIB='C:\Program Files\Microsoft Platform SDK\Lib\.'
MSSDK='C:\Program Files\Microsoft Platform SDK\.'
MSTOOLS='C:\Program Files\Microsoft Platform SDK\.'
PATH='.:/usr/local/bin:/mingw/bin:/bin:/c/WINNT/system32:/c/WINNT:/c/WINNT/System32/Wbem:/e/Program
 Files/Microsoft Platform SDK/Bin/.:/e/Program Files/Microsoft Platform 
SDK/Bin/WinNT/.'

Now type:

  gcc --version

You should see something like "gcc.exe (GCC) 3.4.2 (mingw special)".  Now type:

  chicken -version

YOU SHOULD GET A "COMMAND NOT FOUND" ERROR.  You're not supposed to have any 
Chicken yet!  If you've got an old build lying around that failed for some 
reason, either get rid of it, or get it out of your PATH.  It could interfere 
with your new build.



Build Chicken with CMake
------------------------

Grab a Chicken release or snapshot tarball from 
http://www.call-with-current-continuation.org.

You must use a tarball to get the needed *.c files.  The CMake build does not 
currently support bootstrapping straight from the Darcs source control 
repository, although I'll add this in the future.

Unpack the tarball wherever you like.  These instructions will assume the 
source code is in C:\src\chicken.  You'll be doing an "out of directory" build, 
i.e. nothing in the source directory will ever be changed.  I'll assume you 
want to build everything in C:\msys-build\chicken.

Open CMakeSetup.exe.  A window pops up.  Fill out the fields as follows:

  "Where is the source code:" C:\src\chicken
  "Where to build the binaries:" C:\msys-build\chicken

Now hit "Configure".  A dialog box will ask you to Select the Generator.  
Choose "MSYS Makefiles" as your generator and hit OK.  You now have the 
opportunity to change various settings if you wish, such as the 
CMAKE_INSTALL_PREFIX.  This is the directory that Chicken will eventually be 
installed in after it is built; the default is something like C:\Program 
Files\Chicken.  Uncommitted settings appear in red.  Once you've changed what 
you like, hit "Configure" again.  Now the settings will change to grey and the 
message "Configuring done" will appear in the status bar.  Hit "OK" to exit 
cmakesetup.

You should now have a bunch of files, including a Makefile, in your 
C:\msys-build\chicken directory.  In your MSYS shell, change to this directory. 
 MSYS uses /c to represent the C: drive, so do "cd /c/msys-build/chicken".  Now 
type "make".  Everything should build; you may receive warnings, but you should 
receive no errors.

Now type "make install".  C:\Program Files\Chicken should be populated with the 
following files:

chicken-ffi-macros.scm
chicken-match-macros.scm
chicken-more-macros.scm
chicken-profile.1
chicken-profile.exe
chicken-setup.1
chicken-setup.exe
chicken-static.exe
chicken.1
chicken.exe
chicken.h
chicken.pdf
csc.1
csc.exe
csi-static.exe
csi.1
csi.exe
csibatch.bat
libchicken-static.a
libchicken.dll
libchicken_gui-static.a
libchicken_gui.dll
libuchicken-static.a
libuchicken.dll

Now put Chicken in your PATH.  Right click on "My Computer."  Select 
"Properties... Advanced... Environment Variables...."  Under "System 
Variables," select "Path" and click "Edit...."  Add the following to the end of 
your path:

  ;C:\Program Files\Chicken\bin

Note the ; separator.



TEST YOUR Chicken INSTALLATION
------------------------------

Close your MSYS shell.  Open a new shell; it can be a MSYS shell, or a plain 
old Windows Command Prompt.  Change to any directory other than your 
C:\dest\chicken directory, to make sure that your PATH is set up correctly.  
Type:

  chicken -version

You should see a banner like:

 )   ___
(__/_____) /)   ,    /)
  /       (/      _ (/_   _ __
 /        / )__(_(__/(___(/_/ (_
(______)
Version 2, Build 216 - windows-mingw32-x86 - [ dload ptables ]
(c)2000-2005 Felix L. Winkelmann


[TODO: HOW ABOUT SOME MORE STRINGENT TESTS?]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]