Skip to content

Instantly share code, notes, and snippets.

@notmatt
Forked from AlainODea/hello.c
Last active December 27, 2015 06:39
Show Gist options
  • Save notmatt/7283504 to your computer and use it in GitHub Desktop.
Save notmatt/7283504 to your computer and use it in GitHub Desktop.

Revisions

  1. notmatt revised this gist Dec 14, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion setup_cross_gcc_darwin_smartos.sh
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,11 @@
    #
    # Results in an OSX->SmartOS cross-compiler installed at $PREFIX/bin

    export TARGET=x86_64-sun-solaris2.11

    # 32/64 bit. Ensure smartos host zone has similar pkgsrc.
    export TARGET=i386-sun-solaris2.11
    # export TARGET=x86_64-sun-solaris2.11

    export PREFIX=$HOME/code/gcc/cross/$TARGET
    export SYSROOT=$PREFIX/sysroot
    export PATH=$PATH:$PREFIX/bin
  2. notmatt revised this gist Nov 3, 2013. 2 changed files with 60 additions and 43 deletions.
    60 changes: 60 additions & 0 deletions setup_cross_gcc_darwin_smartos.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    #!/bin/bash

    # Derived from: https://gist.github.com/AlainODea/6679613
    #
    # Prerequisites (in the loose sense of "worked for me"):
    # brew install binutils
    # brew install gcc47
    #
    # SMARTOS_HOST - a smartos host with ssh access as a source for the target
    # system libraries. I was using a JPC 'manta-build' image, which has numerous
    # pre-installed packages. Adjustments may be necessary if using stock smartos.
    #
    # Results in an OSX->SmartOS cross-compiler installed at $PREFIX/bin

    export TARGET=x86_64-sun-solaris2.11
    export PREFIX=$HOME/code/gcc/cross/$TARGET
    export SYSROOT=$PREFIX/sysroot
    export PATH=$PATH:$PREFIX/bin
    export SCRATCH=$HOME/code/gcc/scratch
    export SMARTOS_HOST=walter

    # ensure matches brew versions above.
    export BINUTILS=binutils-2.23.2
    export GCC=gcc-4.7.3

    mkdir $PREFIX
    mkdir $SYSROOT
    pushd $SYSROOT/


    # It's likely that not everything below is strictly necessary.
    ssh $SMARTOS_HOST "pkgin -y up && pkgin -y ug && pkgin -y in gmp"
    ssh $SMARTOS_HOST "tar -cf - /usr/include" | tar -xvf -
    ssh $SMARTOS_HOST "tar -cf - /opt/local/include" | tar -xvf -
    ssh $SMARTOS_HOST "tar -cf - /opt/local/gcc47/include" | tar -xvf -
    ssh $SMARTOS_HOST "tar -cf - /lib" | tar -xvf -
    ssh $SMARTOS_HOST "tar -cf - /usr/lib" | tar -xvf -
    ssh $SMARTOS_HOST "tar -cf - /usr/gnu/lib" | tar -xvf -

    mkdir $SCRATCH
    pushd $SCRATCH/

    wget http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.gz
    tar -xvzf $BINUTILS.tar.gz
    mkdir $SCRATCH/build-binutils
    pushd $SCRATCH/build-binutils/
    ../$BINUTILS/configure -target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT -v
    make all && make install
    popd

    wget http://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.gz
    tar -xvzf $GCC.tar.gz
    mkdir $SCRATCH/build-gcc
    pushd $SCRATCH/build-gcc/
    ../$GCC/configure --target=$TARGET --with-gnu-as --with-gnu-ld --with-gmp \
    --with-mpfr --with-mpc --prefix=$PREFIX --with-sysroot=$SYSROOT \
    --disable-libgcj --disable-libssp --disable-libada \
    --disable-libgomp --enable-languages=c,c++ -v
    make all && make install
    popd
    43 changes: 0 additions & 43 deletions setup_cross_gcc_linux_illumos.sh
    Original file line number Diff line number Diff line change
    @@ -1,43 +0,0 @@
    #!/bin/bash
    export TARGET=x86_64-sun-solaris2.11
    export PREFIX=$HOME/Documents/gcc/cross/$TARGET
    export SYSROOT=$PREFIX/sysroot
    export PATH=$PATH:$PREFIX/bin
    export SCRATCH=$HOME/Documents/gcc/scratch

    export BINUTILS=binutils-2.23.2
    export GCC=gcc-4.7.3

    sudo apt-get install texinfo binutils build-essential libgmp-dev libmpfr-dev libmpc-dev

    mkdir $PREFIX
    mkdir $SYSROOT
    pushd $SYSROOT/
    ssh root@ns2 "pkgin -y up && pkgin -y ug && pkgin -y in gmp"
    ssh root@ns2 "tar -cf - /usr/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /opt/local/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /opt/local/gcc47/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /lib" | tar -xvf -
    ssh root@ns2 "tar -cf - /usr/lib" | tar -xvf -
    ssh root@ns2 "tar -cf - /usr/gnu/lib" | tar -xvf -

    mkdir $SCRATCH
    pushd $SCRATCH/

    wget http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.gz
    tar -xvzf $BINUTILS.tar.gz
    mkdir $SCRATCH/build-binutils
    pushd $SCRATCH/build-binutils/
    ../$BINUTILS/configure -target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT -v
    make all && make install
    popd

    wget http://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.gz
    tar -xvzf $GCC.tar.gz
    mkdir $SCRATCH/build-gcc
    pushd $SCRATCH/build-gcc/
    ../$GCC/configure --target=$TARGET --with-gnu-as --with-gnu-ld --with-gmp \
    --with-mpfr --with-mpc --prefix=$PREFIX --with-sysroot=$SYSROOT \
    --disable-libgcj --enable-languages=c,c++ -v
    make all && make install
    popd
  3. @AlainODea AlainODea revised this gist Sep 26, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions setup_cross_gcc_linux_illumos.sh
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,7 @@ sudo apt-get install texinfo binutils build-essential libgmp-dev libmpfr-dev lib
    mkdir $PREFIX
    mkdir $SYSROOT
    pushd $SYSROOT/
    ssh root@ns2 "pkgin -y up && pkgin -y ug && pkgin -y in gmp"
    ssh root@ns2 "tar -cf - /usr/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /opt/local/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /opt/local/gcc47/include" | tar -xvf -
  4. @AlainODea AlainODea revised this gist Sep 24, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions hello.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #include<stdio.h>

    main()
    {
    printf("Hello World");
    }
  5. @AlainODea AlainODea renamed this gist Sep 24, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. @AlainODea AlainODea created this gist Sep 24, 2013.
    42 changes: 42 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    #!/bin/bash
    export TARGET=x86_64-sun-solaris2.11
    export PREFIX=$HOME/Documents/gcc/cross/$TARGET
    export SYSROOT=$PREFIX/sysroot
    export PATH=$PATH:$PREFIX/bin
    export SCRATCH=$HOME/Documents/gcc/scratch

    export BINUTILS=binutils-2.23.2
    export GCC=gcc-4.7.3

    sudo apt-get install texinfo binutils build-essential libgmp-dev libmpfr-dev libmpc-dev

    mkdir $PREFIX
    mkdir $SYSROOT
    pushd $SYSROOT/
    ssh root@ns2 "tar -cf - /usr/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /opt/local/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /opt/local/gcc47/include" | tar -xvf -
    ssh root@ns2 "tar -cf - /lib" | tar -xvf -
    ssh root@ns2 "tar -cf - /usr/lib" | tar -xvf -
    ssh root@ns2 "tar -cf - /usr/gnu/lib" | tar -xvf -

    mkdir $SCRATCH
    pushd $SCRATCH/

    wget http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.gz
    tar -xvzf $BINUTILS.tar.gz
    mkdir $SCRATCH/build-binutils
    pushd $SCRATCH/build-binutils/
    ../$BINUTILS/configure -target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT -v
    make all && make install
    popd

    wget http://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.gz
    tar -xvzf $GCC.tar.gz
    mkdir $SCRATCH/build-gcc
    pushd $SCRATCH/build-gcc/
    ../$GCC/configure --target=$TARGET --with-gnu-as --with-gnu-ld --with-gmp \
    --with-mpfr --with-mpc --prefix=$PREFIX --with-sysroot=$SYSROOT \
    --disable-libgcj --enable-languages=c,c++ -v
    make all && make install
    popd