Skip to content

Instantly share code, notes, and snippets.

@Ry0taK
Created May 27, 2025 13:02
Show Gist options
  • Save Ry0taK/0f0445ca7b113f2e28299cb31517ccbd to your computer and use it in GitHub Desktop.
Save Ry0taK/0f0445ca7b113f2e28299cb31517ccbd to your computer and use it in GitHub Desktop.
mkdir cygwin-test
cd cygwin-test
mkdir cygwin
cd cygwin
wget http://ftp.iij.ad.jp/pub/cygwin/x86_64/release/cygwin/cygwin-3.5.7-1.tar.xz
wget http://ftp.iij.ad.jp/pub/cygwin/x86_64/release/cygwin/cygwin-devel/cygwin-devel-3.5.7-1.tar.xz
wget http://ftp.iij.ad.jp/pub/cygwin/x86_64/release/w32api-headers/w32api-headers-12.0.0-1.tar.xz
wget http://ftp.iij.ad.jp/pub/cygwin/x86_64/release/w32api-runtime/w32api-runtime-12.0.0-1.tar.xz
mkdir sys-root
cd sys-root
tar fx ../cygwin-3.5.7-1.tar.xz
tar fx ../cygwin-devel-3.5.7-1.tar.xz
tar fx ../w32api-runtime-12.0.0-1.tar.xz
tar fx ../w32api-headers-12.0.0-1.tar.xz
cd usr/lib
ln -s w32api/libadvapi32.a .
ln -s w32api/libkernel32.a .
ln -s w32api/libuser32.a .
ln -s w32api/libshell32.a .
cd ../../../../
# Build binutils
wget http://ftp.iij.ad.jp/pub/gnu/binutils/binutils-2.40.tar.xz
tar fx binutils-2.40.tar.xz
cd binutils-2.40
mkdir build
cd build
../configure --prefix=$PWD/../../cygwin/ --target=x86_64-pc-cygwin --with-gmp=/usr/local --with-mpc=/usr/local --with-mpfr=/usr/local --with-system-zlib
make -j 32
make install
cd ../../
# Build gcc
wget http://ftp.iij.ad.jp/pub/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.xz
tar fx gcc-12.2.0.tar.xz
cd gcc-12.2.0
./contrib/download_prerequisites
mkdir build
cd build
../configure --prefix=$PWD/../../cygwin --target=x86_64-pc-cygwin --disable-multilib --with-sysroot=$PWD/../../cygwin/sys-root --enable-threads=posix --enable-languages=c,c++
make -j 32
make install
cd ../../
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment