Skip to content

Instantly share code, notes, and snippets.

@ryankurte
Created March 10, 2020 00:10
Show Gist options
  • Save ryankurte/69a6ae74a60a0ea0b68e7f3ef43f44b2 to your computer and use it in GitHub Desktop.
Save ryankurte/69a6ae74a60a0ea0b68e7f3ef43f44b2 to your computer and use it in GitHub Desktop.
pkg-config multiarch stuff
#!/bin/sh
if [ $TARGET == "x86_64-unknown-linux-gnu" ]; then
cargo build --target=$TARGET --release
elif [ $TARGET == "x86_64-apple-darwin" ]; then
cargo build --target=$TARGET --release
elif [ $TARGET == "armv7-unknown-linux-gnueabihf" ]; then
sh ./cross-linux-armhf.sh
elif [ $TARGET == "i686-pc-windows-gnu" ]; then
sh ./cross-win-x86.sh
else
fi
#!/bin/sh
# Platform: arm-linux-gnueabihf
# This requires multiarch (armhf) as well as libusb-dev:armhf
export SYSROOT=/usr/arm-linux-gnueabihf
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
export PKG_CONFIG_SYSTEM_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf
export PKG_CONFIG_SYSTEM_INCLUDE_PATH=/usr/arm-linux-gnueabihf/include
cargo build --target armv7-unknown-linux-gnueabihf
#!/bin/sh
# Platform: windows 32 bit mingw
# this requires gcc-mingw-w64 and mingw-w64
# as well as a win32 libusb to be findable with pkg-config
export ARCH=i686
export TARGET=${ARCH}-w64-mingw32
export SYSROOT=/usr/${TARGET}
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_LIBDIR=/usr/lib/${TARGET}/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=/usr/lib/gcc/${TARGET}/8.3-posix
export PKG_CONFIG_SYSTEM_LIBRARY_PATH=${SYSROOT}/lib
export PKG_CONFIG_SYSTEM_INCLUDE_PATH=${SYSROOT}/include
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:`pwd`/scripts/win
cargo build --target ${ARCH}-pc-windows-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment