Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Sameesunkaria/JQ-Darwin

Build jq for various Apple platforms 🙌! Pre-built XCFrameworks are available as release assets 🧰.
https://github.com/Sameesunkaria/JQ-Darwin

apple-platforms darwin ios jq macos tvos watchos xcframework

Last synced: 22 days ago
JSON representation

Build jq for various Apple platforms 🙌! Pre-built XCFrameworks are available as release assets 🧰.

Awesome Lists containing this project

README

        

# JQ for Darwin

Build [jq](https://stedolan.github.io/jq/) for various Apple platforms. This repository hosts scripts to conveniently build jq for all of the numerous supported Apple Platforms and generate XCFrameworks for the jq library. The compressed frameworks are hosted as release assets.

## Requirements

Xcode 15 or newer is required to build for all the platforms declared in the `build.sh` script. Aditionally, Autotools is required for building `jq` and `oniguruma`. Other dependencies are part of Xcode's command line tools.

## Building

Before building, make sure that all required dependencies are installed and the command line tools for your desired version of Xcode have been selected.

To install `automake`, and `autoconf` using [Homebrew](https://brew.sh):

```
brew install automake autoconf
```

To select Xcode command line tools:

```
sudo xcode-select -s /path/to/Xcode.app
```

Now, you can build by executing `build.sh`:

```
./build.sh
```

The build script will compile static libraries and executables for `jq` and `oniguruma` (a dependency of `jq`) for all the [supported targets](#Supported-Targets). The generated static libraries are then used to create a single [XCFramework](https://help.apple.com/xcode/mac/11.4/#/dev6f6ac218b) for `jq` and `oniguruma`.

All the build artifacts are available under the `Products` directory once the script finishes building.

## jq

Currently this repository targets the [`jq-1.7.1` release tag](https://github.com/stedolan/jq/tree/jq-1.7.1) of the [`jq` repository on GitHub](https://github.com/jqlang/jq), which is the latest stable release.

## Generated XCFramework

The `build.sh` script generates an `XCFramework` for `jq` and the associated version of `oniguruma`. To allow interoperability with Swift, these frameworks expose `Cjq` and `Coniguruma` clang modules for the respective static library. Both the `XCFramework`s are required for using the `jq` library. To use an `XCFramework`, you can [link the framework in your Xcode project](https://help.apple.com/xcode/mac/11.4/#/dev51a648b07), or [add it as a binary target to your Swift Package manifest](https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages).

## XCFramework Releases

A zip archive of the `XCFramework`s for `jq` and the associated version of `oniguruma` are available for download as part of the [release assets](https://github.com/Sameesunkaria/JQ-Darwin/releases). The release info should contain the `SHA-1` hashes of both the zip archives and the version of Xcode and other build tools used to generate the framework.

### Verifying Authenticity of Builds

Since the frameworks are being distributed as compiled binaries, it becomes crucial to verify the authenticity of the builds. The authenticity of the builds can be verified by checking out the release tag for the particular release and running the `build.sh` script. When the script finishes running, it prints out the `SHA-1` hashes of the zip archives of the newly built `XCFrameworks`. This hash must match the hash of the respective zip archives on the release page, and hash of the downloaded zip archive obtained by running:

```
shasum -a 1 path/to/framework.xcframework.zip
```

>**NOTE:** To generate an identical build for verifying the authenticity make sure that same versions of the Xcode and other build tools are used. Please follow the instructions provided in the README for the particular release that you want to verify. The instructions may vary between releases.

## Supported Targets

The `build.sh` file supports the following targets:

| | Platform | Deployment Target | Architecture | Variant |
|---|----------|-------------------|--------------|-------------|
| 📱 | iOS | 9.0 | armv7 | iPhone/iPad |
| 📱 | iOS | 9.0 | armv7s | iPhone/iPad |
| 📱 | iOS | 9.0 | arm64 | iPhone/iPad |
| 📱 | iOS | 9.0 | i386 | Simulator |
| 📱 | iOS | 9.0 | x86_64 | Simulator |
| 📱 | iOS | 9.0 | arm64 | Simulator |
| 📱 | iOS | 13.0 | x86_64 | Catalyst |
| 📱 | iOS | 13.0 | arm64 | Catalyst |
| 🖥 | macOS | 10.10 | x86_64 | Mac |
| 🖥 | macOS | 11.0 | arm64 | Mac |
| ⌚️ | watchOS | 2.0 | armv7k | Watch |
| ⌚️ | watchOS | 5.0 | arm64_32 | Watch |
| ⌚️ | watchOS | 2.0 | x86_64 | Simulator |
| ⌚️ | watchOS | 2.0 | arm64 | Simulator |
| 📺 | tvOS | 9.0 | arm64 | TV |
| 📺 | tvOS | 9.0 | x86_64 | Simulator |
| 📺 | tvOS | 9.0 | arm64 | Simulator |
| 🕶️ | visionOS | 1.0 | arm64 | Vision Pro |
| 🕶️ | visionOS | 1.0 | x86_64 | Simulator |
| 🕶️ | visionOS | 1.0 | arm64 | Simulator |

## License

The code in this repository is licensed under the MIT license. The zip archive of the `XCFramework`s for `jq` and `oniguruma` are licensed under their respective licenses. A copy of the `COPYING` license file is shipped with both the frameworks.