Skip to content

Instantly share code, notes, and snippets.

@adammw
Forked from TooTallNate/iphone4.2-node-configure
Created July 3, 2011 15:18
Show Gist options
  • Save adammw/1062306 to your computer and use it in GitHub Desktop.
Save adammw/1062306 to your computer and use it in GitHub Desktop.
Runs "configure"/"make" for Node.js, with the intent of cross-compiling Node for Windows 32 using mingw32
#! /bin/bash
#
# Program : mingw32-node-configure
# Authors : Nathan Rajlich (nathan@tootallnate.net)
# Michael Aaron Safyan (michaelsafyan@gmail.com)
# Adam Malcontenti-Wilson (adman.com@gmail.com)
# Synopsis : This program runs the "configure" script for Node.js.
# An install prefix of "/usr/i586-mingw32msvc" is assumed.
unset CPATH
unset C_INCLUDE_PATH
unset CPLUS_INCLUDE_PATH
unset OBJC_INCLUDE_PATH
unset LIBS
export TARGET="i586-mingw32msvc"
export TOOL_PREFIX="$TARGET-"
export SDKROOT="/usr/$TARGET"
if [ ! \( -d "$SDKROOT" \) ] ; then
echo "The mingw32 files could not be found. Folder \"$SDKROOT\" does not exist."
exit 1
fi
if [ ! \( -x "./configure" \) ] ; then
echo "This script must be run in the folder containing the \"configure\" script."
exit 1
fi
export AS="$SDKROOT/bin/as"
export ASCPP="$SDKROOT/bin/as"
export AR="$SDKROOT/bin/ar"
export RANLIB="$SDKROOT/bin/ranlib"
export CPPFLAGS="-I$SDKROOT/include"
export CFLAGS="--sysroot='$SDKROOT' -isystem $SDKROOT/include"
export CXXFLAGS="--sysroot='$SDKROOT' -isystem $SDKROOT/include"
export LDFLAGS="-I$SDKROOT/include -L$SDKROOT/lib"
export CPP="${TOOL_PREFIX}cpp"
export CC="${TOOL_PREFIX}gcc"
export CXX="${TOOL_PREFIX}-g++"
export LD="$SDKROOT/bin/ld"
export STRIP="$SDKROOT/bin/strip"
./configure \
--target="$TARGET" \
--dest-cpu="ia32" \
--dest-os="win" \
--without-snapshot \
$@
#! /bin/bash
#
# Program : mingw32-node-make
# Authors : Nathan Rajlich (nathan@tootallnate.net)
# Michael Aaron Safyan (michaelsafyan@gmail.com)
# Adam Malcontenti-Wilson (adman.com@gmail.com)
# Synopsis : This program runs the "configure" script for Node.js.
# An install prefix of "/usr/i586-mingw32msvc" is assumed.
unset CPATH
unset C_INCLUDE_PATH
unset CPLUS_INCLUDE_PATH
unset OBJC_INCLUDE_PATH
unset LIBS
export TARGET="i586-mingw32msvc"
export TOOL_PREFIX="$TARGET-"
export SDKROOT="/usr/$PREFIX"
if [ ! \( -d "$SDKROOT" \) ] ; then
echo "The mingw32 files could not be found. Folder \"$SDKROOT\" does not exist."
exit 1
fi
export AS="$SDKROOT/bin/as"
export ASCPP="$SDKROOT/bin/as"
export AR="$SDKROOT/bin/ar"
export RANLIB="$SDKROOT/bin/ranlib"
export CPPFLAGS="-I$SDKROOT/include"
export CFLAGS="--sysroot='$SDKROOT' -isystem $SDKROOT/include"
export CXXFLAGS="--sysroot='$SDKROOT' -isystem $SDKROOT/include"
export LDFLAGS="-I$SDKROOT/include -L$SDKROOT/lib"
export CPP="${TOOL_PREFIX}cpp"
export CC="${TOOL_PREFIX}gcc"
export CXX="${TOOL_PREFIX}-g++"
export LD="$SDKROOT/bin/ld"
export STRIP="$SDKROOT/bin/strip"
make \
$@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment