Hello,

I am planning to bring mingw-w64 to cygwin. Here are some nits I found when working with it.

* It sets CC=gcc
While not a major issue, it does present some issues when cross compiling the mingw-w64 CRT.

* Implicitly setting --prefix=/usr
While I understand this is suitable for native builds, perhaps adding some cross compile logic to disable this?

* Libtool logic too smart
This is partly a GCC issue too, since it insists installing dlls to PREFIX/bin. However, manually moving around the dlls and fixing up the .la paths after install causes cygport to fail with "[ ../../..: Unary operator expected.", "../../.. not installed" of sorts error around src_postinst.cygpart:590.

Packaging GCC presents some challenge, there is a packaging hack in the src_install part. I will try to fix that in GCC.
DESCRIPTION="Bintils for Win64 target"
HOMEPAGE="mingw-w64.sourceforge.net"
SRC_URI="http://sourceforge.net/projects/mingw-w64/files/Cygwin%20Snapshots/binutils-${PV}.tar.bz2";
PKG_NAMES="${PN}"
PKG_HINTS="setup"
SRC_DIR="binutils-${PV}"
PKG_CONTENTS[0]='--exclude=usr/lib/* usr/'
# MAKEOPTS+=" -j4"
CYGCONF_ARGS="--with-sysroot=/usr/x86_64-w64-mingw32 --build=i686-pc-cygwin 
--host=i686-pc-cygwin --target=x86_64-w64-mingw32 --disable-multilib"

src_compile() {
cd ${B}
cygconf
cygmake
}
DESCRIPTION="mingw-w64 crt for Win64 target"
HOMEPAGE="mingw-w64.sourceforge.net"
SRC_URI="http://sourceforge.net/projects/mingw-w64/files/Cygwin%20Snapshots/mingw-w64-crt-${PV}.tar.xz";
PKG_NAMES="${PN}"
PKG_HINTS="setup"
SRC_DIR="mingw-w64-crt"
PKG_CONTENTS[0]='--exclude=usr/lib/* usr/'
#MAKEOPTS+=" -j4"

#Overide default prefix to correct sysroot
#Assuming USE_DESTDIR=1 is in effect
USE_DESTDIR=1
CYGCONF_ARGS="--build=i686-pc-cygwin --host=x86_64-w64-mingw32 
--prefix=/usr/x86_64-w64-mingw32 --enable-lib64 --disable-lib32 
CC=x86_64-w64-mingw32-gcc"

src_install() {
cd ${B}
cyginstall
ln -sv ${D}/usr/x86_64-w64-mingw32/x86_64-w64-mingw32/lib 
${D}/usr/x86_64-w64-mingw32/x86_64-w64-mingw32/lib64
}
DESCRIPTION="mingw-w64 headers for Win64 target"
HOMEPAGE="mingw-w64.sourceforge.net"
SRC_URI="http://sourceforge.net/projects/mingw-w64/files/Cygwin%20Snapshots/gcc-4.6-20100619.tar.bz2";
PKG_NAMES="${PN} ${PN}-rt ${PN}-g++"
PKG_HINTS="setup runtime g++"
SRC_DIR="gcc-4.6-20100619"
PKG_CONTENTS[0]='--exclude=usr/lib/libiberty.a 
--exclude=usr/lib/gcc/x86_64-w64-mingw32/4.6.0/*.dll 
--exclude=usr/bin/x86_64-w64-mingw32-?++.exe 
--exclude=usr/lib/gcc/x86_64-w64-mingw32/4.6.0/cc1plus.exe 
--exclude=usr/lib/gcc/x86_64-w64-mingw32/4.6.0/include/c++/* 
--exclude=usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++.* 
--exclude=usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libsupc++.* 
--exclude=usr/share/man/man1/x86_64-w64-mingw32-g++.1.gz 
--exclude=usr/share/gcc-4.6.0/python/libstdcxx/* usr/'
PKG_CONTENTS[1]='usr/lib/gcc/x86_64-w64-mingw32/4.6.0/*.dll'
PKG_CONTENTS[2]='usr/bin/x86_64-w64-mingw32-c++.exe 
usr/bin/x86_64-w64-mingw32-g++.exe 
usr/lib/gcc/x86_64-w64-mingw32/4.6.0/include/c++ 
usr/lib/gcc/x86_64-w64-mingw32/4.6.0/cc1plus.exe 
usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++.* 
usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libsupc++.* 
usr/share/gcc-4.6.0/python/libstdcxx/ 
usr/share/man/man1/x86_64-w64-mingw32-g++.1.gz'
MAKEOPTS+=" -j4"

#libgomp not working because pthreads-win32 still in the works.
#multilib disabled because dlls clash on install
#libelf not needed for lto-coff
CYGCONF_ARGS="--build=i686-pc-cygwin --host=i686-pc-cygwin 
--target=x86_64-w64-mingw32 --with-build-sysroot=/usr/x86_64-w64-mingw32 
--with-sysroot=/usr/x86_64-w64-mingw32 --disable-libgomp --disable-multilib 
--enable-version-specific-runtime-libs --enable-lto --with-dwarf2 
--enable-languages=c,c++ --enable-fully-dynamic-strings 
--enable-sjlj-exceptions"

src_compile() {
cd ${B}
cygconf
cygmake
}

src_install() {
cd ${B}
cyginstall
# Workaround GCC install bug
cp -pf ${D}/usr/lib/gcc/x86_64-w64-mingw32/lib/libgcc_s.a 
${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/

# Workaround problematic DLL clashes
mv -f ${D}/usr/bin/libgcc_s_sjlj-1.dll ${D}/usr/bin/libssp-0.dll 
${D}/usr/bin/libstdc++-6.dll ${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/
sed 
s...@dlname.*@dllname=\'/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libssp-0.dll\'@ < 
${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libssp.la > 
${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libssp.la.tmp
sed 
s...@dlname.*@dllname=\'/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++-6.dll\'@
 < ${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++.la > 
${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++.la.tmp
mv ${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libssp.la.tmp 
${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libssp.la
mv ${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++.la.tmp 
${D}/usr/lib/gcc/x86_64-w64-mingw32/4.6.0/libstdc++.la
}
DESCRIPTION="mingw-w64 headers for Win64 target"
HOMEPAGE="mingw-w64.sourceforge.net"
SRC_URI="http://sourceforge.net/projects/mingw-w64/files/Cygwin%20Snapshots/mingw-w64-headers-${PV}.tar.xz";
PKG_NAMES="${PN}"
PKG_HINTS="setup"
SRC_DIR="mingw-w64-headers"
PKG_CONTENTS[0]='--exclude=usr/lib/* usr/'
#MAKEOPTS+=" -j4"

#Overide default prefix to correct sysroot
#Assuming USE_DESTDIR=1 is in effect
USE_DESTDIR=1
CYGCONF_ARGS="--build=i686-pc-cygwin --host=x86_64-w64-mingw32 --enable-sdk=all 
--prefix=/usr/x86_64-w64-mingw32"

src_install() {
cd ${B}
cyginstall
ln -sv ${D}/usr/x86_64-w64-mingw32/x86_64-w64-mingw32 
${D}/usr/x86_64-w64-mingw32/mingw
}
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to