README.Linden 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. 0. Pre-Checkin Checklist
  2. Performed from top of repo, default branch, head:
  3. [ ] Is tag 'current' at or near head of 'vendor'?
  4. hg heads
  5. hg tags
  6. [ ] Expected differences between vendor and default? Very
  7. little of the original source should be modified.
  8. hg diff -rcurrent pcre
  9. [ ] Are the 'vendor' and 'default' branch source directories
  10. 'pcre' and not 'pcre-<version>'?
  11. [ ] Does the pcregrep program (stage/bin/pcregrep) run as expected?
  12. Are the library bindings (ldd/otool/depends.exe) as expected?
  13. 1. Introduction
  14. Simple build of pcre library from http://www.pcre.org/.
  15. With 8.35 repo structure follows standard conventions (see section
  16. at end). Repo did not originally have a vendor branch so one was
  17. synthesized after-the-fact for 7.6.
  18. 2. Modifications
  19. For Linux and Mac, builds are fairly ordinary with a few options
  20. explicitly chosen:
  21. * UTF-8 support
  22. * Unicode properties support
  23. * Disabled JIT
  24. Windows isn't pretty and several approaches are possible. For
  25. this, I went with 'cmake' which was nominally already functional
  26. and was at least capable of doing the right thing with tests and
  27. generated header files. CMakeLists.txt was modified to support a
  28. /Z7 option on static library builds controlled by the
  29. Linden.Win32.Cache file. It also generates more status output
  30. after processing.
  31. But the model of the cmake writers was for fixed paths and the use
  32. of GUIs to configure the build. This doesn't work in a headless
  33. build environment so a cache preload file,
  34. pcre/Linden.Win32.Cache, was created with the desired build
  35. options. Cmake's cache preload code is, as usual, buggy and
  36. filenames need to be kept short. But this seems to get the job
  37. done and results in working unit tests and installation passes
  38. with only a little touch-up work needed after the build.
  39. An additional problem with cmake and our build environment is that
  40. the resulting INSTALL and RUN_TESTS projects are not part of the
  41. solution build. This gives our build_sln invocation of devenv
  42. errors as it trips over these disabled projects. 'msbuild' will
  43. work but you do need the .NET dev environment as the command lives
  44. down in it. 'devenv' invocations still work so that's what we do
  45. for the INSTALL and RUN_TESTS projects.
  46. * Should work, doesn't:
  47. build_sln INSTALL.vcxproj "Debug|Win32"
  48. * Does work, requires more junk in path:
  49. msbuild INSTALL.vcxproj /t:Build "/p:Configuration=Debug;Platform=Win32"
  50. * Ol' reliable:
  51. devenv PCRE.sln /Build "Debug|Win32" /Project INSTALL.vcxproj
  52. Another option was a custom Makefile. I actually had this working
  53. but decided to go with 'cmake' in the hope of getting project
  54. files that would do more of the work. Neither choice is a clear
  55. winner but cmake it is for now. Here's some additional information
  56. for anyone wanting to visit Windows builds:
  57. ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib/pcre-winpcre.mak
  58. (An nmake Makefile that does much of the work but leaves out the
  59. configuration steps.
  60. http://www.rexegg.com/pcregrep-pcretest.html
  61. (Binary build for Windows. Dig through that and you'll discover
  62. how they built their packages.)
  63. 3. Source Origin
  64. 8.35:
  65. http://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz/download
  66. 4. Package Contents
  67. Common:
  68. * include/pcre/pcrecpp.h
  69. * include/pcre/pcre_stringpiece.h
  70. * include/pcre/pcre_scanner.h
  71. * include/pcre/pcrecpparg.h
  72. * include/pcre/pcreposix.h
  73. * include/pcre/pcre.h
  74. Windows (debug and release):
  75. * lib/release/pcre.lib
  76. * lib/release/pcrecpp.lib
  77. * lib/release/pcreposix.lib
  78. * lib/debug/pcrecppd.lib
  79. * lib/debug/pcred.lib
  80. * lib/debug/pcreposixd.lib
  81. Mac OS X (debug and release):
  82. * lib/release/libpcrecpp.a
  83. * lib/release/libpcreposix.a
  84. * lib/release/libpcre.a
  85. * lib/debug/libpcrecpp.a
  86. * lib/debug/libpcreposix.a
  87. * lib/debug/libpcre.a
  88. Linux (debug and release):
  89. * lib/release/libpcrecpp.a
  90. * lib/release/libpcreposix.a
  91. * lib/release/libpcre.a
  92. * lib/debug/libpcrecpp.a
  93. * lib/debug/libpcreposix.a
  94. * lib/debug/libpcre.a
  95. 5. Consumers/Dependents
  96. Consumers of static/archive versions of this library should define
  97. PCRE_STATIC before including any header file. This prevents some
  98. declspec ugliness.
  99. Packages dependent on pcre which will need attention
  100. (autobuild.xml) after changes. This is not authoritative, use
  101. appropriate build tools to find all dependents.
  102. * colladadom
  103. * viewer
  104. ===================================================================
  105. Third-Party Library Repo Structure
  106. Introduction
  107. We want to have a way to capture local modifications to a third-party
  108. open-source project, such as libcurl, without needing write access to
  109. their public repository. We want to be able to carry forward such
  110. modifications to newer versions of the public project. All this
  111. should be independent of the organizational decision as to whether
  112. it's even desirable to try to submit our local modifications upstream.
  113. Fortunately, the Subversion folks articulated a process years ago that
  114. addresses this very requirement. They call it "Vendor Branches." The
  115. same tactic, suitably adapted, works with Mercurial too.
  116. The essence of the idea is that we capture and tag a particular
  117. snapshot of the open-source project. We develop our local
  118. modifications to that, and the repository tip incorporates them. But
  119. when we want to update to a newer version of the public project, we
  120. bring it into the repository in such a way that we can discover the
  121. changes from the original snapshot and the new one -- and then have
  122. Mercurial apply those deltas to the ''combined'' source.
  123. The following material is adapted from
  124. http://svnbook.red-bean.com/en/1.1/ch07s05.html, the Red Bean
  125. Subversion book, but recast for Mercurial. The Linden source for this
  126. material is an internal wiki. There may be superceding documentation
  127. on the public wiki when you read this. We recommend searching there
  128. for updates to conventions below. And note that each particular
  129. library may implement variations of this scheme.
  130. General Vendor Branch Management Procedure
  131. Managing vendor branches generally works like this. You create a
  132. named branch ("vendor") to store the vendor source snapshots. Then
  133. you import the third party code into that branch. Your modified
  134. branch (named "default") is based on "vendor". You always make your
  135. local changes to the default branch. With each new release of the
  136. code you are tracking you bring it into the "vendor" branch and merge
  137. the changes into "default", resolving whatever conflicts occur between
  138. your local changes and the upstream changes.
  139. Perhaps an example will help to clarify this algorithm. We'll use a
  140. scenario where your development team is creating a calculator program
  141. that links against a third-party complex number arithmetic library,
  142. libcomplex. We'll construct a repository specifically for our
  143. locally-modified version of that library. To begin, we must
  144. initialize our repository and create at least one file in our
  145. "default" branch.
  146. $ hg init ourcomplex
  147. $ cd ourcomplex
  148. $ touch README.txt
  149. $ hg commit README.txt
  150. Now we can create the vendor branch and do the import of the first
  151. vendor drop. We'll call our vendor branch "vendor", and each
  152. successive code drop will be tagged "current".
  153. $ hg branch vendor
  154. $ tar -xjf ../libcomplex-1.0.tar.bz2
  155. $ mv libcomplex-1.0 libcomplex
  156. $ hg addremove
  157. $ hg commit -m "1.0 source drop"
  158. $ hg tag -r tip current
  159. $ hg tag -r current 1.0
  160. We now have the current version of the libcomplex source code in
  161. branch "vendor", tagged "current" and in a non-version-specific source
  162. code subdirectory ("libcomplex"). Next, we merge it into the default
  163. branch. It is in the default branch that we will make our
  164. customizations.
  165. $ hg update default
  166. $ hg merge vendor
  167. $ hg commit -m "initial: 1.0"
  168. We get to work customizing the libcomplex code. Before we know it,
  169. our modified version of libcomplex is now completely integrated into
  170. our calculator program.
  171. A few weeks later, the developers of libcomplex release a new version
  172. of their library, version 1.1, which contains some features and
  173. functionality that we really want. We'd like to upgrade to this new
  174. version, but without losing the customizations we made to the existing
  175. version. What we essentially would like to do is to replace our
  176. current baseline version of libcomplex 1.0 with a copy of libcomplex
  177. 1.1, and then have Mercurial re-apply the custom modifications we
  178. previously made to that library to the new version. But we actually
  179. approach the problem from the other direction, applying the changes
  180. made to libcomplex between versions 1.0 and 1.1 to our modified copy
  181. of it.
  182. To perform this upgrade, we update our repository to our vendor
  183. branch, and update the "current" tag with the new libcomplex 1.1
  184. source code. We quite literally replace the existing files with the
  185. new files, clearing out the whole tree and exploding the libcomplex
  186. 1.1 release tarball in its place. The goal here is to make the tip of
  187. our vendor branch contain only the libcomplex 1.1 code, and to ensure
  188. that all that code is under version control. Oh, and we want to do
  189. this with as little version control history disturbance as possible.
  190. $ hg update vendor
  191. $ rm -rf *
  192. $ tar -xjf ../libcomplex-1.1.tar.bz2
  193. $ mv libcomplex-1.1 libcomplex
  194. $ hg addremove -s 60
  195. $ # Additional 'hg add' and 'hg rm' commands if needed
  196. $ hg commit -m "1.1 source drop"
  197. After unpacking the 1.1 tarball, hg status will show files with local
  198. modifications as well as, perhaps, some unversioned or missing files.
  199. If we did what we were supposed to do, the unversioned files are only
  200. those new files introduced in the 1.1 release of libcomplex. The
  201. missing files are files that were in 1.0 but not in 1.1. The 'hg
  202. addremove' command deals with both, and more: the '-s 60' switch
  203. directs Mercurial to compare added files to deleted files, recognizing
  204. any file at least 60% similar as a move/rename.
  205. For simple or stable libraries, the 'hg addremove' command should be
  206. reliable. For more complicated libraries subject to refactoring or
  207. large gaps of time between updates (e.g. libcurl), it can get a little
  208. lost trying to match files in the old release with files in the new
  209. release. Pay attention to the output of the command or better still,
  210. do dry runs. Files erroneously moved can be excluded with the '-X'
  211. option and then dealt with individually with 'hg add' and 'hg rm'
  212. commands after 'hg addremove'. (The readme file in the curl library
  213. should document a particularly challenging case.)
  214. The 'addremove' process doesn't have to be perfect. Recreating the
  215. evolution of the upstream source tree isn't universally practical.
  216. But we'd like to capture movement of files in the vendor branch that
  217. are modified in the default branch. If achieving that becomes too
  218. tedious, then re-implementation of the default branch edit in a new
  219. file is fine. Just note it here for the next developer.
  220. Finally, once our current working copy contains only the libcomplex
  221. 1.1 code, we commit the changes we made to get it looking that way.
  222. Our current vendor branch now contains the new vendor drop. We move
  223. the 'current' tag to the new version (in the same way we previously
  224. tagged the version 1.0 vendor drop), and then merge the differences
  225. between the version 1.0 and version 1.1 into our default branch.
  226. $ hg tag -f -r tip current
  227. $ hg tag -r current 1.1
  228. $ hg update default
  229. $ hg merge vendor
  230. # resolve all the conflicts between their changes and our changes
  231. # if you will have conflicts in .hgtags, simply take *all* lines
  232. ...
  233. $ hg commit -m "update with 1.1"
  234. Any additional work needed to get the merged library working can
  235. now be done on the default branch.
  236. Revision Tags
  237. We don't currently make use of Mercurial tags in the build and release
  238. process for 3rd-party libraries. But we would like to establish a
  239. convention to document update and release points. The tags we would
  240. like to establish are:
  241. * 'current' Points to a succession of vendor releases checked into
  242. the 'vendor' branch. Will almost always be at or close to branch
  243. head.
  244. * '<version>' Tag on the 'vendor' branch pointing to a verbatim
  245. checkin of a 3rd-party's <version> release. Example: '7.21.1' for
  246. a particular version of libcurl we have used.
  247. * Release-type tags on the default branch aren't as useful given how
  248. Mercurial handles tags and how autobuild works.
  249. Schematic of a Third-Party Repository
  250. Below is the output of the 'hg glog' command showing a library project
  251. going through an initial 1.0 release and an update from the vendor to
  252. 1.1. Significant revisions in the repository lifecycle are as
  253. follows:
  254. 0 Creation of the repo with an initial file.
  255. 1 1.0 code drop on branch 'vendor'
  256. 4 Merge of 1.0 code onto branch 'default'
  257. 5 Modifications to library we wish to keep over time. Released.
  258. 6 1.1 code drop on branch 'vendor'
  259. 9 Merge of 1.1 code onto branch 'default'
  260. 10 Fixes to merge yielding production 1.1 library. Released.
  261. @ changeset: 10:888229641f6e
  262. | tag: tip
  263. | user: Monty Brandenberg <[email protected]>
  264. | date: Wed Oct 30 13:35:51 2013 -0400
  265. | summary: Work to get 1.1 merge working. Release.
  266. |
  267. o changeset: 9:925ccdf09f50
  268. |\ parent: 5:83c5775c23dc
  269. | | parent: 8:977001a08e48
  270. | | user: Monty Brandenberg <[email protected]>
  271. | | date: Wed Oct 30 13:35:20 2013 -0400
  272. | | summary: update with 1.1
  273. | |
  274. | o changeset: 8:977001a08e48
  275. | | branch: vendor
  276. | | user: Monty Brandenberg <[email protected]>
  277. | | date: Wed Oct 30 13:33:49 2013 -0400
  278. | | summary: Added tag 1.1 for changeset 5f6cb89add91
  279. | |
  280. | o changeset: 7:59bce0f6d12f
  281. | | branch: vendor
  282. | | user: Monty Brandenberg <[email protected]>
  283. | | date: Wed Oct 30 13:33:41 2013 -0400
  284. | | summary: Added tag current for changeset 5f6cb89add91
  285. | |
  286. | o changeset: 6:5f6cb89add91
  287. | | branch: vendor
  288. | | tag: current
  289. | | tag: 1.1
  290. | | parent: 3:8525ad934ecd
  291. | | user: Monty Brandenberg <[email protected]>
  292. | | date: Wed Oct 30 13:33:29 2013 -0400
  293. | | summary: 1.1 source drop
  294. | |
  295. o | changeset: 5:83c5775c23dc
  296. | | tag: 1.0
  297. | | user: Monty Brandenberg <[email protected]>
  298. | | date: Wed Oct 30 13:32:31 2013 -0400
  299. | | summary: Linden-specific changes to the library. Release
  300. | |
  301. o | changeset: 4:bccb736585f4
  302. |\| parent: 0:400e4516c406
  303. | | parent: 3:8525ad934ecd
  304. | | user: Monty Brandenberg <[email protected]>
  305. | | date: Wed Oct 30 13:31:40 2013 -0400
  306. | | summary: initial: 1.0
  307. | |
  308. | o changeset: 3:8525ad934ecd
  309. | | branch: vendor
  310. | | user: Monty Brandenberg <[email protected]>
  311. | | date: Wed Oct 30 13:30:21 2013 -0400
  312. | | summary: Added tag 1.0 for changeset 8ac3828d03bb
  313. | |
  314. | o changeset: 2:7aa1a1cb62d9
  315. | | branch: vendor
  316. | | user: Monty Brandenberg <[email protected]>
  317. | | date: Wed Oct 30 13:30:14 2013 -0400
  318. | | summary: Added tag current for changeset 8ac3828d03bb
  319. | |
  320. | o changeset: 1:8ac3828d03bb
  321. |/ branch: vendor
  322. | tag: 1.0
  323. | user: Monty Brandenberg <[email protected]>
  324. | date: Wed Oct 30 13:30:09 2013 -0400
  325. | summary: 1.0 source drop
  326. |
  327. o changeset: 0:400e4516c406
  328. user: Monty Brandenberg <[email protected]>
  329. date: Wed Oct 30 13:29:16 2013 -0400
  330. summary: Created repo with initial readme file