Artifact e04090f6966d80bd4bd165b58e3b8120c01764896894509d4a00da8fabd8e43b:
- File
utils/objfw-embed
— part of check-in
[1483709ab2]
at
2022-08-01 21:20:54
on branch trunk
— Add support for embedding files into binaries
Embedded files are available via the objfw-embedded: URL scheme. (user: js, size: 470) [annotate] [blame] [check-ins using]
#!/bin/sh if test $# != 3; then echo "Usage: $0 source_file filename output.m" 1>&2 exit 1 fi exec 1>$3 cat <<EOF #include <stddef.h> #include <stdint.h> extern void OFRegisterEmbeddedFile(const char *, const uint8_t *, size_t); static const uint8_t bytes[] = { EOF od -tx1 $1 | cut -s -d' ' -f 2- | sed 's/^/ 0x/;s/ /, 0x/g;s/$/,/' cat <<EOF }; static void __attribute__((__constructor__)) ctor(void) { OFRegisterEmbeddedFile("$2", bytes, sizeof(bytes)); } EOF