Skip to content

Instantly share code, notes, and snippets.

@an-dr
Last active September 12, 2019 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save an-dr/4ea106062810a800e7a978e5591b081c to your computer and use it in GitHub Desktop.
Save an-dr/4ea106062810a800e7a978e5591b081c to your computer and use it in GitHub Desktop.
Script for fully automatic building of OpenOCD on windows with MSYS2 with some fancy stuff
set -e # exit on error
export LANG="C"
# Prerequirements:
pacman -S --noconfirm --needed autoconf automake colormake git mingw32/mingw-w64-i686-libusb make mingw-w64-i686-gcc mingw-w64-i686-toolchain mingw-w64-i686-libtool mingw-w64-i686-pkg-config mingw-w64-cross-winpthreads-git p7zip
# Setup build system
export CFLAGS="$CFLAGS -Wno-error"
export CPPFLAGS="$CPPFLAGS -D__USE_MINGW_ANSI_STDIO=1 -Wno-error"
# # uncomment to compile release for debugging:
# export CFLAGS="$CFLAGS -g"; export CPPFLAGS="$CPPFLAGS -g"
# Build
colormake clean # clean all
./bootstrap
./configure --disable-doxygen-pdf --enable-ftdi --enable-jlink --enable-ulink --build=i686-w64-mingw32 --host=i686-w64-mingw32
colormake -j$((`nproc`+1)) # in parallel + 1
# Copy dlls
cp /mingw32/bin/libusb-1.0.dll ./src
cp /mingw32/bin/libgcc_s_dw2-1.dll ./src
cp /opt/i686-w64-mingw32/bin/libwinpthread-1.dll ./src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment