gcc44.spec 12 KB

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