๐Ÿ“ฆ Bogdanp / Noise

A Swift wrapper around Racket CS.

โ˜… 62 stars โ‘‚ 5 forks ๐Ÿ‘ 62 watching โš–๏ธ BSD 3-Clause "New" or "Revised" License
chezschemeracketswift
๐Ÿ“ฅ Clone https://github.com/Bogdanp/Noise.git
HTTPS git clone https://github.com/Bogdanp/Noise.git
SSH git clone git@github.com:Bogdanp/Noise.git
CLI gh repo clone Bogdanp/Noise
Bogdan Popa Bogdan Popa doc: mention racket-9.0 branch [skip ci] 3fd6ef2 1 months ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ Bin
๐Ÿ“ Lib
๐Ÿ“ Racket
๐Ÿ“ Sources
๐Ÿ“ Template
๐Ÿ“ Tests
๐Ÿ“„ .gitattributes
๐Ÿ“„ .gitignore
๐Ÿ“„ LICENSE
๐Ÿ“„ Makefile
๐Ÿ“„ Package.swift
๐Ÿ“„ README.md
๐Ÿ“„ README.md

Noise

Noise is a Swift wrapper around the [Racket] CS runtime intended to simplify embedding. See Tests/NoiseTest/RacketTest.swift for an example.

Quickstart

  • Clone this repository.
  • Run raco pkg install Racket/noise-serde{-lib,-doc}/.
  • Run make.
Note: Git LFS is used to store the binary files in Lib/ and in Sources/Noise/boot, so you will need have [LFS] installed in order to pull those files.

Usage

The shared libraries and the boot files must match the version of Racket you use to compile your Racket code. Most likely, the versions of the files checked into the master branch won't match your version of Racket, if you're using a release build of Racket. To import your own versions of these files, build Racket from source and run:

./Bin/copy-libs.sh arm64-macos /path/to/src/racket

Where the first argument depends on your target OS and architecture:

OSArchitectureArgument
macOSx86_64x86_64-macos
macOSarm64/aarch64arm64-macos
iOSarm64/aarch64arm64-ios
iOS Simulatorarm64/aarch64arm64-iphonesimulator
For iOS, you have to configure Racket with the following flags in order to generate a portable bytecode build:

configure \ --host=aarch64-apple-darwin \ --enable-ios=iPhoneOS \ --enable-pb \ --enable-racket=auto \ --enable-libffi

For the iPhone Simulator, change the value of the --enable-ios flag to iPhoneSimulator. After building for either platform, you need to merge the associated libffi archive into the generated libracketcs.a. For example:

libtool -s \ -o racket/lib/libracketcs1.a \ racket/lib/libracketcs.a \ /path/to/libffi.a \ && mv racket/libracketcs{1,}.a

Pre-compiled builds for recent versions of Racket are available on the following branches:

  • racket-9.0
  • racket-8.18
  • racket-8.17
  • racket-8.16
  • racket-8.15 (first branch to include an iOS build)
  • racket-8.14
  • racket-8.13
  • racket-8.12
  • racket-8.11.1
  • racket-8.11
  • racket-8.10
See [NoiseBackendExample] for an example application built with Noise.

NoiseSerde

The NoiseSerde package and its associated noise/serde module (from Racket/noise-serde-lib) provide a way to define data structures that can automatically be shared (via serialization & deserialization) between Racket and Swift.

To use NoiseSerde from Racket, you will have to install noise-serde-lib:

raco pkg install Racket/noise-serde-lib/

You may also want to install its docs:

raco pkg install Racket/noise-serde-doc/

Run raco docs noise to read the docs.

NoiseBackend

The NoiseBackend package and its associated noise/backend module build upon NoiseSerde to provide a client-server implementation where the Racket server is continuously run in a background thread and the Swift client communicates with it via pipes.

License

Noise and its associated packages are licensed under the 3-Clause BSD license.

See this page for information on Racket's license.