Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/perforce/p4python
Browse files Browse the repository at this point in the history
  • Loading branch information
hjain-perforce committed Oct 26, 2023
2 parents 71c8928 + 3fb8ae5 commit bb00195
Showing 1 changed file with 58 additions and 56 deletions.
114 changes: 58 additions & 56 deletions build.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,83 @@
## Building P4Python from Source

1. Download the r23.1 Perforce C++ API from the Perforce FTP site at
"ftp://ftp.perforce.com/perforce". The API archive is located
in release and platform-specific subdirectories.
1. Download the corresponding Perforce C++ API (e.g. if you trying to build P4Python 2023.1, download the r23.1 P4API) from
https://ftp.perforce.com/perforce. The API archive is located in release and platform-specific subdirectories.

Under Linux the p4api is named p4api-glib<GLIBVER>-openssl<SSLVER>.tgz\
Note that setup.py will download the correct p4api automatically from
ftp.perforce.com if you do not provide an --apidir parameter to the
setup.py "build" command.
Under Linux, the p4api is named _p4api-glib\<GLIBVER>-openssl\<SSLVER>.tgz_

Note that setup.py will download the correct p4api automatically from
https://ftp.perforce.com/perforce if you do not provide an\
_--apidir_ parameter to the "setup.py build" command.

Mac OS X users should get the API from the relevant platform directory e.g.
"**bin.macosx1010x86_64**" or "**bin.macosx12arm64**". The p4api is named
p4api-openssl<SSLVER>.tgz
"**bin.macosx1015x86_64**" or "**bin.macosx12arm64**".\
The p4api is named _p4api-openssl\<SSLVER>.tgz_

Under Windows the p4api needs to match your compiler, build type (static
or dynamic) and SSL version. for instance:
"**p4api_vs2019_static_openssl3.zip**" or "**p4api_vs2019_dyn_openssl3.zip**"

"**p4api_vs2010_static_openssl1.1.1.zip**" or\
"**p4api_vs2015_dyn_openssl1.0.2.zip**"

Note: 32-bit builds of P4Python require a 32-bit version of the
C++ API and a 32-bit version of Python. 64-bit builds of
P4Python require a 64-bit version of the C++ API and a
64-bit version of Python.

**Note:** 32-bit builds of P4Python require a 32-bit version of the
C++ API and a 32-bit version of Python. 64-bit builds of
P4Python require a 64-bit version of the C++ API and a
64-bit version of Python.
Unzip the archive into an empty directory.

2. Download and extract the P4Python API archive into a new, empty directory.

3. If needed, install the Openssl libraries.

4. To build P4Python, run the following command:

_python3 setup.py build --apidir <Perforce C++ API absolute path>
--ssl <OpenSSL library path> _

Note: in order to reinstall cleanly P4Python, remove the
directory named "build".

5. To test your P4Python build, run the following command:
4. Download the P4Python source code from this repository or https://ftp.perforce.com \
(e.g. for release 2023.1, source code can be found at https://ftp.perforce.com/perforce/r23.1/bin.tools/) \
extract the archive into a new empty directory.

_python3 p4test.py_
7. If needed, install the Openssl libraries.

Note: this test harness requires the Perforce server executable
p4d 17.1 or better to be installed and in the PATH.
8. To build P4Python, execute setup.py in P4Python source directory, with the following arguments:

6. To install P4Python, run the following command:
```
python3 setup.py build --apidir <Perforce C++ API absolute path> --ssl <OpenSSL library path>
```

_python3 setup.py install_
**Note:** In order to cleanly reinstall P4Python, remove the directory named "build".

if this doesn't work, you may need to both build and install in the same
incantation:
10. To test your P4Python build, excecute p4test.py:
```
python3 p4test.py
```
**Note:** This test requires the Perforce server executable p4d 17.1 or better to be installed and in the PATH.

_python3 setup.py build --apidir <Perforce C++ API absolute path> --ssl <OpenSSL library path> install_
12. To install P4Python, execute the following command:

```
python3 setup.py install
```
If this doesn't work, you may need to build and install in the same command:

Note: on Unix/Mac platforms, the installation must be performed
as the root user, so usually these commands are preceded by "sudo".
Also ensure that the umask is set correctly (typically 0022) before
running the install. With a umask of 027, for example, the resulting
installed files are accessible only by users of group root.
```
python3 setup.py build --apidir <Perforce C++ API absolute path> --ssl <OpenSSL library path> install
```

on Windows platforms, open a Visual Studio Command window
(with administrator permissions) and run the command there.
**Note:** On Unix/Mac platforms, the installation must be performed
as the root user, so usually these commands are preceded by "sudo".
Also ensure that the umask is set correctly (typically 0022) before
running the install. With a umask of 027, for example, the resulting
installed files are accessible only by users of group root.\
On Windows platforms, open a Visual Studio Command window
(with administrator permissions) and run the command there.

SSL support
-----------

Perforce Server 2012.1 and later supports SSL connections and the
C++ API has been compiled with this support. With 2020.1 SSL support
is mandatory, that is, P4Python must be linked with valid OpenSSL libraries.
Perforce Server 2012.1 and later supports SSL connections and the
C++ API has been compiled with this support. With 2020.1 SSL support
is mandatory, that is, P4Python must be linked with valid OpenSSL libraries.

To specify which SSL library to use, provide the --ssl [librarypath]
switch to the build. Without [librarypath] setup will attempt to run
"openssl version" to identify the location of the library path for
openssl and whether openssl has an appropriate version to link to.
To specify which SSL library to use, provide the --ssl \<OpenSSL library path>
switch to the build. Without this setup will attempt to run
"openssl version" to identify the location of the library path for
openssl and whether openssl has an appropriate version to link to.

If on linux, and the build process cannot find the correct openssl
libraries, and the -ssl option was not used, then the openssl source will
be downloaded, compiled and installed (this will require a superuser
password for the installation)
If on linux, and the build process cannot find the correct openssl
libraries, and the -ssl option was not used, then the openssl source will
be downloaded, compiled and installed (this will require a superuser
password for the installation)

0 comments on commit bb00195

Please sign in to comment.