| 1 | %define ver_major   4 | 
|---|
| 2 | %define ver_minor   7 | 
|---|
| 3 | %define ver_patch   3 | 
|---|
| 4 |  | 
|---|
| 5 | %define os2_release 1 | 
|---|
| 6 |  | 
|---|
| 7 | %define rpm_release 1 | 
|---|
| 8 |  | 
|---|
| 9 | %global gcc_version %{ver_major}.%{ver_minor}.%{ver_patch} | 
|---|
| 10 | %global gcc_target_platform %{_target_cpu} | 
|---|
| 11 |  | 
|---|
| 12 | # New package version scheme: X.Y.Z.N-R, where X.Y.Z is the GCC release (e.g. | 
|---|
| 13 | # 4.5.4, matches gcc_version above), N is the OS/2 release (1, 2, etc) and R is | 
|---|
| 14 | # the RPM release (1, 2, etc). The OS/2 release number increases with each | 
|---|
| 15 | # OS/2 specific update to the sources followed by a new build, the RPM repease | 
|---|
| 16 | # number increases with each new RPM build (which may use the same source tree | 
|---|
| 17 | # but fix only some RPM-specific things). Note that the RPM release number | 
|---|
| 18 | # resets to 1 each time the OS/2 release increases (which is reset to 1 in turn | 
|---|
| 19 | # when the GCC release changes. | 
|---|
| 20 |  | 
|---|
| 21 | Summary: Various compilers (C, C++, Objective-C, Java, ...) | 
|---|
| 22 | Name: gcc | 
|---|
| 23 | Version: %{gcc_version}.%{os2_release} | 
|---|
| 24 | Release: %{rpm_release}%{?dist} | 
|---|
| 25 |  | 
|---|
| 26 | # libgcc, libgfortran, libmudflap, libgomp, libstdc++ and crtstuff have | 
|---|
| 27 | # GCC Runtime Exception. | 
|---|
| 28 | License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions | 
|---|
| 29 | Group: Development/Languages | 
|---|
| 30 | URL: http://gcc.gnu.org | 
|---|
| 31 |  | 
|---|
| 32 | Source0: gcc-gcc-4_7-branch-os2.zip | 
|---|
| 33 | Patch0: gcc-os2.diff | 
|---|
| 34 |  | 
|---|
| 35 | Obsoletes: gcc < %{gcc_version} | 
|---|
| 36 |  | 
|---|
| 37 | BuildRequires: binutils make | 
|---|
| 38 | BuildRequires: os2-base-fhs | 
|---|
| 39 | BuildRequires: ash gcc gcc-wlink gcc-wrc grep gettext-devel diffutils gawk flex sed | 
|---|
| 40 | BuildRequires: gmp-devel >= 4.1.2-8, mpfr-devel >= 2.2.1, mpc-devel | 
|---|
| 41 |  | 
|---|
| 42 | Requires: libgcc%{ver_major}%{ver_minor}%{ver_patch} = %{version}-%{release} | 
|---|
| 43 | Requires: libssp = %{version}-%{release} | 
|---|
| 44 | Requires: libstdc++6 = %{version}-%{release} | 
|---|
| 45 | Requires: libsupc++6 = %{version}-%{release} | 
|---|
| 46 | Requires: libc-devel >= 0.6.3 | 
|---|
| 47 | Requires: binutils | 
|---|
| 48 |  | 
|---|
| 49 | %description | 
|---|
| 50 | The gcc package contains the GNU Compiler Collection version %{ver_major}.%{ver_minor}. | 
|---|
| 51 | You'll need this package in order to compile C code. | 
|---|
| 52 |  | 
|---|
| 53 | %package -n libgcc%{ver_major}%{ver_minor}%{ver_patch} | 
|---|
| 54 | Summary: GCC version %{ver_major}.%{ver_minor} shared support library | 
|---|
| 55 | Group: System Environment/Libraries | 
|---|
| 56 | Autoreq: false | 
|---|
| 57 |  | 
|---|
| 58 | %description -n libgcc%{ver_major}%{ver_minor}%{ver_patch} | 
|---|
| 59 | This package contains GCC shared support library which is needed | 
|---|
| 60 | e.g. for exception handling support. | 
|---|
| 61 |  | 
|---|
| 62 | %package -n libssp | 
|---|
| 63 | Summary: GCC stack protector shared library | 
|---|
| 64 | Group: System Environment/Libraries | 
|---|
| 65 | Obsoletes: gcc-stack-protector | 
|---|
| 66 |  | 
|---|
| 67 | %description -n libssp | 
|---|
| 68 | This package contains GCC shared library which is needed | 
|---|
| 69 | for stack protector. | 
|---|
| 70 |  | 
|---|
| 71 | %package -n libstdc++6 | 
|---|
| 72 | Summary: GNU Standard C++ Library v3 | 
|---|
| 73 | Group: System Environment/Libraries | 
|---|
| 74 |  | 
|---|
| 75 | %description -n libstdc++6 | 
|---|
| 76 | This package contains GNU Standard C++ Library v3 shared library. | 
|---|
| 77 |  | 
|---|
| 78 | %package -n libsupc++6 | 
|---|
| 79 | Summary: GNU Standard C++ Library v3 subset | 
|---|
| 80 | Group: System Environment/Libraries | 
|---|
| 81 |  | 
|---|
| 82 | %description -n libsupc++6 | 
|---|
| 83 | This package contains GNU Standard C++ Library v3 subset shared library. | 
|---|
| 84 |  | 
|---|
| 85 | %package wlink | 
|---|
| 86 | Summary: GCC configuration changes for Watcom linker support. | 
|---|
| 87 | Group: Development/Languages | 
|---|
| 88 | Requires: watcom-wlink-hll | 
|---|
| 89 |  | 
|---|
| 90 | %description wlink | 
|---|
| 91 | This package triggers the required config.sys settings to allow use of Watcom | 
|---|
| 92 | Linker instead of ld. | 
|---|
| 93 |  | 
|---|
| 94 | %package wrc | 
|---|
| 95 | Summary: GCC configuration changes for Watcom resource compiler support. | 
|---|
| 96 | Group: Development/Languages | 
|---|
| 97 | Requires: watcom-wrc | 
|---|
| 98 |  | 
|---|
| 99 | %description wrc | 
|---|
| 100 | This package triggers the required config.sys settings to allow use of Watcom | 
|---|
| 101 | resource compiler instead of IBM one. | 
|---|
| 102 |  | 
|---|
| 103 | %prep | 
|---|
| 104 | %setup -q -c | 
|---|
| 105 | %patch0 -p1 -b .os2~ | 
|---|
| 106 |  | 
|---|
| 107 | %build | 
|---|
| 108 | rm -fr obj-%{gcc_target_platform} | 
|---|
| 109 | mkdir obj-%{gcc_target_platform} | 
|---|
| 110 | cd obj-%{gcc_target_platform} | 
|---|
| 111 |  | 
|---|
| 112 | script_dir=%{_topdir}/BUILD/%{name}-%{version}/obj-%{gcc_target_platform} | 
|---|
| 113 | export PATH="$script_dir/gcc${PATH:+;$PATH}" | 
|---|
| 114 | export BEGINLIBPATH="$script_dir/gcc${BEGINLIBPATH:+;$BEGINLIBPATH}" | 
|---|
| 115 |  | 
|---|
| 116 | export CONFIG_SHELL=%{_bindir}/sh.exe | 
|---|
| 117 | export CFLAGS="$RPM_OPT_FLAGS -DEMX -DOS2" | 
|---|
| 118 | export CXXFLAGS="$RPM_OPT_FLAGS -DEMX -DOS2" | 
|---|
| 119 | export LDFLAGS="-g -Zexe -Zomf -Zmap -Zargs-wild -Zhigh-mem" | 
|---|
| 120 | export LANG=en_US | 
|---|
| 121 | export GREP=grep | 
|---|
| 122 |  | 
|---|
| 123 | ../configure --prefix=%{_prefix} \ | 
|---|
| 124 | --with-sysroot=/@unixroot \ | 
|---|
| 125 | --enable-shared \ | 
|---|
| 126 | --enable-languages=c,c++ \ | 
|---|
| 127 | --with-gnu-as \ | 
|---|
| 128 | --disable-bootstrap \ | 
|---|
| 129 | --disable-multilib \ | 
|---|
| 130 | --disable-libstdcxx-pch \ | 
|---|
| 131 | --enable-threads | 
|---|
| 132 |  | 
|---|
| 133 | make | 
|---|
| 134 | # %{?_smp_mflags} | 
|---|
| 135 |  | 
|---|
| 136 |  | 
|---|
| 137 | %install | 
|---|
| 138 | rm -rf $RPM_BUILD_ROOT | 
|---|
| 139 |  | 
|---|
| 140 | cd obj-%{gcc_target_platform} | 
|---|
| 141 |  | 
|---|
| 142 | # There are some MP bugs in libstdc++ Makefiles | 
|---|
| 143 | #make -C %{gcc_target_platform}/libstdc++-v3 | 
|---|
| 144 |  | 
|---|
| 145 | #make prefix=%{buildroot}%{_prefix} mandir=%{buildroot}%{_mandir} \ | 
|---|
| 146 | #  infodir=%{buildroot}%{_infodir} install | 
|---|
| 147 |  | 
|---|
| 148 | make DESTDIR=${RPM_BUILD_ROOT} install | 
|---|
| 149 |  | 
|---|
| 150 | # copy runtime files | 
|---|
| 151 | emxomf -o i386-pc-os2-emx/libgcc/libgcc_so_d.lib i386-pc-os2-emx/libgcc/libgcc_so_d.a | 
|---|
| 152 | cp -p i386-pc-os2-emx/libgcc/libgcc_so_d.a %{buildroot}%{_libdir} | 
|---|
| 153 | cp -p i386-pc-os2-emx/libgcc/libgcc_so_d.lib %{buildroot}%{_libdir} | 
|---|
| 154 | cp -p i386-pc-os2-emx/libgcc/gcc%{ver_major}%{ver_minor}%{ver_patch}.dll %{buildroot}%{_libdir} | 
|---|
| 155 |  | 
|---|
| 156 | #build dll | 
|---|
| 157 | dllar -o stdcpp6.dll i386-pc-os2-emx/libstdc++-v3/src/.libs/libstdc++.a \ | 
|---|
| 158 | -d "GNU stdc++ %{gcc_version}" \ | 
|---|
| 159 | -nolxlite -flags "-Zmap -Zhigh-mem -Zomf -g -L%{buildroot}%{_libdir}" \ | 
|---|
| 160 | -ex "___main ___do_global_* ___ctordtor* ___eh* ___pop* _DLL_InitTerm" \ | 
|---|
| 161 | -libf "INITINSTANCE TERMINSTANCE" \ | 
|---|
| 162 | -libd "DATA MULTIPLE" | 
|---|
| 163 | cp -p stdcpp6.dll %{buildroot}%{_libdir} | 
|---|
| 164 | cp -p stdcpp6.a %{buildroot}%{_libdir}/stdc++.a | 
|---|
| 165 | cp -p stdcpp6.lib %{buildroot}%{_libdir}/stdc++.lib | 
|---|
| 166 | mv %{buildroot}%{_libdir}/libstdc++.a %{buildroot}%{_libdir}/stdc++_s.a | 
|---|
| 167 |  | 
|---|
| 168 | #build dll | 
|---|
| 169 | dllar -o supcpp6.dll i386-pc-os2-emx/libstdc++-v3/libsupc++/.libs/libsupc++.a \ | 
|---|
| 170 | -d "GNU supc++ %{gcc_version}" \ | 
|---|
| 171 | -nolxlite -flags "-Zmap -Zhigh-mem -Zomf -g -L%{buildroot}%{_libdir}" \ | 
|---|
| 172 | -ex "___main ___do_global_* ___ctordtor* ___eh* ___pop* _DLL_InitTerm" \ | 
|---|
| 173 | -libf "INITINSTANCE TERMINSTANCE" \ | 
|---|
| 174 | -libd "DATA MULTIPLE" | 
|---|
| 175 | cp -p supcpp6.dll %{buildroot}%{_libdir} | 
|---|
| 176 | cp -p supcpp6.a %{buildroot}%{_libdir}/supc++.a | 
|---|
| 177 | cp -p supcpp6.lib %{buildroot}%{_libdir}/supc++.lib | 
|---|
| 178 | mv %{buildroot}%{_libdir}/libsupc++.a %{buildroot}%{_libdir}/supc++_s.a | 
|---|
| 179 |  | 
|---|
| 180 | #build dll | 
|---|
| 181 | dllar -o ssp.dll i386-pc-os2-emx/libssp/.libs/ssp.a \ | 
|---|
| 182 | -d "GNU Stack Protector %{gcc_version}" \ | 
|---|
| 183 | -nolxlite -flags "-Zmap -Zhigh-mem -Zomf -g -L%{buildroot}%{_libdir}" \ | 
|---|
| 184 | -ex "___main ___do_global_* ___ctordtor* ___eh* ___pop* _DLL_InitTerm" \ | 
|---|
| 185 | -libf "INITINSTANCE TERMINSTANCE" \ | 
|---|
| 186 | -libd "DATA MULTIPLE" | 
|---|
| 187 | cp -p ssp.dll %{buildroot}%{_libdir} | 
|---|
| 188 | cp -p ssp.a %{buildroot}%{_libdir} | 
|---|
| 189 | cp -p ssp.lib %{buildroot}%{_libdir} | 
|---|
| 190 | mv %{buildroot}%{_libdir}/ssp.a %{buildroot}%{_libdir}/ssp_s.a | 
|---|
| 191 |  | 
|---|
| 192 | cd .. | 
|---|
| 193 |  | 
|---|
| 194 | echo dummy for virtual package > gcc-wrc.txt | 
|---|
| 195 | echo dummy for virtual package > gcc-wlink.txt | 
|---|
| 196 |  | 
|---|
| 197 | #mkdir -p %{buildroot}%{_usr} | 
|---|
| 198 |  | 
|---|
| 199 | rm %{buildroot}%{_libdir}/*.la | 
|---|
| 200 | rm %{buildroot}%{_libdir}/*.py | 
|---|
| 201 |  | 
|---|
| 202 | ln -s ./cc1.exe %{buildroot}%{_libexecdir}/gcc/i386-pc-os2-emx/%{gcc_version}/cc1 | 
|---|
| 203 | ln -s ./cc1plus.exe %{buildroot}%{_libexecdir}/gcc/i386-pc-os2-emx/%{gcc_version}/cc1plus | 
|---|
| 204 |  | 
|---|
| 205 | #yd fix attributes for executables | 
|---|
| 206 | chmod 0755 %{buildroot}%{_bindir}/*.exe | 
|---|
| 207 |  | 
|---|
| 208 | %clean | 
|---|
| 209 | rm -rf %{buildroot} | 
|---|
| 210 |  | 
|---|
| 211 | %post wrc | 
|---|
| 212 | if [ "$1" = 1 ] ; then | 
|---|
| 213 | #execute only on first install | 
|---|
| 214 | %cube {DELLINE "SET EMXOMFLD_RC="} c:\config.sys > NUL | 
|---|
| 215 | %cube {DELLINE "SET EMXOMFLD_RC_TYPE="} c:\config.sys > NUL | 
|---|
| 216 | %cube {ADDLINE "SET EMXOMFLD_RC=wrc.exe"} c:\config.sys > NUL | 
|---|
| 217 | %cube {ADDLINE "SET EMXOMFLD_RC_TYPE=WRC"} c:\config.sys > NUL | 
|---|
| 218 | fi | 
|---|
| 219 |  | 
|---|
| 220 | %postun wrc | 
|---|
| 221 | if [ "$1" = 0 ] ; then | 
|---|
| 222 | #execute only on last uninstall | 
|---|
| 223 | %cube {DELLINE "SET EMXOMFLD_RC="} c:\config.sys > NUL | 
|---|
| 224 | %cube {DELLINE "SET EMXOMFLD_RC_TYPE="} c:\config.sys > NUL | 
|---|
| 225 | fi | 
|---|
| 226 |  | 
|---|
| 227 | %post wlink | 
|---|
| 228 | if [ "$1" = 1 ] ; then | 
|---|
| 229 | #execute only on first install | 
|---|
| 230 | %cube {DELLINE "SET EMXOMFLD_LINKER="} c:\config.sys > NUL | 
|---|
| 231 | %cube {DELLINE "SET EMXOMFLD_TYPE="} c:\config.sys > NUL | 
|---|
| 232 | %cube {ADDLINE "SET EMXOMFLD_LINKER=wl.exe"} c:\config.sys > NUL | 
|---|
| 233 | %cube {ADDLINE "SET EMXOMFLD_TYPE=WLINK"} c:\config.sys > NUL | 
|---|
| 234 | fi | 
|---|
| 235 |  | 
|---|
| 236 | %postun wlink | 
|---|
| 237 | if [ "$1" = 0 ] ; then | 
|---|
| 238 | #execute only on last uninstall | 
|---|
| 239 | %cube {DELLINE "SET EMXOMFLD_LINKER="} c:\config.sys > NUL | 
|---|
| 240 | %cube {DELLINE "SET EMXOMFLD_TYPE="} c:\config.sys > NUL | 
|---|
| 241 | fi | 
|---|
| 242 |  | 
|---|
| 243 | %files | 
|---|
| 244 | %defattr(-,root,root,-) | 
|---|
| 245 | %{_usr}/bin | 
|---|
| 246 | %{_usr}/include | 
|---|
| 247 | %{_libdir}/*.*a | 
|---|
| 248 | %{_libdir}/*.lib | 
|---|
| 249 | %exclude %{_libdir}/*.dll | 
|---|
| 250 | %{_libdir}/*.spec | 
|---|
| 251 | %{_libdir}/gcc/* | 
|---|
| 252 | %{_usr}/libexec | 
|---|
| 253 | %{_usr}/share | 
|---|
| 254 | %doc ChangeLog ChangeLog.* | 
|---|
| 255 | %doc README README.* | 
|---|
| 256 | %doc COPYING COPYING.* | 
|---|
| 257 | %doc MAINTAINERS | 
|---|
| 258 |  | 
|---|
| 259 | %files -n libssp | 
|---|
| 260 | %defattr(-,root,root,-) | 
|---|
| 261 | %{_libdir}/ssp.dll | 
|---|
| 262 |  | 
|---|
| 263 | %files -n libstdc++6 | 
|---|
| 264 | %defattr(-,root,root,-) | 
|---|
| 265 | %{_libdir}/stdcp*.dll | 
|---|
| 266 |  | 
|---|
| 267 | %files -n libsupc++6 | 
|---|
| 268 | %defattr(-,root,root,-) | 
|---|
| 269 | %{_libdir}/supcp*.dll | 
|---|
| 270 |  | 
|---|
| 271 | %files wlink | 
|---|
| 272 | %doc gcc-wlink.txt | 
|---|
| 273 |  | 
|---|
| 274 | %files wrc | 
|---|
| 275 | %doc gcc-wrc.txt | 
|---|
| 276 |  | 
|---|
| 277 | %files -n libgcc%{ver_major}%{ver_minor}%{ver_patch} | 
|---|
| 278 | %defattr(-,root,root,-) | 
|---|
| 279 | %{_libdir}/gcc%{ver_major}%{ver_minor}%{ver_patch}.dll | 
|---|
| 280 |  | 
|---|
| 281 |  | 
|---|
| 282 | %changelog | 
|---|
| 283 | * Wed Nov 27 2013 yd | 
|---|
| 284 | - Rename the following packages to avoid ABI breaks (using gcc versioning policy): | 
|---|
| 285 | + libstdc++ => libstdc++6 | 
|---|
| 286 | + libsupc++ => libsupc++6 | 
|---|
| 287 | - updated source code to gcc 4.7.3. | 
|---|
| 288 |  | 
|---|
| 289 | * Mon Jul 25 2013 Dmitriy Kuminov <coding@dmik.org> - 4.4.6.17-1 | 
|---|
| 290 | - New OS/2 Release 17 of 4.4.6. See ChangeLog.OS2 for more information. | 
|---|
| 291 |  | 
|---|
| 292 | * Mon Jul 23 2013 Dmitriy Kuminov <coding@dmik.org> - 4.4.6.16-1 | 
|---|
| 293 | - New OS/2 Release 16 of 4.4.6. See ChangeLog.OS2 for more information. | 
|---|
| 294 | - Rename the following packages to better match the conventions: | 
|---|
| 295 | + gcc-stack-protector => libssp | 
|---|
| 296 | + gcc-stdc++-shared-library => libstdc++ | 
|---|
| 297 | + gcc-supc++-shared-library => libsupc++ | 
|---|
| 298 |  | 
|---|
| 299 | * Mon Jan 09 2012 yd | 
|---|
| 300 | - install also dlls with main package. | 
|---|
| 301 |  | 
|---|
| 302 | * Sun Jan 08 2012 yd | 
|---|
| 303 | - moved dlls out from main package. | 
|---|
| 304 |  | 
|---|
| 305 | * Fri Dec 23 2011 yd | 
|---|
| 306 | - fixed spawn internal error report. | 
|---|
| 307 | - fixed handling of big command lines (fixes OOo building). | 
|---|
| 308 | - fixed Optlink calls. | 
|---|
| 309 |  | 
|---|
| 310 | * Fri Dec 9 2011 yd | 
|---|
| 311 | - updated source code to 4.4.6, github tree | 
|---|