This is intended as a list of all the patches that have been incorporated into
the lib-src copies of libraries, to avoid them getting lost in version upgrades
from upstream, and to remind us of the versions we are using. See the notes at
the end for how external libraries are brought in and maintained.

Libraries
=========
expat
-----
XML parser library used to parse project files and so on.
Version in Audacity SVN: 2.1.0
Patches: None
Upstream version: 2.1.0

libflac
-------
http://flac.sourceforge.net/
Free Lossless Audio Codec encoding and decoding library
Version in Audacity SVN: 1.3.1
Patches: mac-asm-fixes.patch. Fixes build on OS X Intel 10.4 by creating and
            object format for Mach-O. Needs to go upstream
         add-maintainer-mode.patch. Disable autotools rebuilds
         bypass-constraint-problem.patch. Gets around problem with older
            gcc (4.0)...not need after we upgrade past Xcode 3.2.6.
Upstream version: 1.3.1

libnyquist
----------
Digital Audio scripting language, with our own library interface added to it
Version in Audacity SVN: r331 (r3.16+)
NOTE: Patch files no longer being created. Use git history instead.

libogg
------
library to handle Xiph.org's open multimedia container format
Version in Audacity SVN: 1.3.1
Patches: autotools.patch: Fix all autotools warnings. configure.in was renamed
                          to configure.ac after applying the patch.
AM_MAINTAINER_MODE has been called with "disable" in configure.ac to disable
autotools rebuilds by default.
Upstream Version: 1.3.1

libsndfile
----------
Erik de Castro Lopo's audio file I/O library. Core and essential to Audacity.
Version in Audacity GIT: 1.0.29rc2+git4bdd741

libsoxr
-------
The SoX Resampler library performs one-dimensional sample-rate conversion, 
by Rob Sykes.
http://sourceforge.net/p/soxr/wiki/Home/
Version in Audacity SVN: 0.1.1
Patches: 
   * "libsoxr/configure" file: modified cmake params
   * add-make-check-support.patch: Add a check target for GNU Autotools integration.
   * libsoxr-srcdir.patch: Adds srcdir handling
Upstream Version: 0.1.1

libvamp
-------
Library to load and use VAMP plug-ins. http://www.vamp-plugins.org/
Version in Audacity SVN: 2.5
Patches: fix-linkage-against-dl.patch: Fix linkage against dl for hostsdk library.
         fix-all-target.patch: Fix all target to not build disabled targets.
         libvamp-srcdir.patch: Adds srcdir handling
Upstream Version: 2.5

libvorbis
---------
library for endcoding and decoding Xiph.org's high-quality compressed audio
format.
Version in Audacity SVN: 1.3.3
Patches: autotools.patch: Fix all autotools warnings.
Upstream Version: 1.3.3


lv2
---------
A merging of the lilv, lv2, msinttypes, serd, sord, sratom, and suil libraries to support
LV2 plug-ins.
Versions in Audacity SVN:
   lilv-0.24.6
   lv2-1.16.0
   serd-0.30.2
   sord-0.16.4
   sratom-0.6.4
   suil-0.10.6

portaudio-v19
-------------
http://portaudio.com/
cross-platform audio I/O library version 19, used for 1.3.2 onwards releases
Version in Audacity Git:  Fri Apr 26 16:48:28 2019 snapshot (commit 3ebfacc)
Patches applied:
* portmixer/portaudio.patch      Add features needed to make portmixer work
* portaudio-srcdir.patch         Adds srcdir handling
* wasapi-fix.patch               Fix for WASAPI hostapi that corrects incorrect
                                 reporting of stream open/running/closed state.
* wasapi-loopback.patch          Add loopback devices to the WASAPI hostapi.
* jack.patch                     Add JACK support to Windows.
* linkage.patch                  Allows compilation as C++ with correct "C" linkage of one function
* mmefix.patch                   Bug 1969 - Windows: no monitored sound for 15 secs with software playthrough with default MME hos
* vs2015.patch                   Update for VS2015+
* 16bit.patch                    Bug 193 - Audacity can't record at > 16-bit under MME or Windows DirectSound
* ringbuf.patch                  pa_ringbuffer.c wasn't compiled by Travis, that broke the build

portmidi
-------
http://portmedia.sourceforge.net/
PortMidi is a library for software developers. It supports real-time input
and output of MIDI data using a system-independent interface.
Version in Audacity SVN: SVN snapshot from 227
Patches:
Upstream Version: SVN revision 227

portsmf
-------
http://portmedia.sourceforge.net/
Cross-platform Midi file reader and writer (succeeded and obsoletes allegro)
Version in Audacity SVN: SVN snapshot from 227
Patches: autotools.patch: Fix all autotools warnings.
autotools-fix-make-dist.patch: Correct file lists to make dist target work.
Upstream Version: SVN revision 227

portmixer
---------
cross-platform audio mixer control library, hooked onto portaudio. Maintained
by the Audacity project with some help from portaudio development.

sbsms
-----
https://github.com/claytonotey/libsbsms
An audio stretching library for changing pitch or tempo without changing the
other. Alternative to SoundTouch, better on large changes but slower.
Version in Audacity GIT: 2.2.0
Upstream Version: 2.2.0

soundtouch
----------
http://www.surina.net/soundtouch/
Independent Pitch and Tempo changing library.
Version in Audacity SVN: 1.7.1
Patches: autotools.patch: Fix all autotools warnings.
AM_MAINTAINER_MODE([disable]) has been added to configure.ac to disable autotools rebuilds.
Upstream Version: 1.7.1

sqlite
----------
https://sqlite.org
SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine.
Version in Audacity GIT: 3.32.3
Upstream Version: 3.32.3

twolame
-------
http://www.twolame.org/
MPEG I layer 2 audio encoding library used for MP2 exports
Version in Audacity SVN: 0.3.13
Patches: fix-tests.patch: Terminate AM_TESTS_ENVIRONMENT by a semicolon.
AM_MAINTAINER_MODE has been added to configure.ac to disable autotools rebuilds
by default
Upstream Version: 0.3.13

Crib notes on upgrading lib-src trees
=====================================
With extensive reference to
http://svnbook.red-bean.com/en/1.5/svn.advanced.vendorbr.html

This directory (audacity-src/trunk/lib-src/) is the working copy of the
imported libraries, with changes made to them. The current upstream version of
the libraries is imported into the audacity-src/vendor/ tree, which is _not
modified_ except for new imports. The unmodified upstream sources are then
used to merge forward the changes between releases into the
audacity-src/trunk/lib-src/ copy which contains the audacity project changes.

The version of a given <library> in lib-src should be the version from
vendor/<library>/current/ with the audacity changes added in.

1. We will update the vendor branch copy with the new upstream source first,
then merge into the working copy. As always we need a new set of clean source
to import. If pulling from upstream version control, do an export to lose
version control files first.
   svn export -r HEAD https://www.portaudio.com/repos/portaudio/trunk export

2. Use the svn_load_dirs.pl script to upgrade the vendor branch to the new
upstream source (which will deal with adds, deletions and renaming in the
source tree without too much effort). You need to specify a tag name for the
new update (which should reflect the upstream release, in this case an SVN
revision in upstream's repository)
	svn_load_dirs.pl -t r1541 \
	https://audacity.googlecode.com/svn/audacity-src/vendor/portaudio-v19/ \
	current /path/to/newver
Note that the URL excludes the final 'current' section, which is specified
separately in the next argument, with the final one being the path to inside
the directory with the new source in it.

3. Answer the questions as posed by the script (it is interactive). The tag
should be correct as you specified it in the command. Several temporary SVN
checkouts will be created (in /tmp) and merges done. Deleted and Added files
will be printed (with a pause after each screen). If some of these should
actually be renames (that is, a delete and an addition go together), then
enter the numbers of those two files to sort that out for the script. Getting
this correct makes the merge of changes much less painful.

4. Much churning will occur to update all the files, remove orphans etc. The
new version of the library will now be in vendor/<library>/current/, with a
tag of the given name at vendor/<library>/<tag>/. This will be autotmatically 
committed to SVN by the script.

5. Merge the changes between the previous and current upstream versions into
the lib-src copy used in Audacity using svn merge. Do this from the
audacity-src/lib-src/ directory of a working copy, as you will need to resolve
some conflicts along the way.
svn merge
https://audacity.googlecode.com/svn/audacity-src/vendor/portaudio-v19/r1416 \
https://audacity.googlecode.com/svn/audacity-src/vendor/portaudio-v19/current \
portaudio-v19

6. When prompted with a conflict, most of the time, you want to see the
changes, which you can get with the 'df' (diff full) response. In many cases
the changes may be trivial (e.g. version headers), in which case you can just
choose to use the new version with the 'tf' (theirs full) command.
* For generated files (e.g. configure), accept upstream's version because we
  will re-generate them later.
* If there is a minor conflict, then going to 'e' (edit) will let you clean
  the remaining issues in the file up. Save the file, then 'r' (resolved)
  accepts the updated file.
* Mangled line endings cause a load of grief here, so try to make sure they
  don't happen. SVN shouldn't have trouble with this, provided that the
  svn:eol property is correctly set

7. Check the SVN status output to see what has changed. In particularly, look
for files not under version control and which are, but have been deleted.
svn st | grep '^?'
svn st | grep '^!'
Ideally there shouldn't be any!

8. Do some local updates to help reliable builds (especially if upstream
aren't very good at doing these) 
* If the package uses libtool, run libtoolize --copy --force to update 
	ltmain.sh, config.sub, config.guess. If not, update config.sub,
	config.guess from /usr/share/gnuconfig/
* run autoreconf

9. Build and test the code! Make sure that your merges actually work!

10. Commit to repository - svn commit as usual.

11. To re-generate the patches in the Audacity tree, diff the original in
/vendor/ against the patched version in lib-src/ (you will need to use both
URLs on the server for this to work)

Bringing in a new (or only previously in CVS) library
-----------------------------------------------------
We start out with the svn import command to to all the adding and setting up
for us. We need a set of files to import (for old CVS libs, a set of whatever
was imported last time), without any version control droppings (to get this
from someone else's SVN repository, use
svn export -r <revision> https://wherever <local directory>)

So to push our local folder tree into the vendor branch:
1. Create a directory to put it in the vendor branch
	svn mkdir --parents https://audacity.googlecode.com/svn/audacity-src/vendor/portaudio-v19/current/

2. Do the svn import
	 svn import portaudio/pa-r1416/ https://audacity.googlecode.com/svn/audacity-src/vendor/portaudio-v19/current/ -m 'Import the previous SVN snapshot of portaudio as a base'
  portaudio/pa-r1416/ is the source directory, e.g. an unpacked tarball. Note
  that we don't want the versioned top level directory from the tarball, so we
  give the path including that directory with a trailing slash on it.

3. The import will list the files by their source directory as it goes on and
  commits as part of the import. At the end you should have all the files for
  the library in the
  https://audacity.googlecode.com/svn/audacity-src/vendor/portaudio-v19/current/
  directory.
