MySQL Connector/C++ 8.0 Developer Guide/Installing Connector/C++ from Source/ Obtaining and Unpacking a Connector/C++ Source Distribution

4.2 Obtaining and Unpacking a Connector/C++ Source Distribution

To obtain a Connector/C++ source distribution, visit theConnector/C++ downloads page. Alternatively, clone the Connector/C++ Git source repository.

A Connector/C++ source distribution is packaged as a compressedtarfile or Zip archive, denoted here asPACKAGE.tar.gzorPACKAGE.zip. A source distribution intarfile or Zip archive format can be used on any supported platform.

The distribution when unpacked includes anINFO_SRCfile that provides information about the product version and the source repository from which the distribution was produced. The distribution also includes other documentation files such as those listed inChapter 3,Installing Connector/C++ from a Binary Distribution.

To unpack a compressedtarfile, use this command in the intended installation directory:

tar zxvfPACKAGE.tar.gz

After unpacking the distribution, build it using the appropriate instructions for your platform later in this chapter.

To install from a Zip archive package (.zipfile), useWinZipor another tool that can read.zipfiles to unpack the file into the location of your choosing. After unpacking the distribution, build it using the appropriate instructions for your platform later in this chapter.

To clone the Connector/C++ code from the source code repository located on GitHub athttps://github.com/mysql/mysql-connector-cpp, use this command:

git clone https://github.com/mysql/mysql-connector-cpp.git

该命令应该创建amysql-connector-cppdirectory containing a copy of the entire Connector/C++ source tree.

Thegit clonecommand sets the sources to themasterbranch, which is the branch that contains the latest sources. Released code is in the8.0branche (the8.0branch contains the same sources as themasterbranch). If necessary, usegit checkoutin the source directory to select the desired branch. For example, to build Connector/C++ 8.0:

cd mysql-connector-cpp git checkout 8.0

After cloning the repository, build it using the appropriate instructions for your platform later in this chapter.

After the initial checkout operation to get the source tree, rungit pullperiodically to update your source to the latest version.