diff options
| -rw-r--r-- | README.md | 179 |
1 files changed, 157 insertions, 22 deletions
| @@ -16,47 +16,180 @@ Some key features are: | |||
| 16 | - **Formats:** Supports binary, XML, JSON, and OpenStep format | 16 | - **Formats:** Supports binary, XML, JSON, and OpenStep format |
| 17 | - **Utility:** Provides a `plistutil` utility for the command-line | 17 | - **Utility:** Provides a `plistutil` utility for the command-line |
| 18 | - **Python:** Provides Cython based bindings for Python | 18 | - **Python:** Provides Cython based bindings for Python |
| 19 | - **Tested:** Uses fuzzing and data compliance tests | 19 | - **Tested:** Uses fuzzing ([OSS-Fuzz](https://github.com/google/oss-fuzz)) and data compliance tests |
| 20 | - **Efficient:** Lean library with performance and resources in mind | 20 | - **Efficient:** Lean library with performance and resources in mind |
| 21 | 21 | ||
| 22 | ## Installation / Getting started | 22 | ## Building |
| 23 | 23 | ||
| 24 | ### Debian / Ubuntu Linux | 24 | You need to have a working compiler and development environent available. |
| 25 | 25 | ||
| 26 | First install all required dependencies and build tools: | 26 | ### Prerequisites |
| 27 | ```shell | 27 | |
| 28 | sudo apt-get install \ | 28 | * #### Debian/Ubuntu based Linux |
| 29 | |||
| 30 | Install all required dependencies and build tools: | ||
| 31 | ```shell | ||
| 32 | sudo apt-get install \ | ||
| 29 | build-essential \ | 33 | build-essential \ |
| 30 | checkinstall \ | 34 | checkinstall \ |
| 31 | git \ | 35 | git \ |
| 32 | autoconf \ | 36 | autoconf \ |
| 33 | automake \ | 37 | automake \ |
| 34 | libtool-bin | 38 | libtool-bin |
| 35 | ``` | 39 | ``` |
| 40 | |||
| 41 | If you want to optionally build the documentation or Python bindings use: | ||
| 42 | ```shell | ||
| 43 | sudo apt-get install \ | ||
| 44 | doxygen \ | ||
| 45 | cython3 | ||
| 46 | ``` | ||
| 47 | |||
| 48 | * #### macOS | ||
| 49 | |||
| 50 | Make sure the Xcode command line tools are installed. Then, use either [MacPorts](https://www.macports.org/) | ||
| 51 | or [Homebrew](https://brew.sh/) to install `automake`, `autoconf`, and `libtool`. | ||
| 52 | |||
| 53 | Using MacPorts: | ||
| 54 | ```shell | ||
| 55 | sudo port install libtool autoconf automake | ||
| 56 | ``` | ||
| 57 | |||
| 58 | Using Homebrew: | ||
| 59 | ```shell | ||
| 60 | brew install libtool autoconf automake | ||
| 61 | ``` | ||
| 62 | |||
| 63 | In case you want to build the documentation, install `doxygen` using the corresponding install command from above. | ||
| 64 | |||
| 65 | If you want to build Python bindings, you need to install cython: | ||
| 66 | ```shell | ||
| 67 | pip3 install cython | ||
| 68 | ``` | ||
| 69 | |||
| 70 | You might need to set a few environment variables if building of the Python bindings fail. For example, the [automated build via GitHub actions](https://github.com/libimobiledevice/libplist/blob/master/.github/workflows/build.yml) | ||
| 71 | is setting the following environment variables: | ||
| 72 | ```shell | ||
| 73 | PYTHON3_BIN=`xcrun -f python3` | ||
| 74 | export PYTHON=$PYTHON3_BIN | ||
| 75 | PYTHON_VER=`$PYTHON3_BIN -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'))"` | ||
| 76 | PYTHON_EXEC_PREFIX=`$PYTHON3_BIN -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('exec_prefix'))"` | ||
| 77 | PYTHON_LIBS_PATH=$PYTHON_EXEC_PREFIX/lib | ||
| 78 | PYTHON_FRAMEWORK_PATH=$PYTHON_EXEC_PREFIX/Python3 | ||
| 79 | export PYTHON_LIBS="-L$PYTHON_LIBS_PATH -lpython$PYTHON_VER" | ||
| 80 | export PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation $PYTHON_FRAMEWORK_PATH" | ||
| 81 | ``` | ||
| 82 | |||
| 83 | * #### Windows: MSYS2 | ||
| 84 | |||
| 85 | [MSYS2](https://www.msys2.org/) is the preferred way of compiling this project on Windows. Download the MSYS2 installer | ||
| 86 | and follow the installation steps. | ||
| 87 | |||
| 88 | It is recommended to use the _MSYS2 MinGW 64-bit_ shell. Run it and make sure the required dependencies are installed: | ||
| 89 | |||
| 90 | ```shell | ||
| 91 | pacman -S base-devel \ | ||
| 92 | git \ | ||
| 93 | mingw-w64-x86_64-gcc \ | ||
| 94 | make \ | ||
| 95 | libtool \ | ||
| 96 | autoconf \ | ||
| 97 | automake-wrapper | ||
| 98 | ``` | ||
| 99 | NOTE: You can use a different shell and different compiler according to your needs. Adapt the above command accordingly. | ||
| 100 | |||
| 101 | If you want to optionally build Python bindings, you need to also install `cython` | ||
| 102 | and make sure you have a working python environment. | ||
| 103 | |||
| 104 | ```shell | ||
| 105 | pacman -S cython | ||
| 106 | ``` | ||
| 107 | |||
| 108 | ### Configuring the source tree | ||
| 109 | |||
| 110 | You can build the source code from a git checkout, or from a `.tar.bz2` release tarball from [Releases](https://github.com/libimobiledevice/libplist/releases). | ||
| 111 | Before we can build it, the source tree has to be configured for building. The steps depend on where you got the source from. | ||
| 112 | |||
| 113 | * #### From git | ||
| 114 | |||
| 115 | If you haven't done already, clone the actual project repository and change into the directory. | ||
| 116 | ```shell | ||
| 117 | git clone https://github.com/libimobiledevice/libplist.git | ||
| 118 | cd libplist | ||
| 119 | ``` | ||
| 120 | |||
| 121 | Configure the source tree for building: | ||
| 122 | ```shell | ||
| 123 | ./autogen.sh | ||
| 124 | ``` | ||
| 125 | |||
| 126 | * #### From release tarball (.tar.bz2) | ||
| 127 | |||
| 128 | When using an official [release tarball](https://github.com/libimobiledevice/libplist/releases) (`libplist-x.y.z.tar.bz2`) | ||
| 129 | the procedure is slightly different. | ||
| 130 | |||
| 131 | Extract the tarball: | ||
| 132 | ```shell | ||
| 133 | tar xjf libplist-x.y.z.tar.bz2 | ||
| 134 | cd libplist-x.y.z | ||
| 135 | ``` | ||
| 136 | |||
| 137 | Configure the source tree for building: | ||
| 138 | ```shell | ||
| 139 | ./configure | ||
| 140 | ``` | ||
| 141 | |||
| 142 | Both `./configure` and `./autogen.sh` (which generates and calls `configure`) accept a few options, for example `--enable-debug` to allow | ||
| 143 | printing debug messages in the final product, or `--without-cython` to skip building the Python bindings. | ||
| 144 | You can simply pass them like this: | ||
| 36 | 145 | ||
| 37 | If you want to optionally build the documentation or Python bindings use: | ||
| 38 | ```shell | 146 | ```shell |
| 39 | sudo apt-get install \ | 147 | ./autogen.sh --prefix=/usr/local --enable-debug --without-cython |
| 40 | doxygen \ | ||
| 41 | cython3 | ||
| 42 | ``` | 148 | ``` |
| 43 | 149 | or | |
| 44 | Then clone the actual project repository: | ||
| 45 | ```shell | 150 | ```shell |
| 46 | git clone https://github.com/libimobiledevice/libplist.git | 151 | ./configure --prefix=/usr/local --enable-debug |
| 47 | cd libplist | 152 | ``` |
| 153 | |||
| 154 | Once the command is successful, the last few lines of output will look like this: | ||
| 155 | ``` | ||
| 156 | [...] | ||
| 157 | config.status: creating config.h | ||
| 158 | config.status: executing depfiles commands | ||
| 159 | config.status: executing libtool commands | ||
| 160 | |||
| 161 | Configuration for libplist 2.3.1: | ||
| 162 | ------------------------------------------- | ||
| 163 | |||
| 164 | Install prefix ..........: /usr/local | ||
| 165 | Debug code ..............: yes | ||
| 166 | Python bindings .........: yes | ||
| 167 | |||
| 168 | Now type 'make' to build libplist 2.3.1, | ||
| 169 | and then 'make install' for installation. | ||
| 48 | ``` | 170 | ``` |
| 49 | 171 | ||
| 50 | Now you can build and install it: | 172 | ### Building and installation |
| 173 | |||
| 174 | If you followed all the steps successfully, and `autogen.sh` or `configure` did not print any errors, | ||
| 175 | you are ready to build the project. This is simply done with | ||
| 176 | |||
| 51 | ```shell | 177 | ```shell |
| 52 | ./autogen.sh | ||
| 53 | make | 178 | make |
| 179 | ``` | ||
| 180 | |||
| 181 | If no errors are emitted, you can go ahead and install it with: | ||
| 182 | ```shell | ||
| 54 | sudo make install | 183 | sudo make install |
| 55 | ``` | 184 | ``` |
| 185 | When using a user-writable destination directory, or run from MinGW shell, you would just run `make install`, without sudo. | ||
| 56 | 186 | ||
| 57 | ## Usage | 187 | ## Usage |
| 58 | 188 | ||
| 59 | Then simply run: | 189 | Usage is simple; `libplist` has a straight-forward API. It is used in [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice) |
| 190 | and [corresponding projects](https://github.com/libimobiledevice/). | ||
| 191 | |||
| 192 | Furthermore, it comes with a command line utility `plistutil` that is really easy to use: | ||
| 60 | ```shell | 193 | ```shell |
| 61 | plistutil -i foobar.plist -o output.plist | 194 | plistutil -i foobar.plist -o output.plist |
| 62 | ``` | 195 | ``` |
| @@ -68,13 +201,16 @@ format - use the `-f` command line switch: | |||
| 68 | ```shell | 201 | ```shell |
| 69 | plistutil -i input.plist -f json | 202 | plistutil -i input.plist -f json |
| 70 | ``` | 203 | ``` |
| 71 | This will convert input.plist, regardless of the input format, to JSON. The | 204 | This will convert `input.plist`, regardless of the input format, to JSON. The |
| 72 | code auto-detects the input format and parses it accordingly. | 205 | code auto-detects the input format and parses it accordingly. |
| 73 | 206 | ||
| 74 | Please consult the usage information or manual page for a full documentation of | 207 | Please consult the usage information or manual page for a full documentation of |
| 75 | available command line options: | 208 | available command line options: |
| 76 | ```shell | 209 | ```shell |
| 77 | plistutil --help | 210 | plistutil --help |
| 211 | ``` | ||
| 212 | or | ||
| 213 | ```shell | ||
| 78 | man plistutil | 214 | man plistutil |
| 79 | ``` | 215 | ``` |
| 80 | 216 | ||
| @@ -95,8 +231,6 @@ Please make sure your contribution adheres to: | |||
| 95 | * Try to split larger changes into individual commits of a common domain | 231 | * Try to split larger changes into individual commits of a common domain |
| 96 | * Use your real name and a valid email address for your commits | 232 | * Use your real name and a valid email address for your commits |
| 97 | 233 | ||
| 98 | We are still working on the guidelines so bear with us! | ||
| 99 | |||
| 100 | ## Links | 234 | ## Links |
| 101 | 235 | ||
| 102 | * Homepage: https://libimobiledevice.org/ | 236 | * Homepage: https://libimobiledevice.org/ |
| @@ -119,4 +253,5 @@ iPadOS, tvOS, watchOS, and macOS are trademarks of Apple Inc. | |||
| 119 | This project is an independent software library and has not been authorized, | 253 | This project is an independent software library and has not been authorized, |
| 120 | sponsored, or otherwise approved by Apple Inc. | 254 | sponsored, or otherwise approved by Apple Inc. |
| 121 | 255 | ||
| 122 | README Updated on: 2023-11-26 | 256 | README Updated on: 2024-02-13 |
| 257 | |||
