IN=$1 OUT=$2 # Make Mac OS X's tr and sed not complain that the files are not UTF-8 export LANG=en for file in $(cd $IN; ls *.h); do # Filter by file names. # Some CIncludes packages include the MPW standard library. # Header files from that standard library would overwrite # newlib header files and stop things from working. case $file in # Apple/MPW standard library internals *Def.h|FSpio.h) USE=false ;; # whitelist all uppercase headers [A-Z]*.h) USE=true ;; # whitelist OpenTransport cred.h|dlpi.h|miioccom.h|mistream.h|modnames.h) USE=true ;; # whitelist OpenTransport (continued) strlog.h|stropts.h|strstat.h|tihdr.h) USE=true ;; # Non-standard floating point headers that don't conflict ddrt.h|fp.h) USE=true ;; # newlib does not provide fenv.h, so use Apple's fenv.h) USE=true ;; # veclib headers v*.h) USE=true ;; # unsupported: intrinsics.h perf.h # all other (lowercase) headers: conflict with GCC or newlib headers *) USE=false ;; esac if [ $USE = true ]; then sed 's/\r$//' < $IN/$file | tr '\r' '\n' > $OUT/$file fi done ############################# ConditionalMacros.h ############################# cat > $OUT/ConditionalMacros.h <> $OUT/ConditionalMacros.h cat >> $OUT/ConditionalMacros.h < $OUT/fp.h <> $OUT/fp.h cat >> $OUT/fp.h < $OUT/MixedMode.h ############################# CGBase.h ############################# if [ -r $IN/CGBase.h ]; then cat > $OUT/CGBase.h < #include /* CGBase contains a hardcoded #ifdef that decides that stdint.h is available in MWERKS > 0x2300. ... otherwise, it contains an incompatible redefinition. */ #pragma push_macro("__MWERKS__") #define __MWERKS__ 0x6666 #define u_int32_t __cgbase_incompatible_u_int32_t END_MARKER sed 's/\r$//' < $IN/CGBase.h | tr '\r' '\n' >> $OUT/CGBase.h cat >> $OUT/CGBase.h < $OUT/$f elif [ ! -r $IN/Mac$f ]; then echo "#include \"$f\"" > $OUT/Mac$f fi done if [ -d $IN/CoreFoundation ]; then mkdir -p $OUT/CoreFoundation for file in $(cd $IN; ls CoreFoundation/*.h); do sed 's/\r$//' < $IN/$file | tr '\r' '\n' > $OUT/$file done fi