https://github.com/ext/datapack
Compress and store data inside executable
https://github.com/ext/datapack
Last synced: about 1 month ago
JSON representation
Compress and store data inside executable
- Host: GitHub
- URL: https://github.com/ext/datapack
- Owner: ext
- License: bsd-2-clause
- Created: 2012-05-25T08:29:59.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2016-07-21T22:47:23.000Z (almost 10 years ago)
- Last Synced: 2024-11-26T01:45:25.941Z (over 1 year ago)
- Language: C
- Homepage:
- Size: 70.3 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
Simple test of compressing and storing datafiles inside executable or a loadable binary blob.
# Features
* Packs datafiles directly into executable or a binary blob.
* Compression using zlib.
* Allows users to override files (must be explicitly enabled.)
* API to access files in-memory (entire file is loaded into memory.)
* Supports FILE* for reading/writing (data is streamed).
* Load files either using a hardcoded handle from a header or using filename.
# Usage
1. Create ando/or edit datafiles
2. `datapacker NAME:FILENAME..` to generate c-file.
3. Build your app as usual and include generated c-file.
4. Use `unpack` or `unpack_filename` to load the data into memory.
`unpack` uses structure directly.
`unpack_filename` uses a virtual filename to locate the struct.
# Install
1. ./configure
2. make
3. make install
# Debian/Ubuntu
For apt-based distributions you can generate a `.deb` for easier installation:
1. ./configure
2. sudo make deb
3. sudo dpkg -i datapack_*.deb
# Using with automake
See Makefile.am for real example.
files.c: datapacker Makefile
$(AM_V_GEN)./datapacker -f ${top_srcdir}/datafiles -s ${top_srcdir} -d $(DEPDIR)/files.data -o files.c -e files.h
-include ./$(DEPDIR)/files.data
where `datafiles` is a list of files to pack.