freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Very very old CodeWarrior C compiler cannot parse directory-s


From: mpsuzuki
Subject: [ft-devel] Very very old CodeWarrior C compiler cannot parse directory-structured include files
Date: Tue, 14 Oct 2008 00:52:25 +0900

Hi CodeWarrior users,

Recently I've got still-sealed "CodeWarrior Gold 10"
which was released on 1994, and tried to build FreeType2
by this very very old CW.

I found following difficulties:

A) C preprocessor in legacy CW does not allow
   Unix-like pathname in "#include" directive.
   For example,

        #include <freetype/config/ftconfig.h>

   is refused. C preprocessor in legacy MPW
   had already supported Unix-like pathname,
   but legacy Metrowerks C preprocessor did not.

B) Legacy CW does not provide the interface to be
   used as gcc's "-Dxxx" (latest CW has such).
   All cpp definitions should be explicitly
   written in the header file.

The difficulty A is very serious, I think it's hard
to build FreeType2 without modification of header
files. In my experiment, I made small Makefile to
convert the pathname of header files to flat structure,
aslike:

include/freetype/freetype.h             -> freetype_freetype.h
include/freetype/config/ftconfig.h      -> config_ftconfig.h
include/freetype/internal/autohint.h    -> internal_autohint.h
include/freetype/internal/services/svbdf.h
                                        -> services_svbdf.h

# HFS has no 8.3 pathname restriction, but classic MacOS cannot
# recognize the long file name in HFS+. So strictly expanded
# pathname like "freetype_internal_services_svbdf.h" cannot be
# recognized correctly by classic MacOS application.

Also the definition of pathnames like:

        #define FT_CONFIG_STANDARD_LIBRARY_H  <config/ftstdlib.h>

should be replaced by flatten pathname:

        #define FT_CONFIG_STANDARD_LIBRARY_H  <config_ftstdlib.h>

The attached Makefile is a sample to do such conversion.

It makes flat-structured header files in builds/mac/cwide17/.
In addition, it inserts extra macros to ft2build.h.

Yet I'm not sure if I should distribute binary CW project file,
but the flat-structured header files are essential for the
building by legacy CW. So I will add builds/mac/Makefile to
automate the preparation before running CW itself.

Regards,
mpsuzuki

================================================================
.PHONY: make_flat_headers fix_ft2build_h

all: clean make_flat_headers fix_ft2build_h

make_flat_headers:
        cd include && \
        for f in `find [a-z]* -name '*.h'` ; \
        do \
                g=`echo $$f | tr '/' '_'` ; \
                g=`echo $$g | sed 's/freetype_internal_services_/services_/'` ; 
\
                g=`echo $$g | sed 's/freetype_internal_/internal_/'` ; \
                g=`echo $$g | sed 's/freetype_config_/config_/'` ; \
                echo Generate ../builds/mac/cwide17/$$g ; \
                sed -e 
'/^#define.*FT_.*_H.*<.*\.h>/s:/:_:g;/^#include.*<.*>/s:/:_:g' \
                    -e 's:freetype_internal_services_:services_:g' \
                    -e 's:freetype_internal_:internal_:g' \
                    -e 's:freetype_config_:config_:g' \
                        < $$f > ../builds/mac/cwide17/$$g ; \
                /Developer/Tools/SetFile -a l -c "MPS " -t TEXT 
../builds/mac/cwide17/$$g ; \
        done

fix_ft2build_h:
        ( echo '#define HAVE_FSSPEC 1' ; \
          echo '#define HAVE_FSREF 0' ; \
          echo '#define HAVE_QUICKDRAW_TOOLBOX 1' ; \
          echo '#define HAVE_QUICKDRAW_CARBON 0' ; \
          echo '#define HAVE_ATS 0' ; \
          echo '#define FT2_BUILD_LIBRARY' ; \
          echo '#define FT_CONFIG_CONFIG_H  <config_ftconfig.h>' ; \
          echo '#define FT_CONFIG_MODULES_H <config_ftmodule.h>' ) | \
        awk '{printf("#undef %s\n", $$2);print}' > 
builds/mac/cwide17/ft2build.in
        cat builds/mac/cwide17/ft2build.h >> builds/mac/cwide17/ft2build.in
        mv builds/mac/cwide17/ft2build.in builds/mac/cwide17/ft2build.h
        /Developer/Tools/SetFile -a l -c "MPS " -t TEXT 
builds/mac/cwide17/ft2build.h

clean:
        rm -f builds/mac/cwide17/*.h

resource:
        find . -name '*.[ch]' -exec /Developer/Tools/SetFile -a l -c "MPS " -t 
TEXT \{\} \;




reply via email to

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