Skip to content

Commit 8f2bffc

Browse files
fixup! Add installation packaging script for FreeBSD
1 parent 2d7c55c commit 8f2bffc

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

platforms/FreeBSD/Readme.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# FreeBSD Swift Package Builder Script
2+
3+
## Description
4+
5+
This shell script automates the creation of FreeBSD packages (.pkg files) for Swift programming language toolchains. It takes a compiled Swift toolchain directory as input and produces a properly structured FreeBSD package that can be installed using the `pkg` package manager.
6+
7+
## Summary
8+
9+
The script is specifically designed for FreeBSD systems and requires a properly structured Swift toolchain with a `usr/` subdirectory containing the Swift binaries and libraries.
10+
11+
The script performs the following key operations:
12+
13+
- Validation: Ensures the current platform is FreeBSD and validates command-line arguments
14+
- Directory Setup: Creates temporary staging areas for package files and metadata
15+
- Toolchain Processing: Copies the Swift toolchain to the appropriate directory structure (`/usr/local/swift`)
16+
- Symlink Creation: Creates symbolic links in `/usr/local/bin` for `swift` and `swiftc` commands
17+
- Package Manifest Generation: Creates a FreeBSD package manifest with metadata including version, description, and maintainer information
18+
- File List Generation: Builds a complete list of files and symlinks to include in the package
19+
- Package Creation: Uses FreeBSD's `pkg create` command to build the final package with Zstandard compression
20+
- Cleanup: Removes temporary staging directories
21+
22+
The resulting package installs Swift to `/usr/local/swift` with convenient symlinks in `/usr/local/bin`, making Swift commands available in the standard path.
23+
24+
## Usage Examples
25+
26+
### Basic Usage
27+
28+
```
29+
# Package a Swift 6.2 toolchain
30+
./makePackage /home/user/swift-6.2-RELEASE-freebsd /usr/local/packages/swift-6.2.pkg
31+
```
32+
33+
### Complete Workflow Example
34+
35+
```
36+
# 1. Create the package
37+
./makePackage ./swift-6.2-RELEASE-freebsd ./swift-6.2.pkg
38+
39+
# 2. Install the package (as root)
40+
pkg install ./swift-6.2.pkg
41+
42+
# 3. Verify installation
43+
swift --version
44+
swiftc --help
45+
```

platforms/FreeBSD/makePackage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ EOF
9999
echo "Wrote manifest file to $METADATA_STAGING/manifest"
100100
echo "Wrote package file list to $METADATA_STAGING/pkg-plist"
101101

102-
# Generate the package. FreeBSD will helpful determine the required
102+
# Generate the package. FreeBSD will helpfully determine the required
103103
# dependencies for us based on the shared libraries that the binaries
104104
# in the toolchain require. We should call `pkg update` beforehand to
105105
# ensure this package database of dependencies is updated, just for

0 commit comments

Comments
 (0)