Nouveau forum : https://forum.slackware-fr.eu.org/

Annonce

29/01/2017 : Ce forum est désormais en lecture seule. Merci d'utiliser le nouveau forum.

13/12/2014 : Inscriptions désactivées pour un moment en raison d'une recrudescence d'inscriptions plus que douteuses.

#1 03-02-2009 00:16:28

gouttegd
Membre très actif
Lieu: Grenoble
Date d'inscription: 11-04-2007
Messages: 210

[SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

Ce SlackBuild construit un paquetage contenant tout le nécessaire pour cross-compiler sous Slackware des programmes exécutables sous Windows : les binutils, GCC (pour les langages C et C++), et les fichiers d’en-têtes et les bibliothèques de l’API Win32.

Il est essentiellement basé sur les scripts officiels de MinGW, mais il construit un paquetage Slackware au lieu de simplement installer les fichiers sur le système.

/!\ Ce SlackBuild doit être exécuté sous root /!\

En effet, le GCC "intermédiaire" utilisé pour compiler les bibliothèques Windows et le runtime MinGW doit être exécuté à partir de son emplacement final (/opt/mingw32) pour fonctionner correctement. Impossible donc de l'installer dans un répertoire temporaire où un utilisateur normal aurait le droit d'écrire.

Du coup, ce SlackBuild installe tous les fichiers à leur place finale, puis une fois que tout est compilé, déplace l'ensemble vers un répertoire temporaire ($PKG) d'où le paquetage est finalement construit.

Je suis conscient que ce SlackBuild va à l'encontre des (bonnes) habitudes prônées sur ce site. Si quelqu'un trouve un moyen de tout compiler sans nécessiter les droits du super-utilisateur, je suis preneur. smile En attendant, je vous invite à ne pas me faire confiance et à examiner trois fois plutôt qu'une le contenu du script avant de l'exécuter. wink

Le SlackBuild :

Code:

#!/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 Windows and MinGW 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

Le fichier "checksums" :

Code:

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

Et le slack-desc :

Code:

       |-----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:

Dernière modification par gouttegd (03-02-2009 00:17:12)


« Je vous aiderai si vous me promettez d'aider quelqu'un en retour. » --- anonyme
« Soyez vigilant lorsque vous vous exprimez dans un forum électronique. Vos fautes de frappe et de syntaxe vous poursuivront pour l'éternité. » --- Linus B. Torvalds

Hors ligne

 

#2 03-02-2009 18:38:32

_Hitek_
Slacker depuis 2003 (Slack 9.0)
Date d'inscription: 29-12-2005
Messages: 1258
Site web

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

Pour ce genre de trucs à executer en root, rien ne vaut une machine virtuelle qu'on reset vers le dernier snapshot après compile. smile

Hors ligne

 

#3 03-05-2009 03:48:56

gouttegd
Membre très actif
Lieu: Grenoble
Date d'inscription: 11-04-2007
Messages: 210

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

Bon, j’ai finalement trouvé un moyen de construire le cross-compilateur sans devoir exécuter le SlackBuild sous root.

Du coup, le SlackBuild ci-dessus est éclaté en trois SlackBuilds distincts : un pour les binutils, un pour les bibliothèques Win32 et le runtime MinGW, et finalement un dernier pour le cross-compilateur proprement dit.

J’en ai profité pour mettre à jour les binutils (2.19 à 2.19.1) et le runtime MinGW (3.15.1 à 3.15.2).

1. d/binutils-mingw32
binutils-mingw32.SlackBuild :

Code:

#!/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 binutils-mingw32 sourcecode is available at: <http://www.mingw.org/>.

# Source package infos
NAMESRC=${NAMESRC:-binutils}
VERSION=${VERSION:-2.19.1}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION-src.tar.gz}
WGET=${WGET:-http://ovh.dl.sourceforge.net/mingw/$ARCHIVE}

# Build infos
NAMETGZ=${NAMETGZ:-binutils-mingw32}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-$ARCH-pc-mingw32}
JOBS=${JOBS:-1}

# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMETGZ}
CWD=$(pwd)

set -e

# Sanity checks
if [ $UID -eq 0 ]; then
    echo "You should NOT run this script as ROOT!"
    exit 1
fi
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"
    ;;
x86_64)
    CPUOPT="-O2 -fPIC"
    ;;
*)
    CPUOPT="-O2"
    ;;
esac

# Get and verify the source archive
if [ ! -r $ARCHIVE ]; then
    rm -f $ARCHIVE.part
    wget -vc "$WGET" -O $ARCHIVE.part
    mv $ARCHIVE.part $ARCHIVE
fi
sha1sum -c $ARCHIVE.sha1
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)

# Compile
cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
CFLAGS=$CPUOPT \
./configure \
  --prefix=/opt/mingw32 \
  --target=$TARGET \
  --with-gcc \
  --with-gnu-as \
  --with-gnu-ld \
  --disable-nls \
  --disable-debug
make -j $JOBS
make install DESTDIR=$PKG

# Strip binaries
find $PKG | xargs file | grep "ELF 32-bit LSB" | cut -d : -f 1 | \
  xargs strip --strip-unneeded 2> /dev/null

# Delete man and info pages, since we already have those of
# the native binutils in /usr
rm -rf $PKG/opt/mingw32/{info,man}

# Copy slack-desc file
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc

# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
rm -rf $PKG
rm -rf $TMP/$NAME
"
if type -p fakeroot ; then
    echo "$PACKAGING" | fakeroot
else
    su -c "$PACKAGING"
fi

slack-desc :

Code:

                |-----handy-ruler------------------------------------------------------|
binutils-mingw32: binutils-mingw32 (GNU binary development tools for Win32)
binutils-mingw32: 
binutils-mingw32: Binutils is a collection of binary utilities. It includes
binutils-mingw32: "as" (the portable GNU assembler), "ld" (the GNU linker),
binutils-mingw32: and other utilities for creating and working with binary
binutils-mingw32: programs.
binutils-mingw32: 
binutils-mingw32: This package installs a cross-compiled version of the
binutils-mingw32: binutils to target the Win32 platform.
binutils-mingw32: 
binutils-mingw32:

binutils-2.19.1-src.tar.gz :

Code:

7e930435c47991c4070b1c74b010350e4669011f  binutils-2.19.1-src.tar.gz

2. l/mingw32-libs
mingw32-libs.SlackBuild

Code:

#!/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-libs sourcecode is available at: <http://www.mingw.org/>.
#
# Depends: d/mingw32-binutils

# Source packages infos (checksums and filenames in `checksums' file)
VERSION=${VERSION:-3.15.2} # MinGW runtime's version
BASEURL=${BASEURL:-http://ovh.dl.sourceforge.net/mingw}

# Build infos
NAMETGZ=${NAMETGZ:-mingw32-libs}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-$ARCH-pc-mingw32}
JOBS=${JOBS:-1}

# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMETGZ}
CWD=$(pwd)

set -e

# Sanity checks
if [ $UID -eq 0 ]; then
    echo "You should NOT run this script as ROOT!"
    exit 1
fi
if [ ! -d $TMP ]; then
    echo "$TMP does not exist or is not a directory!"
    exit 1
fi
if [ ! -d /opt/mingw32 ]; then
    echo "MinGW32 base directory not found!"
    exit 1
fi
if ! echo $PATH | grep -q /opt/mingw32/bin ; then
    PATH=$PATH:/opt/mingw32/bin
fi

# Compilation flags
case "$ARCH" in
i?86)
    CPUOPT="-O2 -march=$ARCH -mtune=i686"
    ;;
x86_64)
    CPUOPT="-O2 -fPIC"
    ;;
*)
    CPUOPT="-O2"
    ;;
esac

# Get and verify the source archive
for archive in $(cut -d' ' -f3 checksums); do
    if [ ! -r $archive ]; then
        rm -f $archive.part
        wget -vc "$BASEURL/$archive" -O $archive.part
        mv $archive.part $archive
    fi
done
sha1sum -c checksums

# Extract everything
mkdir -p $TMP/mingw32
cd $TMP/mingw32
tar xf $CWD/gcc-core-*.tar.gz
tar xf $CWD/w32api-*.tar.gz
tar xf $CWD/mingwrt-*.tar.gz

# Compile 1st stage GCC
mkdir stage1 stage1-build
cp -a w32api-*/include stage1/
cp -a mingwrt-*/include stage1/
ln -s . stage1/usr
ln -s . stage1/local
cd stage1-build
CFLAGS="$CPUOPT -fomit-frame-pointer" \
$TMP/mingw32/gcc-*/configure \
  --prefix=$TMP/mingw32/stage1 \
  --target=$TARGET \
  --enable-languages=c \
  --disable-debug \
  --disable-nls \
  --with-gcc \
  --with-as=/opt/mingw32/bin/i686-pc-mingw32-as \
  --with-ld=/opt/mingw32/bin/i686-pc-mingw32-ld \
  --enable-sjlj-exceptions \
  --enable-threads=win32 \
  --disable-win32-registry \
  --with-sysroot=$TMP/mingw32/stage1
make -j $JOBS
make install
PATH=$PATH:$TMP/mingw32/stage1/bin

# Compile Win32 API libraries
cd $TMP/mingw32/w32api-*
mkdir build && cd build
CFLAGS="$CPUOPT" \
../configure \
  --prefix=/opt/mingw32 \
  --host=$TARGET \
  --build=$ARCH-pc-linux-gnu
make -j $JOBS
make install prefix=$PKG/opt/mingw32

# Compile MinGW runtime
cd $TMP/mingw32/mingwrt-*
mkdir build && cd build
CFLAGS="-I$PKG/opt/mingw32/include $CPUOPT" \
../configure \
  --prefix=/opt/mingw32 \
  --host=$TARGET \
  --build=$ARCH-pc-linux-gnu
sed -i "s:-Lmingwex:-L$PKG/opt/mingw32/lib -Lmingwex:" Makefile
make -j $JOBS
make install prefix=$PKG/opt/mingw32

# Simulate a standard tree under /opt/mingw32
# (where GCC will search for headers and libraries)
ln -s . $PKG/opt/mingw32/usr
ln -s . $PKG/opt/mingw32/local

# Remove man pages and docs
rm -rf $PKG/opt/mingw32/{share,doc}

# Copy slack-desc file
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc

# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
rm -rf $PKG
rm -rf $TMP/mingw32
"
if type -p fakeroot ; then
    echo "$PACKAGING" | fakeroot
else
    su -c "$PACKAGING"
fi

slack-desc :

Code:

            |-----handy-ruler------------------------------------------------------|
mingw32-libs: mingw32-libs (Headers and libraries for MinGW32)
mingw32-libs: 
mingw32-libs: This package installs the headers and libraries needed to
mingw32-libs: cross-compile programs targeting the Win32 platform.
mingw32-libs: 
mingw32-libs: 
mingw32-libs: 
mingw32-libs: 
mingw32-libs: 
mingw32-libs: 
mingw32-libs:

checksums :

Code:

75d59049f26dc62f3732d11abbf056efc7bc8e95  gcc-core-3.4.5-20060117-2-src.tar.gz
c75afe81bffb2cb7b924dcae3b5c76921d32f297  w32api-3.13-mingw32-src.tar.gz
6e7079968a3a7a819a7dd482950eddd6483c0ef6  mingwrt-3.15.2-mingw32-src.tar.gz

3. d/gcc-mingw32
gcc-mingw32.SlackBuild :

Code:

#!/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 gcc-mingw32 sourcecode is available at: <http://www.mingw.org/>.
#
# Depends: l/mingw32-libs

# Source packages infos (checksums and filenames in `checksums' file)
VERSION=${VERSION:-3.4.5}
BASEURL=${BASEURL:-http://ovh.dl.sourceforge.net/mingw}

# Build infos
NAMETGZ=${NAMETGZ:-gcc-mingw32}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-$ARCH-pc-mingw32}
JOBS=${JOBS:-1}

# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMETGZ}
CWD=$(pwd)

set -e

# Sanity checks
if [ $UID -eq 0 ]; then
    echo "You should NOT run this script as ROOT!"
    exit 1
fi
if [ ! -d $TMP ]; then
    echo "$TMP does not exist or is not a directory!"
    exit 1
fi
if [ ! -d /opt/mingw32 ]; then
    echo "MinGW32 base directory not found!"
    exit 1
fi
if ! echo $PATH | grep -q /opt/mingw32/bin ; then
    PATH=$PATH:/opt/mingw32/bin
fi

# Compilation flags
case "$ARCH" in
i?86)
    CPUOPT="-O2 -march=$ARCH -mtune=i686"
    ;;
x86_64)
    CPUOPT="-O2 -fPIC"
    ;;
*)
    CPUOPT="-O2"
    ;;
esac

# Get and verify the source archive
for archive in $(cut -d' ' -f3 checksums); do
    if [ ! -r $archive ]; then
        rm -f $archive.part
        wget -vc "$BASEURL/$archive" -O $archive.part
        mv $archive.part $archive
    fi
done
sha1sum -c checksums

# Extract everything
mkdir -p $TMP/mingw32/stage2
cd $TMP/mingw32
for archive in $(cut -d' ' -f3 $CWD/checksums); do
    tar xf $CWD/$archive
done

# Compile stage 2 GCC
cd stage2
CFLAGS="$CPUOPT -fomit-frame-pointer" \
$TMP/mingw32/gcc-*/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 $JOBS
make install DESTDIR=$PKG

# Strip binaries
find $PKG | xargs file | grep "ELF 32-bit LSB" | cut -d : -f 1 | \
  xargs strip --strip-unneeded 2> /dev/null

# libiberty is already installed by binutils-mingw32
rm $PKG/opt/mingw32/lib/libiberty.a

# Remove man and info pages (we already have those of the
# native GCC in /usr)
rm -rf $PKG/opt/mingw32/{info,man}

# Copy slack-desc file
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc

# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz
rm -rf $PKG
rm -rf $TMP/mingw32
"
if type -p fakeroot ; then
    echo "$PACKAGING" | fakeroot
else
    su -c "$PACKAGING"
fi

slack-desc :

Code:

           |-----handy-ruler------------------------------------------------------|
gcc-mingw32: gcc-mingw32 (Win32 cross-compiler)
gcc-mingw32: 
gcc-mingw32: This package installs a GNU/Linux-based cross-compiler that
gcc-mingw32: targets the Win32 platform.
gcc-mingw32: 
gcc-mingw32: The compiler supports the C and C++ languages.
gcc-mingw32: 
gcc-mingw32: 
gcc-mingw32: 
gcc-mingw32: 
gcc-mingw32:

checksums :

Code:

75d59049f26dc62f3732d11abbf056efc7bc8e95  gcc-core-3.4.5-20060117-2-src.tar.gz
edafa412d86085cf39f0db1c19a6ea2890d05946  gcc-g++-3.4.5-20060117-2-src.tar.gz

« Je vous aiderai si vous me promettez d'aider quelqu'un en retour. » --- anonyme
« Soyez vigilant lorsque vous vous exprimez dans un forum électronique. Vos fautes de frappe et de syntaxe vous poursuivront pour l'éternité. » --- Linus B. Torvalds

Hors ligne

 

#4 23-05-2011 23:03:41

so_slack
Membre actif
Date d'inscription: 09-07-2010
Messages: 77

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

bonjour,
merci pour ces slackbuild je tente ming pour compiler ffmpeg pour windows
j'ai une erreur sur le deuxieme
./mingw32-libs.SlackBuild

Code:

/tmp/ccHITxMv.s: Assembler messages:
/tmp/ccHITxMv.s:5: Error: unknown pseudo-op: `.def'
/tmp/ccHITxMv.s:5: Error: unknown pseudo-op: `.scl'
/tmp/ccHITxMv.s:5: Error: unrecognized symbol type "32"
/tmp/ccHITxMv.s:5: Error: unknown pseudo-op: `.endef'
/tmp/ccHITxMv.s:11: Error: unknown pseudo-op: `.def'
/tmp/ccHITxMv.s:11: Error: unknown pseudo-op: `.scl'
/tmp/ccHITxMv.s:11: Error: unrecognized symbol type "32"
/tmp/ccHITxMv.s:11: Error: unknown pseudo-op: `.endef'
make[1]: *** [crtbegin.o] Erreur 1
make[1]: quittant le répertoire « /tmp/mingw32/stage1-build/gcc »
make: *** [all-gcc] Erreur 2

Hors ligne

 

#5 27-05-2011 18:35:04

gouttegd
Membre très actif
Lieu: Grenoble
Date d'inscription: 11-04-2007
Messages: 210

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

Bonjour,

Essaye avec la version 3.16 de mingwrt, chez moi tout compile et fonctionne sous Slackware-13.1 et 13.37 avec cette version. Le SlackBuild reste identifique, il y a juste la version de mingwrt à changer et le checksum à mettre à jour.


« Je vous aiderai si vous me promettez d'aider quelqu'un en retour. » --- anonyme
« Soyez vigilant lorsque vous vous exprimez dans un forum électronique. Vos fautes de frappe et de syntaxe vous poursuivront pour l'éternité. » --- Linus B. Torvalds

Hors ligne

 

#6 30-11-2012 07:16:29

jack9091
Nouveau membre
Date d'inscription: 30-11-2012
Messages: 1

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

Pour ce genre de trucs à executer en root, rien ne vaut une machine virtuelle qu'on reset vers le dernier snapshot après compile.


Jack

Hors ligne

 

#7 26-12-2012 03:44:50

yunro
Nouveau membre
Date d'inscription: 26-12-2012
Messages: 1

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

should take away a number of the tension through reassuring oneself you acquired your own wedding gown on the very best cost by means of accomplishing a web-based price tag contrast.Last but not least take pleasure in the process it's the most fun time of your lifestyle therefore do not let anxiety are able to people. 1, replica watches, replica rolex watches, replica tag heuer watches, replica cartier watches, navy bridesmaid dresses  This is probably one of the most enjoyable aspect the bride would want to accomplish of all wedding ceremony preparations.Picking just what wedding garment to put on! Should you be considering to receive wed one shoulder cocktail dress  short black dresses  long prom dresses ,    simple wedding dresses  beach wedding dresses  there are lots of tips that you have to take into account in choosing a marriage gown.You'll be able to get traditional because of the veils plus laces or even elect to use the woman modern day bridal dress in which enhances

Hors ligne

 

#8 26-12-2012 09:22:29

paniouf
Membre très actif
Date d'inscription: 13-09-2009
Messages: 225

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

????????????????????


Carte mère : M2A-VM HDMI
CPU : AMD Athlon(tm) 64 X2 Dual Core Processor 5000+
Display : RS690 [Radeon X1200 Series]

Hors ligne

 

#9 23-11-2013 08:16:59

BlueLotus
Nouveau membre
Date d'inscription: 23-11-2013
Messages: 1

Re: [SlackBuild] d/mingw32, compilateur croisé GNU/Linux -> Windows

I am new to Slackware community and just started learning thing about it. Since it is a free and open source Linux distribution, I started using it. As known it is the earliest operating systems to be built on top of the Linux kernel and is the oldest one too.



Thanks - microsoft outlook problem solving

Hors ligne