0
# Binary Targets
1
2
Binary target system that maps platform characteristics to appropriate Prisma engine targets. The system supports 33+ different platform configurations covering major operating systems, architectures, and SSL library versions.
3
4
## Capabilities
5
6
### Binary Target Type
7
8
Union type defining all supported binary target platform strings used by Prisma engines.
9
10
```typescript { .api }
11
type BinaryTarget =
12
| 'native'
13
| 'darwin'
14
| 'darwin-arm64'
15
| 'debian-openssl-1.0.x'
16
| 'debian-openssl-1.1.x'
17
| 'debian-openssl-3.0.x'
18
| 'rhel-openssl-1.0.x'
19
| 'rhel-openssl-1.1.x'
20
| 'rhel-openssl-3.0.x'
21
| 'linux-arm64-openssl-1.1.x'
22
| 'linux-arm64-openssl-1.0.x'
23
| 'linux-arm64-openssl-3.0.x'
24
| 'linux-arm-openssl-1.1.x'
25
| 'linux-arm-openssl-1.0.x'
26
| 'linux-arm-openssl-3.0.x'
27
| 'linux-musl'
28
| 'linux-musl-openssl-3.0.x'
29
| 'linux-musl-arm64-openssl-1.1.x'
30
| 'linux-musl-arm64-openssl-3.0.x'
31
| 'linux-nixos'
32
| 'linux-static-x64'
33
| 'linux-static-arm64'
34
| 'windows'
35
| 'freebsd11'
36
| 'freebsd12'
37
| 'freebsd13'
38
| 'freebsd14'
39
| 'freebsd15'
40
| 'openbsd'
41
| 'netbsd'
42
| 'arm';
43
```
44
45
### Binary Targets Array
46
47
Array containing all supported binary target strings, excluding the 'native' placeholder.
48
49
```typescript { .api }
50
/**
51
* Array of all supported binary target platform strings
52
* Used for validation and iteration over available targets
53
*/
54
const binaryTargets: BinaryTarget[];
55
```
56
57
**Usage Examples:**
58
59
```typescript
60
import { binaryTargets, BinaryTarget } from "@prisma/get-platform";
61
62
// Check if a target is supported
63
function isValidTarget(target: string): target is BinaryTarget {
64
return binaryTargets.includes(target as BinaryTarget) || target === 'native';
65
}
66
67
// List all Linux targets
68
const linuxTargets = binaryTargets.filter(target => target.startsWith('linux-'));
69
console.log(linuxTargets);
70
// [
71
// 'linux-arm64-openssl-1.1.x',
72
// 'linux-arm64-openssl-1.0.x',
73
// 'linux-arm64-openssl-3.0.x',
74
// 'linux-arm-openssl-1.1.x',
75
// 'linux-arm-openssl-1.0.x',
76
// 'linux-arm-openssl-3.0.x',
77
// 'linux-musl',
78
// 'linux-musl-openssl-3.0.x',
79
// 'linux-musl-arm64-openssl-1.1.x',
80
// 'linux-musl-arm64-openssl-3.0.x',
81
// 'linux-nixos',
82
// 'linux-static-x64',
83
// 'linux-static-arm64'
84
// ]
85
86
// Get all OpenSSL 3.0.x targets
87
const openssl3Targets = binaryTargets.filter(target => target.includes('openssl-3.0.x'));
88
console.log(openssl3Targets);
89
```
90
91
## Binary Target Categories
92
93
### macOS Targets
94
95
- **`darwin`**: Intel-based macOS (x64)
96
- **`darwin-arm64`**: Apple Silicon macOS (M1/M2/etc.)
97
98
### Windows Targets
99
100
- **`windows`**: All Windows platforms (x64, x86)
101
102
### Linux glibc Targets
103
104
**Debian-based distributions** (Ubuntu, Debian, Mint, etc.):
105
- `debian-openssl-1.0.x`
106
- `debian-openssl-1.1.x`
107
- `debian-openssl-3.0.x`
108
109
**RHEL-based distributions** (CentOS, Fedora, AlmaLinux, etc.):
110
- `rhel-openssl-1.0.x`
111
- `rhel-openssl-1.1.x`
112
- `rhel-openssl-3.0.x`
113
114
**ARM64 Linux** (glibc-based):
115
- `linux-arm64-openssl-1.0.x`
116
- `linux-arm64-openssl-1.1.x`
117
- `linux-arm64-openssl-3.0.x`
118
119
**ARM 32-bit Linux** (glibc-based):
120
- `linux-arm-openssl-1.0.x`
121
- `linux-arm-openssl-1.1.x`
122
- `linux-arm-openssl-3.0.x`
123
124
### Linux musl Targets
125
126
**Alpine Linux and musl-based distributions**:
127
- `linux-musl`: Base musl target (OpenSSL 1.1.x or no SSL)
128
- `linux-musl-openssl-3.0.x`: Alpine 3.17+ with OpenSSL 3.0
129
- `linux-musl-arm64-openssl-1.1.x`: ARM64 Alpine with OpenSSL 1.1
130
- `linux-musl-arm64-openssl-3.0.x`: ARM64 Alpine with OpenSSL 3.0
131
132
### Specialized Linux Targets
133
134
- **`linux-nixos`**: NixOS distribution
135
- **`linux-static-x64`**: Statically linked x64 binaries
136
- **`linux-static-arm64`**: Statically linked ARM64 binaries
137
- **`arm`**: Generic ARM target (Raspbian fallback)
138
139
### BSD Targets
140
141
**FreeBSD versions**:
142
- `freebsd11`, `freebsd12`, `freebsd13`, `freebsd14`, `freebsd15`
143
144
**Other BSD**:
145
- `openbsd`: OpenBSD
146
- `netbsd`: NetBSD
147
148
### Special Targets
149
150
- **`native`**: Placeholder indicating platform-native compilation (not in binaryTargets array)
151
152
## Target Selection Logic
153
154
The binary target selection follows this priority order:
155
156
1. **Platform identification**: macOS, Windows, Linux, BSD
157
2. **Architecture detection**: x64, arm64, arm, etc.
158
3. **Distribution family**: For Linux - Debian, RHEL, Alpine/musl, NixOS
159
4. **SSL library version**: 1.0.x, 1.1.x, 3.0.x (normalized)
160
5. **Fallback strategy**: Default to Debian + OpenSSL 1.1.x if detection fails
161
162
**Examples of target resolution**:
163
164
```typescript
165
// macOS on Apple Silicon
166
{ platform: 'darwin', arch: 'arm64' } → 'darwin-arm64'
167
168
// Ubuntu 20.04 on x64 with OpenSSL 1.1
169
{ platform: 'linux', targetDistro: 'debian', libssl: '1.1.x' } → 'debian-openssl-1.1.x'
170
171
// Alpine Linux on ARM64 with OpenSSL 3.0
172
{ platform: 'linux', targetDistro: 'musl', arch: 'arm64', libssl: '3.0.x' } → 'linux-musl-arm64-openssl-3.0.x'
173
174
// CentOS 8 on x64 with OpenSSL 1.1
175
{ platform: 'linux', targetDistro: 'rhel', libssl: '1.1.x' } → 'rhel-openssl-1.1.x'
176
177
// FreeBSD 13
178
{ platform: 'freebsd', targetDistro: 'freebsd13' } → 'freebsd13'
179
```
180
181
## SSL Version Handling
182
183
OpenSSL version detection and normalization:
184
185
- **Version normalization**: OpenSSL 3.1.x, 3.2.x → 3.0.x (API compatible)
186
- **Detection methods**:
187
1. libssl.so file inspection (preferred)
188
2. ldconfig cache lookup
189
3. openssl binary version (fallback)
190
- **Default fallback**: 1.1.x if detection fails
191
- **Excluded versions**: libssl 0.x automatically filtered out
192
193
## Platform Warnings
194
195
The system emits warnings for:
196
197
- **Unsupported architectures**: Non-x64/arm64 on Linux
198
- **SSL detection failure**: Falls back to default with installation instructions
199
- **Unknown platforms**: Falls back to Linux target
200
- **Unknown distributions**: Falls back to Debian family
201
202
These warnings help users understand potential compatibility issues while maintaining functionality.