Skip to content

Commit

Permalink
Target jq-1.7.1
Browse files Browse the repository at this point in the history
Added support for visionOS builds as well.
  • Loading branch information
Sameesunkaria committed Jun 7, 2024
1 parent 3afc8d4 commit 9e956c8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
.vscode
Products/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "jq"]
path = jq
url = https://github.com/stedolan/jq.git
url = https://github.com/jqlang/jq.git
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Build [jq](https://stedolan.github.io/jq/) for various Apple platforms. This rep

## Requirements

Xcode 12 or higher is required to generate a build for all the platforms supported by the `build.sh` script. In addition to that, all the system dependencies for building `jq` are also required. You'll need to have `automake`, and `autoconf` installed on your Mac (other dependencies are part of Xcode's command line tools).
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 you have all of the required dependencies and that command line tools are selected for the desired version of Xcode.
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):

Expand All @@ -22,7 +22,7 @@ To select Xcode command line tools:
sudo xcode-select -s /path/to/Xcode.app
```

Now, you can build by running the `build.sh` file.
Now, you can build by executing `build.sh`:

```
./build.sh
Expand All @@ -34,7 +34,7 @@ All the build artifacts are available under the `Products` directory once the sc

## jq

Currently this repository targets the [`jq-1.6` release tag](https://github.com/stedolan/jq/tree/jq-1.6) of the [`jq` repository on GitHub](https://github.com/stedolan/jq), which is the latest stable release.
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

Expand All @@ -58,7 +58,7 @@ shasum -a 1 path/to/framework.xcframework.zip

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

| | Platform | Deployment Target | Architecture | Varient |
| | Platform | Deployment Target | Architecture | Variant |
|---|----------|-------------------|--------------|-------------|
| 📱 | iOS | 9.0 | armv7 | iPhone/iPad |
| 📱 | iOS | 9.0 | armv7s | iPhone/iPad |
Expand All @@ -77,6 +77,9 @@ The `build.sh` file supports the following targets:
| 📺 | 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

Expand Down
28 changes: 23 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
set -e
trap 'echo "Build did not finish successfully."' ERR

BASEDIR=${PWD}
REPOROOT=$(git rev-parse --show-toplevel)
BASEDIR=${REPOROOT}


# Checking requirements
Expand Down Expand Up @@ -149,8 +150,8 @@ build "arm64" "iphoneos" "arm64-apple-ios9.0"
build "i386" "iphonesimulator" "i386-apple-ios9.0-simulator"
build "x86_64" "iphonesimulator" "x86_64-apple-ios9.0-simulator"
build "arm64" "iphonesimulator" "arm64-apple-ios9.0-simulator"
build "x86_64" "macosx" "x86_64-apple-ios13.0-macabi"
build "arm64" "macosx" "arm64-apple-ios13.0-macabi"
build "x86_64" "macosx" "x86_64-apple-ios14.0-macabi"
build "arm64" "macosx" "arm64-apple-ios14.0-macabi"
# macOS
build "x86_64" "macosx" "x86_64-apple-macos10.10"
build "arm64" "macosx" "arm64-apple-macos11.0"
Expand All @@ -163,26 +164,43 @@ build "arm64" "watchsimulator" "arm64-apple-watchos2.0-simulator"
build "arm64" "appletvos" "arm64-apple-tvos9.0"
build "x86_64" "appletvsimulator" "x86_64-apple-tvos9.0-simulator"
build "arm64" "appletvsimulator" "arm64-apple-tvos9.0-simulator"
#visionOS
build "arm64" "xros" "arm64-apple-xros1.0"
build "x86_64" "xrsimulator" "x86_64-apple-xros1.0-simulator"
build "arm64" "xrsimulator" "arm64-apple-xros1.0-simulator"


# Generating universal binaries for targets representing equivalent library definitions
echo "Generating required universal binaries"
lipo_targets "ios" "armv7-apple-ios9.0" "armv7s-apple-ios9.0" "arm64-apple-ios9.0"
lipo_targets "ios-simulator" "i386-apple-ios9.0-simulator" "x86_64-apple-ios9.0-simulator" "arm64-apple-ios9.0-simulator"
lipo_targets "ios-macabi" "x86_64-apple-ios13.0-macabi" "arm64-apple-ios13.0-macabi"
lipo_targets "ios-macabi" "x86_64-apple-ios14.0-macabi" "arm64-apple-ios14.0-macabi"
lipo_targets "macos" "x86_64-apple-macos10.10" "arm64-apple-macos11.0"
lipo_targets "watchos" "armv7k-apple-watchos2.0" "arm64_32-apple-watchos5.0"
lipo_targets "watchos-simulator" "x86_64-apple-watchos2.0-simulator" "arm64-apple-watchos2.0-simulator"
lipo_targets "tvos" "arm64-apple-tvos9.0"
lipo_targets "tvos-simulator" "x86_64-apple-tvos9.0-simulator" "arm64-apple-tvos9.0-simulator"
lipo_targets "xros" "arm64-apple-xros1.0"
lipo_targets "xrsimulator" "x86_64-apple-xros1.0-simulator" "arm64-apple-xros1.0-simulator"


# Generating xcframeworks
echo "Generating XCFrameworks"
cd ${BASEDIR}

JQ_FRAMEWORK_DIR="${BASEDIR}/Products/frameworks/Cjq.xcframework"
ONIG_FRAMEWORK_DIR="${BASEDIR}/Products/frameworks/Coniguruma.xcframework"

for framework_path in $JQ_FRAMEWORK_DIR $ONIG_FRAMEWORK_DIR; do
if [ -d "${framework_path}" ]; then
echo "Removing exisitng framework at path ${framework_path}"
rm -rf ${framework_path}
fi
done

XCFRAMEWORK_CMD_JQ="xcodebuild -create-xcframework -output ${BASEDIR}/Products/frameworks/Cjq.xcframework"
XCFRAMEWORK_CMD_ONIG="xcodebuild -create-xcframework -output ${BASEDIR}/Products/frameworks/Coniguruma.xcframework"
for target in ios ios-simulator ios-macabi macos watchos watchos-simulator tvos tvos-simulator; do
for target in ios ios-simulator ios-macabi macos watchos watchos-simulator tvos tvos-simulator xros xrsimulator; do
XCFRAMEWORK_CMD_JQ+=" -library ${BASEDIR}/Products/libs/${target}/jq/libjq.a -headers ${BASEDIR}/Products/libs/${target}/jq/include"
XCFRAMEWORK_CMD_ONIG+=" -library ${BASEDIR}/Products/libs/${target}/oniguruma/libonig.a -headers ${BASEDIR}/Products/libs/${target}/oniguruma/include"
done
Expand Down
2 changes: 1 addition & 1 deletion jq
Submodule jq updated 251 files

0 comments on commit 9e956c8

Please sign in to comment.