Skip to content

Instantly share code, notes, and snippets.

@deevus
Created April 21, 2015 07:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deevus/40e223b1794017316900 to your computer and use it in GitHub Desktop.
Save deevus/40e223b1794017316900 to your computer and use it in GitHub Desktop.
Cross Compile GNU Hello using Docker
$pkg = "hello-2.10"
$file = "$pkg.tar.gz"
# get dockerfile
invoke-webrequest "https://raw.githubusercontent.com/deevus/docker-mxe/develop/Dockerfile" -outfile "Dockerfile"
# get package
if(!(test-path $file)) {
invoke-webrequest "http://gnu.mirror.uber.com.au/hello/$file" -outfile $file
}
# untar
if(!(test-path $pkg)) {
tar xzf $file
}
# set up boot2docker mounts
boot2docker up --vbox-share="$(pwd)=code"
boot2docker ssh "sudo umount ~/code"
boot2docker ssh "sudo mkdir -p ~/code && sudo mount -t vboxsf code ~/code"
# build docker image
docker build -t=deevus/mxe .
# build package
docker run -v /home/docker/code:/code deevus/mxe `
/bin/sh -c "cd /code/$pkg && ./configure --host=i686-pc-mingw32 --prefix=/code && make install"
# run it
bin/hello.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment