gcc43.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. ##
  2. ## gcc43.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # FIXME: rse: GCC 4.3 now officially and unconditionally requires gmp/mpfr!
  25. # FIXME: rse: This requires blessing "gmp" and "mpfr" to CORE or include copies into "gcc"
  26. # FIXME: rse: with_cxx=yes fails because of iconv problems
  27. # package version
  28. %define V_full 4.3
  29. %define V_comp 43
  30. %define V_snap 20070720
  31. # package information
  32. Name: gcc43
  33. Summary: GNU Compiler Collection
  34. URL: http://gcc.gnu.org/
  35. Vendor: Free Software Foundation
  36. Packager: OpenPKG Foundation e.V.
  37. Distribution: OpenPKG Community
  38. Class: EVAL
  39. Group: Compiler
  40. License: GPL
  41. Version: %{V_full}s%{V_snap}
  42. Release: 20070721
  43. # package options
  44. %option with_cxx no
  45. %option with_objc no
  46. %option with_java no
  47. %option with_fortran no
  48. %option with_optimize yes
  49. %option with_profile no
  50. %option with_binutils yes
  51. %option with_threads yes
  52. %option with_multilib no
  53. %option with_gcc no
  54. # list of sources
  55. Source0: ftp://gcc.gnu.org/pub/gcc/snapshots/%{V_full}-%{V_snap}/gcc-%{V_full}-%{V_snap}.tar.bz2
  56. Patch0: gcc43.patch
  57. # build information
  58. Prefix: %{l_prefix}
  59. BuildRoot: %{l_buildroot}
  60. BuildPreReq: OpenPKG, openpkg >= 20060622, make, flex, bison, texinfo
  61. PreReq: OpenPKG, openpkg >= 20060622
  62. %if "%{with_binutils}" == "yes"
  63. BuildPreReq: binutils >= 2.14
  64. PreReq: binutils >= 2.14
  65. %endif
  66. # %if "%{with_fortran}" == "yes"
  67. BuildPreReq: mpfr, gmp
  68. PreReq: mpfr, gmp
  69. # %endif
  70. %if "%{with_java}" == "yes"
  71. BuildPreReq: zlib
  72. PreReq: zlib
  73. %endif
  74. AutoReq: no
  75. AutoReqProv: no
  76. %if "%{with_gcc}" == "yes"
  77. Provides: gcc = %{version}-%{release}
  78. %endif
  79. %description
  80. The GNU Compiler Collection (GCC) provides a standard conforming and
  81. highly portable ISO C and ISO C++ compiler.
  82. %track
  83. prog gcc43 = {
  84. version = %{V_full}-%{V_snap}
  85. url = ftp://gcc.gnu.org/pub/gcc/snapshots/
  86. regex = (%{V_full}-\d{8})
  87. url = ftp://gcc.gnu.org/pub/gcc/snapshots/__NEWVER__/
  88. regex = gcc-(\d+\.\d+-\d{8})\.tar\.bz2
  89. }
  90. %prep
  91. %setup -q -n gcc-%{V_full}-%{V_snap}
  92. %patch -p0
  93. %{l_shtool} subst -v -s \
  94. -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \
  95. gcc/configure
  96. %{l_shtool} subst -v -s \
  97. -e 's;\(VERSUFFIX "\)\("\);\1 (%{l_openpkg_release -F "OpenPKG-%%t"})\2;' \
  98. -e 's;\(bug_report_url\[\] = "\)[^"]*;\1<URL:http://www.openpkg.org/>;' \
  99. gcc/version.c
  100. if [ ".%{V_comp}" != . ]; then
  101. %{l_shtool} subst -v -s \
  102. -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
  103. `find . -name Makefile.in -type f -print`
  104. fi
  105. case "%{l_platform -t}" in
  106. amd64*-linux* )
  107. %{l_shtool} subst \
  108. -e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \
  109. -e 's/test x.gcc_no_link = xyes/false/g' \
  110. libstdc++-v3/configure
  111. ;;
  112. esac
  113. %build
  114. # create build sub-directory
  115. mkdir obj
  116. cd obj
  117. # determine ld(1) and as(1) usage
  118. l_with_gnu_ld_as=""
  119. %if "%{with_binutils}" == "yes"
  120. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
  121. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
  122. %else
  123. case "%{l_platform -t}" in
  124. *-linux* | *-freebsd* )
  125. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
  126. ;;
  127. esac
  128. %endif
  129. # determine threads usage
  130. %if "%{with_threads}" == "yes"
  131. l_enable_threads="posix"
  132. %else
  133. l_enable_threads="single"
  134. %endif
  135. # override threads setting for platforms with known limitations
  136. case "%{l_platform -t}" in
  137. *-netbsd1.6* ) l_enable_threads="single" ;;
  138. esac
  139. # determine language usage
  140. l_enable_languages="c"
  141. %if "%{with_cxx}" == "yes"
  142. l_enable_languages="${l_enable_languages},c++"
  143. %endif
  144. %if "%{with_objc}" == "yes"
  145. l_enable_languages="${l_enable_languages},objc"
  146. %endif
  147. %if "%{with_java}" == "yes"
  148. l_enable_languages="${l_enable_languages},java"
  149. %endif
  150. %if "%{with_fortran}" == "yes"
  151. l_enable_languages="${l_enable_languages},f95"
  152. %endif
  153. # disable GNU iconv usage
  154. ( echo "am_cv_func_iconv=no"
  155. echo "am_cv_lib_iconv=no"
  156. ) >config.cache
  157. # configure the package
  158. CC="%{l_cc}" \
  159. CFLAGS="%{l_cflags}" \
  160. %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes"
  161. CPPFLAGS="%{l_cppflags}" \
  162. LDFLAGS="%{l_ldflags}" \
  163. %endif
  164. CONFIG_SHELL="%{l_bash}" \
  165. ../configure \
  166. --cache-file=./config.cache \
  167. --srcdir=`pwd`/.. \
  168. --prefix=%{l_prefix} \
  169. --exec-prefix=%{l_prefix} \
  170. --includedir=%{l_prefix}/include/gcc%{V_comp} \
  171. --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
  172. --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
  173. --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
  174. --enable-languages="${l_enable_languages}" \
  175. --enable-threads="${l_enable_threads}" \
  176. --disable-maintainer-mode \
  177. --disable-shared \
  178. --disable-nls \
  179. %if "%{with_java}" == "yes"
  180. --with-system-zlib \
  181. %endif
  182. %if "%{with_multilib}" == "yes"
  183. --enable-multilib \
  184. %else
  185. --disable-multilib \
  186. %endif
  187. --with-gmp=%{l_prefix} \
  188. --with-mpfr=%{l_prefix} \
  189. ${l_with_gnu_ld_as}
  190. # determine build flags
  191. l_ccisgcc=no
  192. if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
  193. l_ccisgcc=yes
  194. fi
  195. l_cflags=""
  196. l_boot_cflags=""
  197. l_libcflags="-g"
  198. l_libcxxflags="-g"
  199. case "%{l_platform -t}" in
  200. alpha*-tru64* ) if [ ".$l_ccisgcc" = .no ]; then l_libcflags="$l_libcflags -ieee"; fi ;;
  201. esac
  202. %if "%{with_binutils}" == "yes"
  203. # at least GNU as from GNU binutils supports -pipe always
  204. l_boot_cflags="$l_boot_cflags -pipe"
  205. l_libcxxflags="$l_libcxxflags -pipe"
  206. %endif
  207. %if "%{with_optimize}" == "yes"
  208. # conservatively optimize the generated program code
  209. # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
  210. l_cflags="$l_cflags -O"
  211. l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer"
  212. case "%{l_platform -t}" in
  213. *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;;
  214. *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
  215. esac
  216. l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
  217. %else
  218. # else do no optimizations at all to reduce problems to minimum in advance
  219. l_boot_cflags="$l_boot_cflags -O0"
  220. l_libcxxflags="$l_libcxxflags -O0"
  221. %endif
  222. maketarget="bootstrap-lean"
  223. %if "%{with_profile}" == "yes"
  224. # GCC >= 3.4 supports a "profiledbootstrap" target to build an
  225. # optimized version of itself through profiling. Because this
  226. # requires a (bootstrapping) C compiler with 64-bit arithmetic,
  227. # the whole approach is currently supported only if already
  228. # building with GCC as the bootstrapping C compiler.
  229. if [ ".$l_ccisgcc" = .yes ]; then
  230. maketarget="profiledbootstrap"
  231. fi
  232. %endif
  233. # build the package
  234. %{l_make} %{l_mflags} \
  235. MAKE="%{l_make} %{l_mflags}" \
  236. BOOT_CFLAGS="${l_boot_cflags}" \
  237. CFLAGS="${l_cflags}" \
  238. LIBCFLAGS="${l_libcflags}" \
  239. LIBCXXFLAGS="${l_libcxxflags}" \
  240. $maketarget
  241. %install
  242. rm -rf $RPM_BUILD_ROOT
  243. # fetch GNU platform triple
  244. triple=`./config.guess`
  245. # perform the standard installation procedure
  246. ( cd obj
  247. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  248. ) || exit $?
  249. # cleanup installation tree
  250. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  251. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/
  252. dirs=""
  253. for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
  254. subdir=`echo "$multilib" | sed -e 's/;.*$//'`
  255. [ ".$subdir" = .. ] && continue
  256. mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
  257. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/
  258. dirs="$dirs $subdir"
  259. done
  260. for subdir in $dirs; do
  261. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir
  262. done
  263. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  264. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
  265. >/dev/null 2>&1 || true
  266. # strip installation tree
  267. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  268. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  269. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  270. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  271. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
  272. %if "%{with_cxx}" == "yes"
  273. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  274. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  275. %endif
  276. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  277. for prog in cc1 cc1plus collect2 cpp; do
  278. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \
  279. >/dev/null 2>&1 || true
  280. done
  281. # bump up installation tree
  282. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
  283. $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  284. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  285. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  286. %if "%{with_cxx}" == "yes"
  287. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  288. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  289. %endif
  290. # resolve filename conflicts
  291. %if "%{with_gcc}" != "yes" && "%{V_comp}" != ""
  292. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  293. for file in *; do
  294. [ ".$file" = ".*" ] && continue
  295. mv ${file} ${file}%{V_comp}
  296. done
  297. ) || exit $?
  298. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  299. for file in *; do
  300. [ ".$file" = ".*" ] && continue
  301. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  302. done
  303. ) || exit $?
  304. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  305. for file in *; do
  306. [ ".$file" = ".*" ] && continue
  307. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  308. done
  309. ) || exit $?
  310. %endif
  311. # determine installation file list
  312. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  313. %files -f files
  314. %clean
  315. rm -rf $RPM_BUILD_ROOT