make-ios-headers.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # halt on error
  3. set -e
  4. # change
  5. SDKBASEPATH=/Developer/Platforms/iPhoneOS.Platform/Developer/SDKs/iPhoneOS4.2.sdk
  6. if [ $# -ne 0 ]; then
  7. SDKBASEPATH="$1"
  8. fi
  9. if [ ! -d "$SDKBASEPATH" ]; then
  10. echo iOS SDK base path \"$SDKBASEPATH\"
  11. echo not found, specify it as the first parameter to this script.
  12. echo Note that this parser version has only been verified to work with the
  13. echo iOS SDK 4.2
  14. echo
  15. exit 1
  16. fi
  17. # convert uikit and related framework headers
  18. php parser.php -objp -all -frameworks=foundation,quartzcore,opengles,uikit -root=`pwd`/uikit-skel/src -framework_path="$SDKBASEPATH"/System/Library/Frameworks
  19. # correct some translations the automatic translation cannot handle
  20. patch -p0 < patches/uikit-4.2.patch
  21. # rename badly named unit and include file
  22. sed -e 's/AnonClassDefinitionsQuartzcore/AnonClassDefinitionsUikit/' < uikit-skel/src/AnonClassDefinitionsQuartzcore.pas > uikit-skel/src/AnonClassDefinitionsUikit.pas
  23. mv uikit-skel/src/quartzcore/AnonIncludeClassDefinitionsQuartzcore.inc uikit-skel/src/uikit/AnonIncludeClassDefinitionsUikit.inc
  24. rm uikit-skel/src/AnonClassDefinitionsQuartzcore.pas
  25. # empty two include files that are part of the RTL objcbase unit
  26. echo > uikit-skel/src/foundation/NSObject.inc
  27. echo > uikit-skel/src/foundation/NSZone.inc
  28. echo
  29. echo The headers have been converted and placed under
  30. echo `pwd`/uikit-skel/src.
  31. echo If you wish to compile them, execute the following commands:
  32. echo cd uikit-skel/src
  33. echo ppcarm -XR$SDKBASEPATH -FD`echo $SDKBASEPATH|sed -e 's+/SDKs/[^/]*sdk$++'`/usr/bin -O2 -ap -Cfvfpv2 iPhoneAll.pas
  34. echo
  35. echo The compiled files can be installed afterwards by copying iPhoneAll.{o,ppu} and
  36. echo AnonClassDefinitionsUikit.{o,ppu} to a directory in your FPC unit path.
  37. echo