Changeset 27883 in project


Ignore:
Timestamp:
11/28/12 19:02:59 (7 years ago)
Author:
Christian Kellermann
Message:

Added chicken-config.h to description of distributing C files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/man/4/Using the compiler

    r27461 r27883  
    395395It is relatively easy to create distributions of Scheme projects that
    396396have been compiled to C.  The runtime system of CHICKEN consists of only
    397 two handcoded C files ({{runtime.c}} and {{chicken.h}}), plus
     397three handcoded C files ({{runtime.c}} and {{chicken.h}}), plus
    398398the file {{chicken-config.h}}, which is generated by the build process. All
    399399other modules of the runtime system and the extension libraries are just
     
    412412  % csc -t hello.scm -optimize-level 3 -output-file hello.c
    413413
    414 Compiled to C, we get {{hello.c}}. We need the files {{chicken.h}} and
    415 {{runtime.c}}, which contain the basic runtime system, plus the three
    416 basic library files {{library.c}}, {{eval.c}} and {{build-version.c}}
    417 which contain the same functionality as the library linked into a
    418 plain CHICKEN-compiled application, or which is available by default
    419 in the interpreter, {{csi}}:
     414Compiled to C, we get {{hello.c}}. We need the files {{chicken.h}},
     415{{chicken-config.h}} and {{runtime.c}}, which contain the basic
     416runtime system, plus the three basic library files {{library.c}},
     417{{eval.c}} and {{build-version.c}} which contain the same functionality
     418as the library linked into a plain CHICKEN-compiled application,
     419or which is available by default in the interpreter, {{csi}}:
     420
    420421
    421422  % cd /tmp
     
    425426  % cp $CHICKEN_BUILD/eval.c    .
    426427  % cp $CHICKEN_BUILD/extras.c  .
    427   % gcc -static -Os -fomit-frame-pointer runtime.c build-version.c library.c eval.c \
    428     hello.c -o hello -lm
     428  % cp $CHICKEN_BUILD/chicken.h  .
     429  % cp $CHICKEN_BUILD/chicken-config.h  .
     430  % gcc -static -Os -fomit-frame-pointer -DHAVE_CHICKEN_CONFIG runtime.c build-version.c \
     431     library.c eval.c hello.c -o hello -lm
    429432
    430433Now we have all files together, and can create an tarball containing all the files:
    431434
    432  % tar cf hello.tar Makefile hello.c runtime.c build-version.c library.c eval.c extras.c \
    433    chicken.h
     435 % tar cf hello.tar hello.c runtime.c build-version.c library.c eval.c extras.c \
     436   chicken.h chicken-config.h
    434437 % gzip hello.tar
    435438
     
    439442elaborate build-scripts, makefiles or by using autoconf/automake.
    440443
     444The chicken-config.h file may contain wrong settings for your
     445deployment target. Especially when the architecture is different.
     446In that case you will have to adjust the values as needed.
     447
    441448Note also that the size of the application can still be reduced by removing
    442449{{eval}} and compiling {{hello.scm}} with the {{-explicit-use}} option.
Note: See TracChangeset for help on using the changeset viewer.