tn0025.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. How to update a third party library to a newer version
  2. ======================================================
  3. 0. Introduction
  4. ---------------
  5. wxWidgets includes several third party libraries, i.e. libraries which are
  6. used by wxWidgets and distributed with it but which we don't maintain nor even
  7. modify, inasmuch as possible, ourselves. These libraries are developed by
  8. their maintainers and from time to time we need to replace the versions used
  9. by wxWidgets with newer versions.
  10. 1. Vendor branches
  11. ------------------
  12. Normally all third party libraries should be managed using Subversion vendor
  13. branches. I.e. we should have the latest version of the library under
  14. /wx/wxWidgets/vendor directory in the repository. Currently only expat, libpng
  15. and libtiff are handled like this, while libjpeg and zlib are not. Hopefully
  16. these exceptions will disappear soon, the rest of this note assumes that we
  17. are using a vendor branch for the library $(LIB).
  18. We also use $(OLD_VERSION) and $(VERSION) below for the current version of the
  19. library and the version we are upgrading to. $(OLD_VERSION) can be determined
  20. by doing
  21. svn ls https://svn.wxwidgets.org/svn/wx/wxWidgets/vendor/$(LIB)
  22. as normally it's the latest version present in this directory. You can, of
  23. course, also look at the library sources currently in the trunk to find out
  24. its version.
  25. NB: the instructions here are based on the Subversion documentation, see
  26. http://svnbook.red-bean.com/en/1.6/svn.advanced.vendorbr.html for more
  27. information about vendor branches.
  28. 2. Updating the current branch
  29. ------------------------------
  30. The first thing to do is to checkout a pristine copy of the version currently
  31. being used, e.g.
  32. cd /some/temp/directory
  33. svn checkout https://svn.wxwidgets.org/svn/wx/wxWidgets/vendor/$(LIB)/current $(LIB)
  34. Now delete all the old files:
  35. cd $(LIB)
  36. find . -type f -not -path '*/.svn/*' -exec rm {} \;
  37. or, if you are using zsh, just
  38. rm **/*(.)
  39. Next, get the version of the library you are updating to and unpack it into
  40. the same directory. Examine "svn status" output and add all the files with "?"
  41. in the first column using "svn add" and delete all the files with "!" in the
  42. first column using "svn rm".
  43. Finally commit and tag the new version:
  44. svn commit -m 'Update $(LIB) to $(VERSION).'
  45. svn cp https://svn.wxwidgets.org/svn/wx/wxWidgets/vendor/$(LIB)/current \
  46. https://svn.wxwidgets.org/svn/wx/wxWidgets/vendor/$(LIB)/$(VERSION) \
  47. -m 'Tagging $(LIB) $(VERSION).'
  48. You can now do
  49. rm -rf /some/temp/directory/$(LIB)
  50. as it won't be needed any longer.
  51. 3. Merging the current branch
  52. -----------------------------
  53. Now switch to wxWidgets checkout and run
  54. svn merge ^/wxWidgets/vendor/$(LIB)/$(OLD_VERSION) ^/wxWidgets/vendor/$(LIB)/current src/$(LIBDIR)
  55. Notice that you may need to escape the circumflexes with backslashes if they
  56. are special for your shell. Also notice that the directory of the library may
  57. be different from its name, e.g. we use libpng for the vendor branch but just
  58. png for the name of the directory.
  59. Unless you are very lucky, the merge will result in conflicts and you will
  60. need to resolve them by examining the differences -- this is the difficult
  61. part.
  62. Once everything was resolved, test your changes. As building the third party
  63. libraries is quite different between Unix and Windows, please do it under both
  64. platforms. Under Windows it's enough to just build everything as usual as the
  65. built-in libraries are used by default. Please build both static and dynamic
  66. wxWidgets libraries as some problems arise only in one of those configurations.
  67. Under Unix you need to configure with --with-$(LIB)=builtin option to ensure
  68. that the newly updated built-in version of the library is used and not the
  69. system version. If upgrading an image format library, please build and run the
  70. image sample. In any case, run the unit tests to check that everything still
  71. works.
  72. After testing and correcting the problems, simply commit your changes:
  73. svn commit -m 'Update $(LIB) to $(VERSION).' src/$(LIBDIR)
  74. 4. Special instructions for libpng
  75. ----------------------------------
  76. We use a special hack for libpng as we want to prefix all its symbols with
  77. "wx_" but don't want to use its build system which makes this easily possible
  78. (perhaps we should, but for now we don't). So, when upgrading libpng, you need
  79. to perform an extra step after merging the new version (and before committing
  80. your changes):
  81. Create a temporary build directory and run libpng configure from it using
  82. --with-libpng-prefix=wx_ option. Then run "make" (actually just "make png.lo"
  83. is sufficient as we don't really need to build the library) to create
  84. pnglibconf.h and pngprefix.h files in the build directory. And copy these
  85. files to src/png subdirectory of the wxWidgets source tree, overwriting the
  86. versions there.
  87. Notice that config.h generated by libpng configure is not used, we build it
  88. without -DHAVE_CONFIG_H as it works just fine without it on any ANSI C system
  89. (i.e. anywhere by now).