patch-policy.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. [[patch-policy]]
  4. Patching a package
  5. ------------------
  6. While integrating a new package or updating an existing one, it may be
  7. necessary to patch the source of the software to get it cross-built within
  8. OpenADK. OpenADK offers an infrastructure to automatically handle this during
  9. the builds. Patches are provided within OpenADK, in the package directory;
  10. these typically aim to fix cross-compilation, libc support, or other such
  11. issues.
  12. Normally the patches are autogenerated via:
  13. ------------
  14. $ make package=<package> update-patches
  15. ------------
  16. Otherwise they are manually generated via:
  17. ------------
  18. $ diff -Nur <pkgname>-<pkgversion>.orig <pkgname>-<pkgversion> > package/<pkgname>/patches/xxx-description.patch
  19. ------------
  20. The string +xxx+ should be substituted by a number starting with 001. The
  21. patches will be applied in numeric order. You should either use the automatic
  22. patch generation or the manual patch creation for a package. Mixed usage is not
  23. supported.
  24. Format and licensing of the package patches
  25. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  26. Patches are released under the same license as the software that is
  27. modified.
  28. A message explaining what the patch does, and why it is needed, should
  29. be added in the header commentary of the patch.
  30. At the end, the patch should look like:
  31. ---------------
  32. add C++ support test
  33. --- configure.ac.orig
  34. +++ configure.ac
  35. @@ -40,2 +40,12 @@
  36. AC_PROG_MAKE_SET
  37. +
  38. +AC_CACHE_CHECK([whether the C++ compiler works],
  39. + [rw_cv_prog_cxx_works],
  40. + [AC_LANG_PUSH([C++])
  41. + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  42. + [rw_cv_prog_cxx_works=yes],
  43. + [rw_cv_prog_cxx_works=no])
  44. + AC_LANG_POP([C++])])
  45. +
  46. +AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
  47. ---------------
  48. Integrating patches found on the Web
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. When integrating a patch of which you are not the author, you have to
  51. add a few things in the header of the patch itself.
  52. Depending on whether the patch has been obtained from the project
  53. repository itself, or from somewhere on the web, add one of the
  54. following tags:
  55. ---------------
  56. Backported from: <some commit id>
  57. ---------------
  58. or
  59. ---------------
  60. Fetch from: <some url>
  61. ---------------
  62. It is also sensible to add a few words about any changes to the patch
  63. that may have been necessary.