-
-
Save elventear/b44a57e6c7b6ae75d525 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 初期設定 | |
WORK=$HOME/Builds/GCC | |
PREFIX=$HOME/mingw | |
export PATH="$HOME/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" | |
# ソースコードのダウンロード | |
if [ ! -d $WORK/src ] ; then | |
mkdir src | |
fi | |
cd $WORK/src | |
curl -O ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.6.3/gcc-4.6.3.tar.bz2 | |
curl -O ftp://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2 | |
wget -O mingw-w64-v2.0.1.tar.gz "http://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v2.0.1.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmingw-w64%2Ffiles%2Fmingw-w64%2Fmingw-w64-release%2F&ts=1322327118&use_mirror=jaist" | |
# パッチのダウンロード | |
if [ ! -d $WORK/patch ] ; then | |
mkdir patch | |
fi | |
cd $WORK/patch | |
## Pthreadsのコンパイル&インストール お気に入りの動画を携帯で見よう | |
## http://blog.k-tai-douga.com/article/39079027.html | |
curl -O http://abechin.sakura.ne.jp/sblo_files/k-tai-douga/ffmpeg/pthreads-20110706.diff | |
# pthreads リポジトリを更新 | |
cd $WORK/src/pthreads | |
if [ -d pthreads ] ; then | |
rm -fr pthreads | |
fi | |
cvs update -dP | |
## リリース用のディレクトリを作る | |
cvs export -D tomorrow pthreads | |
mv pthreads $WORK | |
## パッチを当てる | |
cd $WORK/pthreads | |
patch -p1 < $WORK/patch/pthreads-20110706.diff | |
# ソースの展開 | |
## gcc | |
cd $WORK | |
tar xjf src/gcc-* | |
cd gcc-* | |
mkdir build | |
## binutils | |
cd $WORK | |
tar xjf src/binutils-* | |
cd binutils-* | |
mkdir build | |
## mingw-w64 | |
cd $WORK | |
tar xzf src/mingw-w64-* | |
cd mingw-w64-* | |
mkdir build-headers | |
mkdir build-crt | |
for tg in i686-w64-mingw32 x86_64-w64-mingw32 | |
do | |
export PATH=$PATH:$PREFIX/bin | |
# pthreds | |
cd $WORK/pthreads | |
make CROSS=${tg}- clean GC-static | |
cp -f libpthreadGC2.a $PREFIX/$tg/lib/libpthread.a | |
cp -f pthread.h sched.h semaphore.h $PREFIX/$tg/include/ | |
# binutils | |
cd $WORK/binutils-*/build | |
../configure\ | |
--target=$tg\ | |
--disable-multilib\ | |
--with-sysroot=$PREFIX\ | |
--prefix=$PREFIX\ | |
--with-windres\ | |
--disable-shared | |
make -j4 && make install | |
rm -fr * | |
# mingw-w64-headers | |
cd $WORK/mingw-w64-*/build-headers | |
../mingw-w64-headers/configure\ | |
--host=$tg\ | |
--prefix=$PREFIX | |
make -j4 && make install | |
rm -fr * | |
cd $PREFIX | |
ln -s $tg mingw | |
# GCC 1回目 | |
## Installing GCC: Configuration | |
## http://gcc.gnu.org/install/configure.html | |
cd $WORK/gcc-*/build | |
../configure\ | |
--with-pkgversion="henry - GCC 4.6.3 $tg"\ | |
--prefix=$PREFIX\ | |
--target=$tg\ | |
--with-sysroot=$PREFIX\ | |
--disable-debug\ | |
--disable-multilib\ | |
--enable-threads\ | |
--enable-libgomp\ | |
--enable-languages=c,c++,objc,obj-c++\ | |
--enable-stage1-checking\ | |
--disable-nls\ | |
--enable-lto\ | |
--with-system-zlib\ | |
--with-gmp=$HOME/local\ | |
--with-mpfr=$HOME/local\ | |
--with-mpc=$HOME/local\ | |
--enable-fully-dynamic-string\ | |
--disable-shared | |
make all-gcc -j4 && make install-gcc | |
# mingw-w64-crt | |
cd $WORK/mingw-w64-*/build-crt | |
../mingw-w64-crt/configure\ | |
--host=$tg\ | |
--prefix=$PREFIX\ | |
--with-sysroot=$PREFIX | |
make -j4 && make install | |
rm -fr * | |
# GCC 2回目 | |
cd $WORK/gcc-*/build | |
make -j4 && make install | |
rm -fr * | |
rm $PREFIX/mingw | |
done | |
cd $WORK | |
rm -fr binutils-* gcc-* pthreads mingw-w64-v* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur pthreads.orig/GNUmakefile pthreads/GNUmakefile | |
--- pthreads.orig/GNUmakefile Fri Jul 1 09:51:56 2011 | |
+++ pthreads/GNUmakefile Fri Jul 8 00:33:24 2011 | |
@@ -58,7 +58,7 @@ | |
RANLIB = $(CROSS)ranlib | |
RC = $(CROSS)windres | |
-OPT = $(CLEANUP) -O3 # -finline-functions -findirect-inlining | |
+OPT = $(CLEANUP) -O3 -DHAVE_STRUCT_TIMESPEC -D__MINGW32__ # -finline-functions -findirect-inlining | |
XOPT = | |
RCFLAGS = --include-dir=. | |
diff -ur pthreads.orig/need_errno.h pthreads/need_errno.h | |
--- pthreads.orig/need_errno.h Mon May 30 09:31:00 2011 | |
+++ pthreads/need_errno.h Fri Jul 8 00:33:24 2011 | |
@@ -59,7 +59,7 @@ | |
#endif | |
#endif | |
-#if !defined(PTW32_STATIC_LIB) | |
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__) | |
# if defined(PTW32_BUILD) | |
# define PTW32_DLLPORT __declspec (dllexport) | |
# else | |
diff -ur pthreads.orig/pthread.h pthreads/pthread.h | |
--- pthreads.orig/pthread.h Sat Jul 2 00:29:23 2011 | |
+++ pthreads/pthread.h Fri Jul 8 00:33:24 2011 | |
@@ -547,7 +547,7 @@ | |
* do NOT define PTW32_BUILD, and then the variables/functions will | |
* be imported correctly. | |
*/ | |
-#if !defined(PTW32_STATIC_LIB) | |
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__) | |
# if defined(PTW32_BUILD) | |
# define PTW32_DLLPORT __declspec (dllexport) | |
# else | |
diff -ur pthreads.orig/sched.h pthreads/sched.h | |
--- pthreads.orig/sched.h Wed Jun 29 14:10:02 2011 | |
+++ pthreads/sched.h Fri Jul 8 00:33:25 2011 | |
@@ -76,7 +76,7 @@ | |
* do NOT define PTW32_BUILD, and then the variables/functions will | |
* be imported correctly. | |
*/ | |
-#if !defined(PTW32_STATIC_LIB) | |
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__) | |
# if defined(PTW32_BUILD) | |
# define PTW32_DLLPORT __declspec (dllexport) | |
# else | |
diff -ur pthreads.orig/semaphore.h pthreads/semaphore.h | |
--- pthreads.orig/semaphore.h Mon May 30 09:31:01 2011 | |
+++ pthreads/semaphore.h Fri Jul 8 00:33:25 2011 | |
@@ -75,7 +75,7 @@ | |
* do NOT define PTW32_BUILD, and then the variables/functions will | |
* be imported correctly. | |
*/ | |
-#if !defined(PTW32_STATIC_LIB) | |
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__) | |
# if defined(PTW32_BUILD) | |
# define PTW32_DLLPORT __declspec (dllexport) | |
# else | |
diff -ur pthreads.orig/tests/GNUmakefile pthreads/tests/GNUmakefile | |
--- pthreads.orig/tests/GNUmakefile Sun Jul 3 12:54:34 2011 | |
+++ pthreads/tests/GNUmakefile Fri Jul 8 00:33:25 2011 | |
@@ -391,13 +391,13 @@ | |
@ $(ECHO) Passed | |
@ $(TOUCH) $@ | |
-%.bench: $(LIB) $(DLL) $(HDR) $(QAPC) $(XXLIBS) %.exe | |
+%.bench: $(LIB) $(DLL) $(HDR) $(XXLIBS) %.exe | |
@ $(ECHO) Running $* | |
./$* | |
@ $(ECHO) Done | |
@ $(TOUCH) $@ | |
-%.exe: %.c $(LIB) $(DLL) $(HDR) $(QAPC) | |
+%.exe: %.c $(LIB) $(DLL) $(HDR) | |
@ $(ECHO) Compiling $@ | |
@ $(ECHO) $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS) | |
@ $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment