SHARE
TWEET

Steps for building mingw-w64

a guest Oct 25th, 2019 24 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1- Build mingw-w64-gcc with this package.yml
  2.  
  3.  
  4.  
  5. name       : mingw-w64-gcc
  6. version    : 9.2.0
  7. release    : 1
  8. source     :
  9.     - ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.2.0/gcc-9.2.0.tar.xz : ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
  10.     - https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v6.0.0.tar.bz2 : 805e11101e26d7897fce7d49cbb140d7bac15f3e085a91e0001e80b2adaf48f0
  11. license    : GPL-3.0-or-later
  12. component  : programming
  13. summary    :
  14.     - GCC for MinGW-w64 targeting 64 bits
  15.     - 32bit: GCC for MinGW-w64 targeting 32 bits
  16. description: |
  17.     The GNU Compiler Collection includes front ends for C and C++, as well as libraries for these languages (libstdc++, libgcc,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom.
  18. strip      : no
  19. patterns   :
  20.     - 32bit:
  21.         - /usr/share/mingw-w64/bin/i686-w64-mingw32-*
  22.         - /usr/share/mingw-w64/i686-w64-mingw32/*
  23.         - /usr/share/mingw-w64/lib/gcc/i686-w64-mingw32/*
  24.         - /usr/share/mingw-w64/libexec/gcc/i686-w64-mingw32/*
  25. builddeps  :
  26.     - mingw-w64-binutils
  27.     - mingw-w64-binutils-32bit
  28. rundeps  :
  29.     - mingw-w64-binutils
  30.     - 32bit:
  31.         - mingw-w64-binutils-32bit
  32. environment: |
  33.     export TARGET32=i686-w64-mingw32
  34.     export TARGET64=x86_64-w64-mingw32
  35.     export PREFIX=/usr/share/mingw-w64
  36. setup      : |
  37.     # Build steps: binutils -> gcc core -> mingw-w64 -> mingw-w64 with headers and winpthreads -> gcc
  38.  
  39.     tar xjf $sources/mingw-w64-v6.0.0.tar.bz2
  40.  
  41.     # Install the MinGW-w64 headers only
  42.     _headers_conf() {
  43.         ../mingw-w64-v6.0.0/mingw-w64-headers/configure \
  44.             --host=$1 \
  45.             --prefix=$PREFIX/$1 \
  46.             --disable-werror \
  47.             --enable-secure-api \
  48.             --enable-sdk=all
  49.     }
  50.  
  51.     mkdir headdir32 && pushd headdir32
  52.     _headers_conf $TARGET32
  53.     popd
  54.     mkdir headdir64 && pushd headdir64
  55.     _headers_conf $TARGET64
  56.     popd
  57.  
  58.     %make_install -C headdir32
  59.     %make_install -C headdir64
  60.  
  61.     _bootstrap_cfg() {
  62.         ../configure \
  63.             --target=$1 \
  64.             --prefix=$installdir$PREFIX \
  65.             --enable-lto \
  66.             --enable-static \
  67.             --with-system-zlib \
  68.             --disable-nls \
  69.             --disable-dw2-exceptions \
  70.             --disable-multilib \
  71.             --enable-version-specific-runtime-libs \
  72.             --enable-languages=c,lto \
  73.             --enable-checking=release
  74.     }
  75.  
  76.     mkdir gccdir32 && pushd gccdir32
  77.     _bootstrap_cfg $TARGET32
  78.     popd
  79.     mkdir gccdir64 && pushd gccdir64
  80.     _bootstrap_cfg $TARGET64
  81.     popd
  82. build      : |
  83.     %make all-gcc -C gccdir32
  84.     %make all-gcc -C gccdir64
  85. install    : |
  86.     %make install-strip-gcc -C gccdir32
  87.     %make install-strip-gcc -C gccdir64
  88.  
  89.     rm -r $installdir$PREFIX/include
  90.     rm -r $installdir$PREFIX/share
  91.  
  92.  
  93.  
  94. 2- Build mingw-w64 with this package.yml
  95.  
  96.  
  97.  
  98. name       : mingw-w64
  99. version    : 6.0.0
  100. release    : 1
  101. source     :
  102.     - https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v6.0.0.tar.bz2 : 805e11101e26d7897fce7d49cbb140d7bac15f3e085a91e0001e80b2adaf48f0
  103. license    : GPL-3.0-or-later
  104. component  : programming.devel
  105. summary    :
  106.     - The MinGW-w64 project binaries, runtimes and libraries for 64 bits
  107.     - 32bit: The MinGW-w64 project binaries, runtimes and libraries for 32 bits
  108. description: |
  109.     The mingw-w64 project is a complete runtime environment for gcc to support binaries native to Windows 64-bit and 32-bit operating systems.
  110. strip      : no
  111. patterns   :
  112.     - 32bit:
  113.         - /usr/share/mingw-w64/i686-w64-mingw32/*
  114. builddeps  :
  115.     - mingw-w64-binutils
  116.     - mingw-w64-gcc
  117.     - mingw-w64-binutils-32bit
  118.     - mingw-w64-gcc-32bit
  119. rundeps    :
  120.     - mingw-w64-binutils
  121.     - mingw-w64-gcc
  122.     - 32bit:
  123.         - mingw-w64-binutils-32bit
  124.         - mingw-w64-gcc-32bit
  125. environment: |
  126.     export TARGET32=i686-w64-mingw32
  127.     export TARGET64=x86_64-w64-mingw32
  128.     export PREFIX=/usr/share/mingw-w64
  129.     export PATH=$PATH:$PREFIX/bin
  130.     unset CC CXX CFLAGS CXXFLAGS LDFLAGS
  131. setup      : |
  132.     # Some empty headers are required for the building process
  133.     export CPPFLAGS=-I$pkgfiles/include
  134.  
  135.     _crt_conf() {
  136.         if [ $1 == $TARGET32 ]; then
  137.             export _crt_cfg_args="--disable-lib64 --enable-lib32"
  138.         elif [ $1 == $TARGET64 ]; then
  139.             export _crt_cfg_args="--disable-lib32 --enable-lib64"
  140.         fi
  141.  
  142.         ../mingw-w64-crt/configure \
  143.             --host=$1 \
  144.             --enable-experimental \
  145.             --enable-wildcard \
  146.             --prefix=$PREFIX/$1 \
  147.             $_crt_cfg_args
  148.     }
  149.  
  150.     mkdir crtdir32 && pushd crtdir32
  151.     _crt_conf $TARGET32
  152.     popd
  153.     mkdir crtdir64 && pushd crtdir64
  154.     _crt_conf $TARGET64
  155. build      : |
  156.     %make -C crtdir32
  157.     %make -C crtdir64
  158. install    : |
  159.     %make install-strip -C crtdir32 DESTDIR=$installdir
  160.     %make install-strip -C crtdir64 DESTDIR=$installdir
  161.  
  162.  
  163.  
  164. 3- Rebuild mingw-w64 with this package.yml that includes the headers and winpthreads
  165.  
  166.  
  167.  
  168. name       : mingw-w64
  169. version    : 6.0.0
  170. release    : 2
  171. source     :
  172.     - https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v6.0.0.tar.bz2 : 805e11101e26d7897fce7d49cbb140d7bac15f3e085a91e0001e80b2adaf48f0
  173. license    :
  174.     - Public-Domain
  175.     - GPL-3.0-or-later
  176.     - ZPL-2.1
  177. component  : programming.devel
  178. summary    :
  179.     - The MinGW-w64 project binaries, runtimes and libraries for 64 bits
  180.     - 32bit: The MinGW-w64 project binaries, runtimes and libraries for 32 bits
  181. description: |
  182.     The mingw-w64 project is a complete runtime environment for gcc to support binaries native to Windows 64-bit and 32-bit operating systems.
  183. strip      : no
  184. autodep    : no
  185. patterns   :
  186.     - 32bit:
  187.         - /usr/share/mingw-w64/i686-w64-mingw32/*
  188. builddeps  :
  189.     - mingw-w64
  190.     - mingw-w64-binutils
  191.     - mingw-w64-gcc
  192.     - mingw-w64-32bit
  193.     - mingw-w64-binutils-32bit
  194.     - mingw-w64-gcc-32bit
  195. environment: |
  196.     export PREFIX=/usr/share/mingw-w64
  197.     export PATH=$PATH:$PREFIX/bin
  198.     export TARGET32=i686-w64-mingw32
  199.     export TARGET64=x86_64-w64-mingw32
  200.     unset CC CXX CFLAGS CXXFLAGS LDFLAGS
  201. setup      : |
  202.     _headers_conf() {
  203.         ../mingw-w64-headers/configure \
  204.             --host=$1 \
  205.             --prefix=$PREFIX/$1 \
  206.             --enable-secure-api \
  207.             --enable-sdk=all
  208.     }
  209.  
  210.     _crt_conf() {
  211.         if [ $1 == $TARGET32 ]; then
  212.             export _crt_cfg_args="--disable-lib64 --enable-lib32"
  213.         elif [ $1 == $TARGET64 ]; then
  214.             export _crt_cfg_args="--disable-lib32 --enable-lib64"
  215.         fi
  216.  
  217.         # Some empty headers are required for the building process
  218.         export CPPFLAGS=-I$pkgfiles/include
  219.         ../mingw-w64-crt/configure \
  220.             --host=$1 \
  221.             --enable-experimental \
  222.             --enable-wildcard \
  223.             --prefix=$PREFIX/$1 \
  224.             --includedir=$PREFIX/$1/include \
  225.             $_crt_cfg_args
  226.         unset CPPFLAGS
  227.     }
  228.  
  229.     _winpthreads_conf() {
  230.         ../mingw-w64-libraries/winpthreads/configure \
  231.             --host=$1 \
  232.             --prefix=$PREFIX/$1 \
  233.             --enable-shared \
  234.             --enable-static
  235.     }
  236.  
  237.     mkdir headdir32 && pushd headdir32
  238.     _headers_conf $TARGET32
  239.     popd
  240.     mkdir headdir64 && pushd headdir64
  241.     _headers_conf $TARGET64
  242.     popd
  243.  
  244.     mkdir crtdir32 && pushd crtdir32
  245.     _crt_conf $TARGET32
  246.     popd
  247.     mkdir crtdir64 && pushd crtdir64
  248.     _crt_conf $TARGET64
  249.     popd
  250.  
  251.     mkdir pthrdir32 && pushd pthrdir32
  252.     _winpthreads_conf $TARGET32
  253.     popd
  254.     mkdir pthrdir64 && pushd pthrdir64
  255.     _winpthreads_conf $TARGET64
  256.     popd
  257. build      : |
  258.     %make -C crtdir32
  259.     %make -C crtdir64
  260.     %make -C pthrdir32
  261.     %make -C pthrdir64
  262. install    : |
  263.     %make_install -C headdir32
  264.     %make_install -C headdir64
  265.     %make install-strip -C crtdir32 DESTDIR=$installdir
  266.     %make install-strip -C crtdir64 DESTDIR=$installdir
  267.     %make install-strip -C pthrdir32 DESTDIR=$installdir
  268.     %make install-strip -C pthrdir64 DESTDIR=$installdir
  269.  
  270.  
  271.  
  272. 4- Rebuild mingw-w64-gcc with winpthreads and C++ support
  273.  
  274.  
  275.  
  276. name       : mingw-w64-gcc
  277. version    : 9.2.0
  278. release    : 2
  279. source     :
  280.     - ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.2.0/gcc-9.2.0.tar.xz : ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206
  281.     - http://isl.gforge.inria.fr/isl-0.21.tar.bz2 : d18ca11f8ad1a39ab6d03d3dcb3365ab416720fcb65b42d69f34f51bf0a0e859
  282. license    : GPL-3.0-or-later
  283. component  : programming
  284. summary    :
  285.     - GCC for MinGW-w64 targeting 64 bits
  286.     - 32bit: GCC for MinGW-w64 targeting 32 bits
  287. description: |
  288.     The GNU Compiler Collection includes front ends for C and C++, as well as libraries for these languages (libstdc++, libgcc,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom.
  289. strip      : no
  290. autodep    : no
  291. patterns   :
  292.     - 32bit:
  293.         - /usr/share/mingw-w64/bin/i686-w64-mingw32-*
  294.         - /usr/share/mingw-w64/i686-w64-mingw32/*
  295.         - /usr/share/mingw-w64/lib/gcc/i686-w64-mingw32/*
  296.         - /usr/share/info/i686-w64-mingw32-*
  297.         - /usr/share/man/man1/i686-w64-mingw32-*
  298. builddeps  :
  299.     - mingw-w64
  300.     - mingw-w64-binutils
  301.     - mingw-w64-gcc
  302.     - mingw-w64-32bit
  303.     - mingw-w64-binutils-32bit
  304.     - mingw-w64-gcc-32bit
  305. environment: |
  306.     export TARGET32=i686-w64-mingw32
  307.     export TARGET64=x86_64-w64-mingw32
  308.     export PREFIX=/usr/share/mingw-w64
  309.     export PATH=$PATH:$PREFIX/bin
  310. setup      : |
  311.     tar xf $sources/isl-0.21.tar.bz2
  312.     mv isl-0.21 isl
  313.  
  314.     _gcc_cfg() {
  315.         ../configure \
  316.             --target=$1 \
  317.             --prefix=$PREFIX \
  318.             --enable-lto \
  319.             --enable-shared \
  320.             --enable-static \
  321.             --disable-multilib \
  322.             --enable-threads=posix \
  323.             --enable-fully-dynamic-string \
  324.             --enable-libstdcxx-time=yes \
  325.             --enable-libstdcxx-filesystem-ts=yes \
  326.             --with-system-zlib \
  327.             --disable-nls \
  328.             --enable-cloog-backend=isl \
  329.             --disable-dw2-exceptions \
  330.             --enable-libgomp \
  331.             --enable-languages=c,c++,lto \
  332.             --enable-checking=release
  333.     }
  334.  
  335.     mkdir gccdir32 && pushd gccdir32
  336.     _gcc_cfg $TARGET32
  337.     popd
  338.     mkdir gccdir64 && pushd gccdir64
  339.     _gcc_cfg $TARGET64
  340.     popd
  341. build      : |
  342.     %make -C gccdir32
  343.     %make -C gccdir64
  344. install    : |
  345.     mkdir -p $installdir/usr/share/info $installdir/usr/share/man
  346.  
  347.     # Post installation strips and modifications, or the package bloats to 1.5GB
  348.     _post_install() {
  349.         pushd $installdir$PREFIX/bin
  350.         strip $1-*
  351.         ln -s $1-gcc $1-cc
  352.         popd
  353.         mkdir -p $installdir$PREFIX/$1/bin
  354.         pushd $installdir$PREFIX/$1/bin
  355.         mv $installdir$PREFIX/$1/lib/*.dll .
  356.         $1-strip --strip-unneeded *.dll
  357.         popd
  358.         pushd $installdir$PREFIX/$1/lib
  359.         $1-strip -g *.a
  360.         popd
  361.         pushd $installdir$PREFIX/libexec/gcc/$1/9.2.0
  362.         strip -g {cc1,cc1plus,collect2,lto1,lto-wrapper}
  363.         popd
  364.         pushd $installdir$PREFIX/share/info
  365.         for info in cpp cppinternals gcc gccinstall gccint libgomp libquadmath; do
  366.             mv $info.info $installdir/usr/share/info/$1-$info.info
  367.         done
  368.         popd
  369.     }
  370.  
  371.     %make_install -C gccdir32
  372.     _post_install $TARGET32
  373.  
  374.     %make_install -C gccdir64
  375.     _post_install $TARGET64
  376.  
  377.     mv $installdir$PREFIX/share/man/man1 $installdir/usr/share/man
  378.     rm -rf $installdir$PREFIX/lib64 $installdir$PREFIX/share $installdir$PREFIX/include
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top