Skip to content

Instantly share code, notes, and snippets.

@Swyter
Last active June 29, 2016 18:06
Show Gist options
  • Select an option

  • Save Swyter/09c07baa6f8e1292be14c7ceef9dfb69 to your computer and use it in GitHub Desktop.

Select an option

Save Swyter/09c07baa6f8e1292be14c7ceef9dfb69 to your computer and use it in GitHub Desktop.
sudo apt-get install mingw-w64 tree gcc binutils
DATE_SUFFIX=`date "+_%Y.%m.%d-%H.%M" -u`
function github_upload {
echo "--> Uploading $1 (`file -b --mime-type "$1"`) to Github..."
curl -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: `file -b --mime-type "$1"`" \
"https://uploads.github.com/repos/Swyter/sphinxtools/releases/3534393/assets?name=$1" \
--fail --data-binary "@$1"
}
function compile_win32 {
i686-w64-mingw32-gcc -Ofast -flto \
-Imman-win32 \
"$1.c" \
mman-win32/mman.c \
-lws2_32 \
-std=gnu99 \
-o "$2.exe"
i686-w64-mingw32-strip "$2.exe"
}
function compile_linux {
gcc -Ofast -flto -std=gnu99 "$1.c" -o "$2.elf"
strip "$2.elf"
}
function compile {
compile_linux "$1" "$1$DATE_SUFFIX"
compile_win32 "$1" "$1$DATE_SUFFIX"
github_upload "$1$DATE_SUFFIX.elf"
github_upload "$1$DATE_SUFFIX.exe"
}
git clone https://github.com/witwall/mman-win32.git && mkdir mman-win32/sys && cp mman-win32/mman.h mman-win32/sys
curl 'https://gist.githubusercontent.com/panzi/6856583/raw/1eca2ab34f2301b9641aa73d1016b951fff3fc39/portable_endian.h' \
-o mman-win32/endian.h
tree .
compile sphinx_filelistbin_extract
compile sphinx_filelistbin_extract_demo
tree .
ls -lash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment