gcc43.spec 11 KB

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