|
| 1 | +## Building P4Python from Source |
| 2 | + |
| 3 | + 1. Download the r22.2 Perforce C++ API from the Perforce FTP site at |
| 4 | + "ftp://ftp.perforce.com/perforce". The API archive is located |
| 5 | + in release and platform-specific subdirectories. |
| 6 | + |
| 7 | + Under Linux the p4api is named p4api-glib<GLIBVER>-openssl<SSLVER>.tgz\ |
| 8 | + Note that setup.py will download the correct p4api automatically from |
| 9 | + ftp.perforce.com if you do not provide an --apidir parameter to the |
| 10 | + setup.py "build" command. |
| 11 | + |
| 12 | + Mac OS X users should get the API from the relevant platform directory e.g. |
| 13 | + "**bin.macosx1010x86_64**" or "**bin.macosx12arm64**". The p4api is named |
| 14 | + p4api-openssl<SSLVER>.tgz |
| 15 | + |
| 16 | + Under Windows the p4api needs to match your compiler, build type (static |
| 17 | + or dynamic) and SSL version. for instance: |
| 18 | + |
| 19 | + "**p4api_vs2010_static_openssl1.1.1.zip**" or\ |
| 20 | + "**p4api_vs2015_dyn_openssl1.0.2.zip**" |
| 21 | + |
| 22 | + Note: 32-bit builds of P4Python require a 32-bit version of the |
| 23 | + C++ API and a 32-bit version of Python. 64-bit builds of |
| 24 | + P4Python require a 64-bit version of the C++ API and a |
| 25 | + 64-bit version of Python. |
| 26 | + |
| 27 | + Unzip the archive into an empty directory. |
| 28 | + |
| 29 | + 2. Download and extract the P4Python API archive into a new, empty directory. |
| 30 | + |
| 31 | + 3. If needed, install the Openssl libraries. |
| 32 | + |
| 33 | + 4. To build P4Python, run the following command: |
| 34 | + |
| 35 | + _python3 setup.py build --apidir <Perforce C++ API absolute path> |
| 36 | + --ssl <OpenSSL library path> _ |
| 37 | + |
| 38 | + Note: in order to reinstall cleanly P4Python, remove the |
| 39 | + directory named "build". |
| 40 | + |
| 41 | + 5. To test your P4Python build, run the following command: |
| 42 | + |
| 43 | + _python3 p4test.py_ |
| 44 | + |
| 45 | + Note: this test harness requires the Perforce server executable |
| 46 | + p4d 17.1 or better to be installed and in the PATH. |
| 47 | + |
| 48 | + 6. To install P4Python, run the following command: |
| 49 | + |
| 50 | + _python3 setup.py install_ |
| 51 | + |
| 52 | + if this doesn't work, you may need to both build and install in the same |
| 53 | + incantation: |
| 54 | + |
| 55 | + _python3 setup.py build --apidir <Perforce C++ API absolute path> --ssl <OpenSSL library path> install_ |
| 56 | + |
| 57 | + Note: on Unix/Mac platforms, the installation must be performed |
| 58 | + as the root user, so usually these commands are preceded by "sudo". |
| 59 | + Also ensure that the umask is set correctly (typically 0022) before |
| 60 | + running the install. With a umask of 027, for example, the resulting |
| 61 | + installed files are accessible only by users of group root. |
| 62 | + |
| 63 | + on Windows platforms, open a Visual Studio Command window |
| 64 | + (with administrator permissions) and run the command there. |
| 65 | + |
| 66 | + SSL support |
| 67 | + ----------- |
| 68 | + |
| 69 | + Perforce Server 2012.1 and later supports SSL connections and the |
| 70 | + C++ API has been compiled with this support. With 2020.1 SSL support |
| 71 | + is mandatory, that is, P4Python must be linked with valid OpenSSL libraries. |
| 72 | + |
| 73 | + To specify which SSL library to use, provide the --ssl [librarypath] |
| 74 | + switch to the build. Without [librarypath] setup will attempt to run |
| 75 | + "openssl version" to identify the location of the library path for |
| 76 | + openssl and whether openssl has an appropriate version to link to. |
| 77 | + |
| 78 | + If on linux, and the build process cannot find the correct openssl |
| 79 | + libraries, and the -ssl option was not used, then the openssl source will |
| 80 | + be downloaded, compiled and installed (this will require a superuser |
| 81 | + password for the installation) |
0 commit comments