patch-policy.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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, portability issues
  11. or other things.
  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. Fetched 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.
  64. Upstreaming patches
  65. ~~~~~~~~~~~~~~~~~~~
  66. OpenADK tries to avoid any patches to the source code. If a patch could
  67. not be avoided, it should be tried to make the patch of a good quality to
  68. get it upstream. OpenADK tries to report any found issues and try to send
  69. in any upstream compatible patches.