Refactor PDF generation in make_pdf.sh to streamline the process by removing reliance on textutil. The script now directly converts plain text to PDF using cupsfilter, enhancing compatibility and reducing complexity.
This commit is contained in:
32
build_tools/macos/export_compliance/README.md
Normal file
32
build_tools/macos/export_compliance/README.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Export compliance (encryption)
|
||||||
|
|
||||||
|
Apple may require an "Export Compliance" statement upload when submitting to the Mac App Store.
|
||||||
|
|
||||||
|
This folder contains:
|
||||||
|
|
||||||
|
- `EXPORT_COMPLIANCE.txt`: a template statement (fill-in placeholders)
|
||||||
|
- `make_pdf.sh`: a helper to fill the template and generate a PDF you can upload
|
||||||
|
|
||||||
|
## Generate the PDF
|
||||||
|
|
||||||
|
From the repo root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build_tools/macos/export_compliance/make_pdf.sh \
|
||||||
|
--bundle-id com.dryark.strawberry \
|
||||||
|
--version 1.2.3 \
|
||||||
|
--developer "Dry Ark LLC" \
|
||||||
|
--contact "support@example.com"
|
||||||
|
```
|
||||||
|
|
||||||
|
Outputs:
|
||||||
|
|
||||||
|
- `build_tools/macos/export_compliance/EXPORT_COMPLIANCE.filled.txt`
|
||||||
|
- `build_tools/macos/export_compliance/EXPORT_COMPLIANCE.pdf`
|
||||||
|
|
||||||
|
## Important
|
||||||
|
|
||||||
|
This template assumes the app uses **only standard OS-provided encryption** (e.g. TLS/HTTPS via system frameworks) and does **not** ship proprietary or standalone crypto libraries.
|
||||||
|
|
||||||
|
If you bundle your own crypto library (e.g. OpenSSL) or implement custom encryption, you likely need different answers/documentation.
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ Outputs (in the same folder as this script):
|
|||||||
- EXPORT_COMPLIANCE.pdf
|
- EXPORT_COMPLIANCE.pdf
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- Uses macOS built-in /usr/bin/textutil + /usr/sbin/cupsfilter to generate the PDF.
|
- Uses macOS built-in /usr/sbin/cupsfilter to generate the PDF from plain text.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
template="${script_dir}/EXPORT_COMPLIANCE.txt"
|
template="${script_dir}/EXPORT_COMPLIANCE.txt"
|
||||||
filled="${script_dir}/EXPORT_COMPLIANCE.filled.txt"
|
filled="${script_dir}/EXPORT_COMPLIANCE.filled.txt"
|
||||||
pdf="${script_dir}/EXPORT_COMPLIANCE.pdf"
|
pdf="${script_dir}/EXPORT_COMPLIANCE.pdf"
|
||||||
|
tmp_html="${script_dir}/EXPORT_COMPLIANCE.tmp.html"
|
||||||
|
|
||||||
bundle_id=""
|
bundle_id=""
|
||||||
version=""
|
version=""
|
||||||
@@ -57,10 +58,6 @@ if [[ ! -f "$template" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -x /usr/bin/textutil ]]; then
|
|
||||||
echo "Error: /usr/bin/textutil not found. This should exist on macOS." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -x /usr/sbin/cupsfilter ]]; then
|
if [[ ! -x /usr/sbin/cupsfilter ]]; then
|
||||||
echo "Error: /usr/sbin/cupsfilter not found. This should exist on macOS." >&2
|
echo "Error: /usr/sbin/cupsfilter not found. This should exist on macOS." >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -87,15 +84,11 @@ sed \
|
|||||||
"$template" > "$filled"
|
"$template" > "$filled"
|
||||||
|
|
||||||
rm -f "$pdf" >/dev/null 2>&1 || true
|
rm -f "$pdf" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
# textutil does not support direct PDF output on modern macOS; convert to HTML first, then print-to-PDF via cupsfilter.
|
|
||||||
tmp_html="${script_dir}/EXPORT_COMPLIANCE.tmp.html"
|
|
||||||
rm -f "$tmp_html" >/dev/null 2>&1 || true
|
rm -f "$tmp_html" >/dev/null 2>&1 || true
|
||||||
/usr/bin/textutil -convert html "$filled" -output "$tmp_html" >/dev/null
|
|
||||||
|
|
||||||
# Convert HTML to PDF. cupsfilter writes to stdout by default.
|
# Convert plain text to PDF. cupsfilter writes PDF to stdout.
|
||||||
/usr/sbin/cupsfilter -i text/html -m application/pdf "$tmp_html" > "$pdf"
|
# Suppress noisy DEBUG output from cupsfilter on stderr.
|
||||||
rm -f "$tmp_html" >/dev/null 2>&1 || true
|
/usr/sbin/cupsfilter -i text/plain -m application/pdf "$filled" > "$pdf" 2>/dev/null
|
||||||
|
|
||||||
echo "Wrote:"
|
echo "Wrote:"
|
||||||
echo " $filled"
|
echo " $filled"
|
||||||
|
|||||||
Reference in New Issue
Block a user