3 changed files with 201 additions and 0 deletions
@ -0,0 +1,5 @@
|
||||
ef03d922276fcd77dd6d0bfe89c6b5ddb0aa06e3 binutils-2.19-src.tar.gz |
||||
75d59049f26dc62f3732d11abbf056efc7bc8e95 gcc-core-3.4.5-20060117-2-src.tar.gz |
||||
edafa412d86085cf39f0db1c19a6ea2890d05946 gcc-g++-3.4.5-20060117-2-src.tar.gz |
||||
26d7a1f45d379faebe76adcf6b052e0ef634c70d mingwrt-3.15.1-mingw32-src.tar.gz |
||||
c75afe81bffb2cb7b924dcae3b5c76921d32f297 w32api-3.13-mingw32-src.tar.gz |
@ -0,0 +1,184 @@
|
||||
#!/bin/bash |
||||
# Build script for Slackware |
||||
# Copyright (C) 2009 Damien Goutte-Gattat |
||||
# |
||||
# Redistribution and use of this script, with or without modifications, |
||||
# is permitted provided that the following conditions are met: |
||||
# |
||||
# 1. Redistributions of this script must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR |
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||||
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
# POSSIBILITY OF SUCH DAMAGE. |
||||
# |
||||
# Contact: Damien Goutte-Gattat <damien.goutte-gattat@e.ujf-grenoble.fr> |
||||
# |
||||
# Latest mingw32 sourcecode is available at: <http://www.mingw.org/>. |
||||
|
||||
# Package infos |
||||
PKGNAME=${PKGNAME:-mingw32} |
||||
PKGVERSION=${PKGVERSION:-3.4.5} # GCC's version |
||||
BUILD=${BUILD:-1GGD} |
||||
ARCH=${ARCH:-i486} |
||||
TARGET=${TARGET:-i686-mingw32} |
||||
BASEURL=${BASEURL:-http://ovh.dl.sourceforge.net/mingw} |
||||
|
||||
# Directories |
||||
TMP=${TMP:-/tmp} |
||||
OUT=${OUT:-$TMP/build} |
||||
PKG=${PKG:-$OUT/mingw32} |
||||
CWD=$(pwd) |
||||
|
||||
set -e # Quit if a command returns non-zero |
||||
|
||||
# Sanity checks |
||||
if [ ! -d $TMP ]; then |
||||
echo "$TMP does not exist or is not a directory!" |
||||
exit 1 |
||||
fi |
||||
|
||||
# Compilation flags |
||||
case "$ARCH" in |
||||
i?86) |
||||
CPUOPT="-O2 -march=$ARCH -mtune=i686" |
||||
;; |
||||
*) |
||||
CPUOPT="-O2" |
||||
;; |
||||
esac |
||||
|
||||
# Download and verify the source archives |
||||
for archive in $(cut -d' ' -f3 checksums); do |
||||
if [ ! -r $archive ]; then |
||||
wget "$BASEURL/$archive" |
||||
fi |
||||
done |
||||
sha1sum -c checksums |
||||
|
||||
# Prepare the build |
||||
mkdir -p $TMP/mingw32 |
||||
cd $TMP/mingw32 |
||||
PATH=/opt/mingw32/bin:$PATH |
||||
|
||||
# Compile binutils |
||||
tar xf $CWD/binutils-*.tar.gz |
||||
cd binutils-* |
||||
mkdir build |
||||
cd build |
||||
CFLAGS="$CPUOPT -fno-exceptions" \ |
||||
../configure --prefix=/opt/mingw32 \ |
||||
--target=$TARGET \ |
||||
--with-gcc \ |
||||
--with-gnu-as \ |
||||
--with-gnu-ld \ |
||||
--disable-nls \ |
||||
--disable-debug |
||||
make -j 3 |
||||
make install |
||||
|
||||
# Install headers |
||||
cd $TMP/mingw32 |
||||
tar xf $CWD/mingwrt-*.tar.gz |
||||
tar xf $CWD/w32api-*.tar.gz |
||||
mkdir -p /opt/mingw32/include |
||||
(cd /opt/mingw32 && ln -s . usr && ln -s . local) |
||||
cp -r mingwrt-*/include /opt/mingw32 |
||||
cp -r w32api-*/include /opt/mingw32 |
||||
|
||||
# Compile temporary GCC (stage 1) |
||||
cd $TMP/mingw32 |
||||
tar xf $CWD/gcc-core-*.tar.gz |
||||
tar xf $CWD/gcc-g++-*.tar.gz |
||||
cd gcc-* |
||||
mkdir build |
||||
cd build |
||||
CFLAGS="$CPUOPT -fomit-frame-pointer" |
||||
../configure \ |
||||
--prefix=/opt/mingw32 \ |
||||
--target=$TARGET \ |
||||
--enable-languages=c \ |
||||
--disable-debug \ |
||||
--disable-nls \ |
||||
--with-gcc \ |
||||
--with-gnu-as \ |
||||
--with-gnu-ld \ |
||||
--enable-sjlj-exceptions \ |
||||
--enable-threads=win32 \ |
||||
--disable-win32-registry \ |
||||
--with-sysroot=/opt/mingw32 |
||||
make -j 3 |
||||
make install |
||||
|
||||
# Compile w32api libraries |
||||
cd $TMP/mingw32 |
||||
ln -s w32api-* w32api |
||||
cd w32api-* |
||||
mkdir build |
||||
cd build |
||||
CFLAGS="$CPUOPT" \ |
||||
../configure \ |
||||
--prefix=/opt/mingw32 \ |
||||
--host=$TARGET \ |
||||
--build=$ARCH-pc-linux-gnu |
||||
make -j 3 |
||||
make install |
||||
|
||||
# Compile MinGW runtime |
||||
cd $TMP/mingw32/mingwrt-* |
||||
mkdir build |
||||
cd build |
||||
CFLAGS="$CPUOPT" \ |
||||
../configure \ |
||||
--prefix=/opt/mingw32 \ |
||||
--host=$TARGET \ |
||||
--build=$ARCH-pc-linux-gnu |
||||
make -j 3 |
||||
make install |
||||
|
||||
# Compile final GCC (stage 2) |
||||
cd $TMP/mingw32/gcc-* |
||||
mkdir build2 |
||||
cd build2 |
||||
CFLAGS="$CPUOPT -fomit-frame-pointer" |
||||
../configure \ |
||||
--prefix=/opt/mingw32 \ |
||||
--target=$TARGET \ |
||||
--enable-languages=c,c++ \ |
||||
--disable-debug \ |
||||
--disable-nls \ |
||||
--with-gcc \ |
||||
--with-gnu-as \ |
||||
--with-gnu-ld \ |
||||
--enable-sjlj-exceptions \ |
||||
--enable-threads=win32 \ |
||||
--disable-win32-registry \ |
||||
--with-sysroot=/opt/mingw32 |
||||
make -j 3 |
||||
make install |
||||
|
||||
# Cleaning up the packaged tree |
||||
cd / |
||||
rm -rf /opt/mingw32/{doc,info,man} |
||||
find /opt/mingw32 | xargs file | grep "ELF 32-bit LSB" | cut -d : -f 1 | \ |
||||
xargs strip --strip-unneeded 2> /dev/null |
||||
|
||||
# Packaging |
||||
mkdir -p $PKG/{opt,install} |
||||
mv /opt/mingw32 $PKG/opt |
||||
install -m 644 $CWD/slack-desc $PKG/install/slack-desc |
||||
cd $PKG |
||||
mkdir -p $OUT |
||||
makepkg -l y -c n $OUT/$PKGNAME-$PKGVERSION-$ARCH-$BUILD.tgz |
||||
|
||||
# Cleaning up the build directories |
||||
cd / |
||||
rm -rf $TMP/mingw32 $PKG |
@ -0,0 +1,12 @@
|
||||
|-----handy-ruler------------------------------------------------------| |
||||
mingw32: mingw32 (cross compiler toolchain for Windows) |
||||
mingw32: |
||||
mingw32: This package installs a cross compiler suite targetting the Windows |
||||
mingw32: platform. |
||||
mingw32: |
||||
mingw32: http://www.mingw.org/ |
||||
mingw32: |
||||
mingw32: |
||||
mingw32: |
||||
mingw32: |
||||
mingw32: |
Loading…
Reference in new issue