# Xce: cross compile environment. # To make xce, should define cross_target. # ex. # $ rpmbuild -ba --define='cross_target armv5tel-redhat-linux-gnueabi' \ # --define='target_model kuroboxpro' \ # --target=i686 SPECS/Xce.spec # # This environment includes binutils, gcc and glibc. %define __os_install_post /usr/lib/rpm/brp-compress %define binutils_ver 2.17.50.0.6 %define binutils_rel 2.fc6 %define gcc_fver 4.1.1 %define gcc_ver 4.1.2 %define gcc_date 20070105 %define glibc_ver 2.5 %define glibc_date 20061008T1257 %define newlib_ver 1.15.0 %define sublevel 20 %define kversion 2.6.%{sublevel} %define dountar 1 %define makebinutils 1 %define makegcc1 1 %define makeglibc 1 %define makegcc2 1 %define target_name unknown %{?cross_target:%define target_name %{cross_target}} %define target_config unknown %{?target_model:%define target_config %{target_model}} %{?skipuntar:%define dountar 0} %{?skipbinutils:%define makebinutils 0} %{?skipgcc1:%define makegcc1 0} %{?skipglibc:%define makeglibc 0} %{?skipmakegcc2:%define makegcc2 0} Summary: Xross compile environment Name: Xce Version: 1.1 Release: 3tsorg #Copyright: GPL License: GPL Group: Development/Tools Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root Source0: http://www.kernel.org/pub/linux/devel/binutils/binutils-%{binutils_ver}.tar.bz2 Source1: gcc-%{gcc_fver}-%{gcc_date}.tar.bz2 Source2: glibc-%{glibc_ver}-%{glibc_date}.tar.bz2 Source3: glibc-%{glibc_ver}-fedora-%{glibc_date}.tar.bz2 Source4: glibc-ports-%{glibc_ver}.tar.bz2 Source5: ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_ver}.tar.gz Source6: ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-%{kversion}.tar.bz2 NoSource: 0 NoSource: 1 NoSource: 2 NoSource: 3 NoSource: 4 NoSource: 5 NoSource: 6 Source9601: kernel-2.6.20-kuroboxpro.config #http://linkstationwiki.net/index.php/Main_Page svn Patch9602: kernel-2.6.20-arm9.patch Patch9603: http://updates.aslab.com/kernel/custom/asl_patches/marvell_3.6.2.patch Patch9604: http://updates.aslab.com/kernel/custom/asl_patches/marvell_0x03.patch Patch9605: http://updates.aslab.com/kernel/custom/asl_patches/marvell_6101.patch Patch9606: kernel-2.6.20-mvsata-tsorg.patch Patch9607: kernel-2.6.20-kuroboxpro-nand-tsorg.patch NoPatch: 9603 NoPatch: 9604 NoPatch: 9605 Patch9701: binutils-2.17.50.0.6-ltconfig-multilib.patch Patch9702: binutils-2.17.50.0.6-ppc64-pie.patch Patch9703: binutils-2.17.50.0.6-place-orphan.patch Patch9704: binutils-2.17.50.0.6-ia64-lib64.patch Patch9705: binutils-2.17.50.0.6-elfvsb-test.patch Patch9706: binutils-2.17.50.0.6-standards.patch Patch9707: binutils-2.17.50.0.6-build-fixes.patch Patch9708: binutils-2.17.50.0.6-kept-section.patch Patch9709: binutils-2.17.50.0.6-power6-insns.patch Patch9710: binutils-2.17.50.0.6-fixsyms.patch Patch9711: binutils-2.17.50.0.6-gas-debug-ranges-revert.patch Patch9712: binutils-2.17.50.0.6-popcnt.patch NoPatch: 9701 NoPatch: 9702 NoPatch: 9703 NoPatch: 9704 NoPatch: 9705 NoPatch: 9706 NoPatch: 9707 NoPatch: 9708 NoPatch: 9709 NoPatch: 9710 NoPatch: 9711 NoPatch: 9712 Patch9801: gcc41-ice-hack.patch Patch9802: gcc41-ppc64-m32-m64-multilib-only.patch Patch9803: gcc41-ia64-libunwind.patch Patch9805: gcc41-java-nomulti.patch Patch9806: gcc41-ada-pr18302.patch Patch9807: gcc41-ada-tweaks.patch Patch9808: gcc41-java-slow_pthread_self.patch Patch9809: gcc41-ppc32-retaddr.patch Patch9810: gcc41-mni.patch Patch9811: gcc41-dsohandle.patch Patch9812: gcc41-rh184446.patch Patch9813: gcc41-pr20297-test.patch Patch9814: gcc41-objc-rh185398.patch Patch9815: gcc41-tests.patch Patch9816: gcc41-pr25874.patch Patch9817: gcc41-pr30189.patch Patch9818: gcc41-i386-tune-geode.patch Patch9819: gcc41-hash-style-gnu.patch Patch9820: gcc41-pr30001.patch Patch9821: gcc41-java-libdotdotlib.patch Patch9822: gcc41-pr28709.patch Patch9823: gcc41-pr28755.patch Patch9824: gcc41-pr27898.patch Patch9825: gcc41-pr27567.patch Patch9826: gcc41-pr29272.patch Patch9827: gcc41-pr29059.patch Patch9828: gcc41-strncat-chk.patch Patch9829: gcc41-pr29703.patch Patch9830: gcc41-pr29299.patch Patch9831: gcc41-libjava-anonverscript.patch Patch9832: gcc41-ppc64-libffi-unwind.patch Patch9833: gcc41-pr30113.patch Patch9834: gcc41-pr30110.patch Patch9835: gcc41-pr30143.patch Patch9836: gcc41-pr30045.patch Patch9837: gcc41-pr24036-revert.patch Patch9838: gcc41-arm-config-guess-fix.patch Patch9839: gcc41-armeabi-floatundi-redefine.diff Patch9840: gcc41-pr28516.patch Patch9841: gcc41-unbreak-armv4t.patch Patch9899: gcc41-armv5tel-tsorg.patch NoPatch: 9801 NoPatch: 9802 NoPatch: 9803 NoPatch: 9805 NoPatch: 9806 NoPatch: 9807 NoPatch: 9808 NoPatch: 9809 NoPatch: 9810 NoPatch: 9811 NoPatch: 9812 NoPatch: 9813 NoPatch: 9814 NoPatch: 9815 NoPatch: 9816 NoPatch: 9817 NoPatch: 9818 NoPatch: 9819 NoPatch: 9820 NoPatch: 9821 NoPatch: 9822 NoPatch: 9823 NoPatch: 9824 NoPatch: 9825 NoPatch: 9826 NoPatch: 9827 NoPatch: 9828 NoPatch: 9829 NoPatch: 9830 NoPatch: 9831 NoPatch: 9832 NoPatch: 9833 NoPatch: 9834 NoPatch: 9835 NoPatch: 9836 NoPatch: 9837 NoPatch: 9838 NoPatch: 9839 NoPatch: 9840 NoPatch: 9841 Patch9900: glibc-2.5-fedora.patch Patch9901: glibc-ia64-lib64.patch Patch9902: glibc-bz3352.patch Patch9903: glibc-bz3369.patch Patch9904: glibc-i386-syscall6.patch Patch9905: glibc-rh210130.patch Patch9906: glibc-rh211116.patch Patch9907: glibc-bz3429.patch Patch9908: glibc-bz3451.patch Patch9909: glibc-nptl_db-dtvp.patch Patch9910: glibc-r_debug-r_map.patch Patch9911: glibc-rh213656.patch Patch9912: glibc-rh214569.patch Patch9913: glibc-strxfrm.patch Patch9914: glibc-sysconf-intel-core-duo.patch Patch9915: glibc-tzfile64.patch Patch9916: glibc-bz3320.patch Patch9917: glibc-bz3559.patch Patch9918: glibc-mai_IN.patch Patch9919: glibc-po-update.patch Patch9920: glibc-powerpc-cpu-addon-update.patch Patch9921: glibc-rh215572.patch Patch9922: glibc-bz3632.patch Patch9923: glibc-memusage.patch Patch9924: glibc-nis+-getenv.patch Patch9925: glibc-rh206483.patch Patch9926: glibc-rh218276.patch Patch9927: glibc-rh218782.patch Patch9928: glibc-rh218802.patch Patch9929: glibc-strtod.patch Patch9930: glibc-bz2337.patch Patch9931: glibc-bz3747.patch Patch9932: glibc-rh216970.patch Patch9933: glibc-rh219107.patch Patch9934: glibc-rh219145.patch Patch9935: glibc-tst-pselect.patch Patch9936: glibc-rh220420.patch Patch9937: glibc-rh220658.patch Patch9938: glibc-2.6.19-arm-vfp-fixup.diff NoPatch: 9900 NoPatch: 9901 NoPatch: 9902 NoPatch: 9903 NoPatch: 9904 NoPatch: 9905 NoPatch: 9906 NoPatch: 9907 NoPatch: 9908 NoPatch: 9909 NoPatch: 9910 NoPatch: 9911 NoPatch: 9912 NoPatch: 9913 NoPatch: 9914 NoPatch: 9915 NoPatch: 9916 NoPatch: 9917 NoPatch: 9918 NoPatch: 9919 NoPatch: 9920 NoPatch: 9921 NoPatch: 9922 NoPatch: 9923 NoPatch: 9924 NoPatch: 9925 NoPatch: 9926 NoPatch: 9927 NoPatch: 9928 NoPatch: 9929 NoPatch: 9930 NoPatch: 9931 NoPatch: 9932 NoPatch: 9933 NoPatch: 9934 NoPatch: 9935 NoPatch: 9936 NoPatch: 9937 NoPatch: 9938 %description Xce is a cross compile environment. To make xce, should define cross_target. ex. $ rpm -ba --define='cross_target armv4l-yopy-linux' \ --target=i686 SPECS/binutils.spec This environment includes binutils, gcc and glibc. %package %{target_name} Summary: Base directories for %{target_name} Xross compile environment. Group: Development/Tools %description %{target_name} Base directories for %{target_name} Xross compile environment. %package -n %{target_name}-kernel-headers-%{kversion} Summary: kernel headers for %{target_name} Xross compile environment. Group: Development/Tools Requires: %{name}-%{target_name} = %{version} %description -n %{target_name}-kernel-headers-%{kversion} kernel headers for %{target_name} Xross compile environment. %package -n %{target_name}-binutils-%{binutils_ver} Summary: binutils for %{target_name} Xross compile environment. Group: Development/Tools Requires: %{name}-%{target_name} = %{version} %description -n %{target_name}-binutils-%{binutils_ver} binutils for %{target_name} Xross compile environment. %package -n %{target_name}-gcc-%{gcc_ver} Summary: gcc for %{target_name} Xross compile environment. Group: Development/Tools Requires: %{name}-%{target_name} = %{version}, %{target_name}-glibc-%{glibc_ver} = %{version} %description -n %{target_name}-gcc-%{gcc_ver} gcc(cc,c++) for %{target_name} Xross compile environment. %package -n %{target_name}-glibc-%{glibc_ver} Summary: glibc for %{target_name} Xross compile environment. Requires: %{name}-%{target_name} = %{version} Group: Development/Tools %description -n %{target_name}-glibc-%{glibc_ver} glibc for %{target_name} Xross compile environment. %prep rm -rf ${RPM_BUILD_ROOT} rm -rf ${RPM_BUILD_ROOT}2 rm -rf ${RPM_BUILD_ROOT}.old mkdir -p ${RPM_BUILD_ROOT}%{_prefix} if [ %{target_name} = unknown ]; then echo You should specify \"cross_target\". echo " ex. --define='cross_target armv4l-yopy-linux'" exit 1 fi %if %{dountar} /bin/rm -rf %{name}-%{version} mkdir %{name}-%{version} %endif cd Xce-%{version} %if %{dountar} bzcat %{SOURCE0} | tar xf - cd binutils-%{binutils_ver} %patch9701 -p0 -b .ltconfig-multilib~ %patch9702 -p0 -b .ppc64-pie~ %patch9703 -p0 -b .place-orphan~ %ifarch ia64 %if "%{_lib}" == "lib64" %patch9704 -p0 -b .ia64-lib64~ %endif %endif %patch9705 -p0 -b .elfvsb-test~ %patch9706 -p0 -b .standards~ %patch9707 -p0 -b .build-fixes~ %patch9708 -p0 -b .kept-section~ %patch9709 -p0 -b .power6-insns~ %patch9710 -p0 -b .fixsyms~ %patch9711 -p0 -R -b .gas-debug-ranges-revert~ %patch9712 -p0 -b .popcnt~ # On ppc64 we might use 64K pages sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c # LTP sucks perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf* sed -i -e 's/%{binutils_ver}/%{binutils_ver}-%{binutils_rel}/g' bfd/configure{.in,} sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in} touch */configure cd .. bzcat %{SOURCE1} | tar xf - cd gcc-%{gcc_fver}-%{gcc_date} %patch9801 -p0 -b .ice-hack~ %patch9802 -p0 -b .ppc64-m32-m64-multilib-only~ %patch9803 -p0 -b .ia64-libunwind~ #%patch9804 -p0 -b .gnuc-rh-release~ %patch9805 -p0 -b .java-nomulti~ %patch9806 -p0 -b .ada-pr18302~ %patch9807 -p0 -b .ada-tweaks~ %patch9808 -p0 -b .java-slow_pthread_self~ %patch9809 -p0 -b .ppc32-retaddr~ %patch9810 -p0 -b .mni~ %patch9811 -p0 -b .dsohandle~ %patch9812 -p0 -b .rh184446~ %patch9813 -p0 -E -b .pr20297-test~ %patch9814 -p0 -b .objc-rh185398~ %patch9815 -p0 -b .tests~ %patch9816 -p0 -b .pr25874~ %patch9817 -p0 -b .pr30189~ %patch9818 -p0 -b .i386-tune-geode~ %patch9819 -p0 -b .hash-style-gnu~ %patch9820 -p0 -b .pr30001~ %patch9821 -p0 -b .java-libdotdotlib~ %patch9822 -p0 -b .pr28709~ %patch9823 -p0 -b .pr28755~ %patch9824 -p0 -b .pr27898~ %patch9825 -p0 -b .pr27567~ %patch9826 -p0 -b .pr29272~ %patch9827 -p0 -b .pr29059~ %patch9828 -p0 -b .strncat-chk~ %patch9829 -p0 -b .pr29703~ %patch9830 -p0 -b .pr29299~ %patch9831 -p0 -b .libjava-anonverscript~ %patch9832 -p0 -b .ppc64-libffi-unwind~ %patch9833 -p0 -b .pr30113~ %patch9834 -p0 -b .pr30110~ %patch9835 -p0 -b .pr30143~ %patch9836 -p0 -b .pr30045~ %patch9837 -p0 -b .pr24036-revert~ %patch9838 -p0 -b .armconfig~ %patch9839 -p0 -b .armsymbol~ %patch9840 -p0 -b .pr28516~ %ifarch armv4tl %patch9841 -p0 -b .armv4t~ %endif %patch9899 -p1 -b .armv5tel~ mv gcc/config/arm/t-linux-eabi{,.orig} cat gcc/config/arm/t-linux-eabi.orig | sed s/'crtbeginT.o$'/'crtbeginT.o crti.o crtn.o'/g > gcc/config/arm/t-linux-eabi mv gcc/Makefile.in{,.orig} sed s@"mv tmp-libgcc.mk libgcc.mk"@"sed s/'ects) -lc '/'ects) '/g tmp-libgcc.mk > libgcc.mk"@g gcc/Makefile.in.orig > gcc/Makefile.in cd .. bzcat %{SOURCE2} | tar xf - zcat %{SOURCE5} | tar xf - cp -a newlib-%{newlib_ver}/newlib gcc-%{gcc_fver}-%{gcc_date}/ cp -a newlib-%{newlib_ver}/libgloss gcc-%{gcc_fver}-%{gcc_date}/ mv gcc-%{gcc_fver}-%{gcc_date}/newlib/configure.host{,.orig} sed -e s/' arm)'/' arm*)'/g -e s/' arm-'/' arm*-'/g gcc-%{gcc_fver}-%{gcc_date}/newlib/configure.host.orig > gcc-%{gcc_fver}-%{gcc_date}/newlib/configure.host mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{target_name}/include ln -s include $RPM_BUILD_ROOT%{_prefix}/%{target_name}/sys-include targetcpu=`echo %{target_name} | cut -d- -f 1 | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.\*/arm/ -e s/sa110/arm/` #bzcat %{SOURCE9800} | tar xf - bzcat %{SOURCE6} | tar xf - cd linux-%{kversion} %patch9602 -p1 %patch9603 -p1 %patch9604 -p1 %patch9605 -p1 %patch9606 -p1 %patch9607 -p1 cp %{SOURCE9601} arch/arm/configs/kuroboxpro_defconfig cp arch/${targetcpu}/configs/%{target_config}_defconfig .config make -s ARCH=${targetcpu} CROSS_COMPILE=%{target_name}- oldconfig make -s ARCH=${targetcpu} CROSS_COMPILE=%{target_name}- archprepare cp -a include/asm-generic $RPM_BUILD_ROOT%{_prefix}/%{target_name}/sys-include/ cp -a include/asm-$targetcpu $RPM_BUILD_ROOT%{_prefix}/%{target_name}/sys-include/ cp -a include/asm $RPM_BUILD_ROOT%{_prefix}/%{target_name}/sys-include/ cp -a include/linux $RPM_BUILD_ROOT%{_prefix}/%{target_name}/sys-include/ cd .. cd glibc-%{glibc_ver}-%{glibc_date} bzcat %{SOURCE3} | tar xf - bzcat %{SOURCE4} | tar xf - && mv glibc-ports-%{glibc_ver} ports %patch9900 -E -p1 %ifarch ia64 %if "%{_lib}" == "lib64" %patch9901 -p1 %endif %endif %patch9902 -p1 %patch9903 -p1 %patch9904 -p1 #%patch9905 -p1 %patch9906 -p1 %patch9907 -p1 %patch9908 -p1 %patch9909 -p1 %patch9910 -p1 %patch9911 -p1 %patch9912 -p1 %patch9913 -p1 %patch9914 -p1 %patch9915 -p1 %patch9916 -p1 %patch9917 -p1 %patch9918 -p1 %patch9919 -p1 %patch9920 -p1 %patch9921 -p1 %patch9922 -p1 %patch9923 -p1 %patch9924 -p1 %patch9925 -p1 %patch9926 -p1 %patch9927 -p1 %patch9928 -p1 %patch9929 -p1 %patch9930 -p1 %patch9931 -p1 %patch9932 -p1 %patch9933 -p1 %patch9934 -p1 %patch9935 -p1 %patch9936 -p1 %patch9937 -p1 %patch9938 -p1 # Hack till glibc-kernheaders get updated, argh mkdir -p override_headers/linux cat > override_headers/linux/version.h < override_headers/asm/unistd.h < %ifarch alpha #ifndef __NR_stat64 #define __NR_stat64 425 #define __NR_lstat64 426 #define __NR_fstat64 427 #endif #ifndef __NR_mq_open #define __NR_mq_open 432 #define __NR_mq_unlink 433 #define __NR_mq_timedsend 434 #define __NR_mq_timedreceive 435 #define __NR_mq_notify 436 #define __NR_mq_getsetattr 437 #endif #ifndef __NR_waitid #define __NR_waitid 438 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 444 #define __NR_inotify_add_watch 445 #define __NR_inotify_rm_watch 446 #endif %endif %ifarch %{ix86} #ifndef __NR_mq_open #define __NR_mq_open 277 #define __NR_mq_unlink (__NR_mq_open+1) #define __NR_mq_timedsend (__NR_mq_open+2) #define __NR_mq_timedreceive (__NR_mq_open+3) #define __NR_mq_notify (__NR_mq_open+4) #define __NR_mq_getsetattr (__NR_mq_open+5) #endif #ifndef __NR_waitid #define __NR_waitid 284 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 291 #define __NR_inotify_add_watch 292 #define __NR_inotify_rm_watch 293 #endif #ifndef __NR_openat #define __NR_openat 295 #define __NR_mkdirat 296 #define __NR_mknodat 297 #define __NR_fchownat 298 #define __NR_futimesat 299 #define __NR_unlinkat 301 #define __NR_renameat 302 #define __NR_linkat 303 #define __NR_symlinkat 304 #define __NR_readlinkat 305 #define __NR_fchmodat 306 #define __NR_faccessat 307 #endif #ifndef __NR_fstatat64 #define __NR_fstatat64 300 #endif #ifndef __NR_pselect6 #define __NR_pselect6 308 #define __NR_ppoll 309 #endif #ifndef __NR_unshare #define __NR_unshare 310 #endif #ifndef __NR_set_robust_list #define __NR_set_robust_list 311 #define __NR_get_robust_list 312 #endif #ifndef __NR_splice #define __NR_splice 313 #endif #ifndef __NR_sync_file_range #define __NR_sync_file_range 314 #endif #ifndef __NR_tee #define __NR_tee 315 #endif #ifndef __NR_vmsplice #define __NR_vmsplice 316 #endif %endif %ifarch ia64 #ifndef __NR_timer_create #define __NR_timer_create 1248 #define __NR_timer_settime 1249 #define __NR_timer_gettime 1250 #define __NR_timer_getoverrun 1251 #define __NR_timer_delete 1252 #define __NR_clock_settime 1253 #define __NR_clock_gettime 1254 #define __NR_clock_getres 1255 #define __NR_clock_nanosleep 1256 #endif #ifndef __NR_mq_open #define __NR_mq_open 1262 #define __NR_mq_unlink 1263 #define __NR_mq_timedsend 1264 #define __NR_mq_timedreceive 1265 #define __NR_mq_notify 1266 #define __NR_mq_getsetattr 1267 #endif #ifndef __NR_waitid #define __NR_waitid 1270 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 1277 #define __NR_inotify_add_watch 1278 #define __NR_inotify_rm_watch 1279 #endif #ifndef __NR_openat #define __NR_openat 1281 #define __NR_mkdirat 1282 #define __NR_mknodat 1283 #define __NR_fchownat 1284 #define __NR_futimesat 1285 #define __NR_newfstatat 1286 #define __NR_unlinkat 1287 #define __NR_renameat 1288 #define __NR_linkat 1289 #define __NR_symlinkat 1290 #define __NR_readlinkat 1291 #define __NR_fchmodat 1292 #define __NR_faccessat 1293 #endif #if 0 #ifndef __NR_pselect6 #define __NR_pselect6 1294 #define __NR_ppoll 1295 #endif #endif #ifndef __NR_unshare #define __NR_unshare 1296 #endif #ifndef __NR_splice #define __NR_splice 1297 #endif #ifndef __NR_set_robust_list #define __NR_set_robust_list 1298 #define __NR_get_robust_list 1299 #endif #ifndef __NR_sync_file_range #define __NR_sync_file_range 1300 #endif #ifndef __NR_tee #define __NR_tee 1301 #endif #ifndef __NR_vmsplice #define __NR_vmsplice 1302 #endif %endif %ifarch ppc #ifndef __NR_utimes #define __NR_utimes 251 #endif #ifndef __NR_statfs64 #define __NR_statfs64 252 #define __NR_fstatfs64 253 #endif #ifndef __NR_fadvise64_64 #define __NR_fadvise64_64 254 #endif #ifndef __NR_mq_open #define __NR_mq_open 262 #define __NR_mq_unlink 263 #define __NR_mq_timedsend 264 #define __NR_mq_timedreceive 265 #define __NR_mq_notify 266 #define __NR_mq_getsetattr 267 #endif #ifndef __NR_waitid #define __NR_waitid 272 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 275 #define __NR_inotify_add_watch 276 #define __NR_inotify_rm_watch 277 #endif #ifndef __NR_pselect6 #define __NR_pselect6 280 #define __NR_ppoll 281 #endif #ifndef __NR_unshare #define __NR_unshare 282 #endif #ifndef __NR_splice #define __NR_splice 283 #endif #ifndef __NR_tee #define __NR_tee 284 #endif #ifndef __NR_vmsplice #define __NR_vmsplice 285 #endif #ifndef __NR_openat #define __NR_openat 286 #define __NR_mkdirat 287 #define __NR_mknodat 288 #define __NR_fchownat 289 #define __NR_futimesat 290 #define __NR_fstatat64 291 #define __NR_unlinkat 292 #define __NR_renameat 293 #define __NR_linkat 294 #define __NR_symlinkat 295 #define __NR_readlinkat 296 #define __NR_fchmodat 297 #define __NR_faccessat 298 #endif %endif %ifarch ppc64 #ifndef __NR_utimes #define __NR_utimes 251 #endif #ifndef __NR_mq_open #define __NR_mq_open 262 #define __NR_mq_unlink 263 #define __NR_mq_timedsend 264 #define __NR_mq_timedreceive 265 #define __NR_mq_notify 266 #define __NR_mq_getsetattr 267 #endif #ifndef __NR_waitid #define __NR_waitid 272 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 275 #define __NR_inotify_add_watch 276 #define __NR_inotify_rm_watch 277 #endif #ifndef __NR_pselect6 #define __NR_pselect6 280 #define __NR_ppoll 281 #endif #ifndef __NR_unshare #define __NR_unshare 282 #endif #ifndef __NR_splice #define __NR_splice 283 #endif #ifndef __NR_tee #define __NR_tee 284 #endif #ifndef __NR_vmsplice #define __NR_vmsplice 285 #endif #ifndef __NR_openat #define __NR_openat 286 #define __NR_mkdirat 287 #define __NR_mknodat 288 #define __NR_fchownat 289 #define __NR_futimesat 290 #define __NR_newfstatat 291 #define __NR_unlinkat 292 #define __NR_renameat 293 #define __NR_linkat 294 #define __NR_symlinkat 295 #define __NR_readlinkat 296 #define __NR_fchmodat 297 #define __NR_faccessat 298 #endif %endif %ifarch s390 #ifndef __NR_timer_create #define __NR_timer_create 254 #define __NR_timer_settime (__NR_timer_create+1) #define __NR_timer_gettime (__NR_timer_create+2) #define __NR_timer_getoverrun (__NR_timer_create+3) #define __NR_timer_delete (__NR_timer_create+4) #define __NR_clock_settime (__NR_timer_create+5) #define __NR_clock_gettime (__NR_timer_create+6) #define __NR_clock_getres (__NR_timer_create+7) #define __NR_clock_nanosleep (__NR_timer_create+8) #endif #ifndef __NR_fadvise64_64 #define __NR_fadvise64_64 264 #endif #ifndef __NR_statfs64 #define __NR_statfs64 265 #define __NR_fstatfs64 266 #endif #ifndef __NR_mq_open #define __NR_mq_open 271 #define __NR_mq_unlink 272 #define __NR_mq_timedsend 273 #define __NR_mq_timedreceive 274 #define __NR_mq_notify 275 #define __NR_mq_getsetattr 276 #endif #ifndef __NR_waitid #define __NR_waitid 281 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 284 #define __NR_inotify_add_watch 285 #define __NR_inotify_rm_watch 286 #endif #ifndef __NR_openat #define __NR_openat 288 #define __NR_mkdirat 289 #define __NR_mknodat 290 #define __NR_fchownat 291 #define __NR_futimesat 292 #define __NR_fstatat64 293 #define __NR_unlinkat 294 #define __NR_renameat 295 #define __NR_linkat 296 #define __NR_symlinkat 297 #define __NR_readlinkat 298 #define __NR_fchmodat 299 #define __NR_faccessat 300 #endif #ifndef __NR_pselect6 #define __NR_pselect6 301 #define __NR_ppoll 302 #endif #ifndef __NR_unshare #define __NR_unshare 303 #endif %endif %ifarch s390x #ifndef __NR_timer_create #define __NR_timer_create 254 #define __NR_timer_settime (__NR_timer_create+1) #define __NR_timer_gettime (__NR_timer_create+2) #define __NR_timer_getoverrun (__NR_timer_create+3) #define __NR_timer_delete (__NR_timer_create+4) #define __NR_clock_settime (__NR_timer_create+5) #define __NR_clock_gettime (__NR_timer_create+6) #define __NR_clock_getres (__NR_timer_create+7) #define __NR_clock_nanosleep (__NR_timer_create+8) #endif #ifndef __NR_mq_open #define __NR_mq_open 271 #define __NR_mq_unlink 272 #define __NR_mq_timedsend 273 #define __NR_mq_timedreceive 274 #define __NR_mq_notify 275 #define __NR_mq_getsetattr 276 #endif #ifndef __NR_waitid #define __NR_waitid 281 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 284 #define __NR_inotify_add_watch 285 #define __NR_inotify_rm_watch 286 #endif #ifndef __NR_openat #define __NR_openat 288 #define __NR_mkdirat 289 #define __NR_mknodat 290 #define __NR_fchownat 291 #define __NR_futimesat 292 #define __NR_newfstatat 293 #define __NR_unlinkat 294 #define __NR_renameat 295 #define __NR_linkat 296 #define __NR_symlinkat 297 #define __NR_readlinkat 298 #define __NR_fchmodat 299 #define __NR_faccessat 300 #endif #ifndef __NR_pselect6 #define __NR_pselect6 301 #define __NR_ppoll 302 #endif #ifndef __NR_unshare #define __NR_unshare 303 #endif %endif %ifarch sparc sparcv9 sparc64 #ifndef __NR_mq_open #define __NR_mq_open 273 #define __NR_mq_unlink 274 #define __NR_mq_timedsend 275 #define __NR_mq_timedreceive 276 #define __NR_mq_notify 277 #define __NR_mq_getsetattr 278 #endif #ifndef __NR_waitid #define __NR_waitid 279 #endif #ifndef __NR_stat64 #define __NR_fstat64 63 #define __NR_lstat64 132 #define __NR_stat64 139 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 151 #define __NR_inotify_add_watch 152 #define __NR_inotify_rm_watch 156 #endif #ifndef __NR_openat #define __NR_openat 284 #define __NR_mkdirat 285 #define __NR_mknodat 286 #define __NR_fchownat 287 #define __NR_futimesat 288 #define __NR_newfstatat 289 #define __NR_unlinkat 290 #define __NR_renameat 291 #define __NR_linkat 292 #define __NR_symlinkat 293 #define __NR_readlinkat 294 #define __NR_fchmodat 295 #define __NR_faccessat 296 #endif #ifndef __NR_pselect6 #define __NR_pselect6 297 #define __NR_ppoll 298 #endif #ifndef __NR_unshare #define __NR_unshare 299 #endif %endif %ifarch x86_64 #ifndef __NR_mq_open #define __NR_mq_open 240 #define __NR_mq_unlink 241 #define __NR_mq_timedsend 242 #define __NR_mq_timedreceive 243 #define __NR_mq_notify 244 #define __NR_mq_getsetattr 245 #endif #ifndef __NR_waitid #define __NR_waitid 247 #endif #ifndef __NR_inotify_init #define __NR_inotify_init 253 #define __NR_inotify_add_watch 254 #define __NR_inotify_rm_watch 255 #endif #ifndef __NR_openat #define __NR_openat 257 #define __NR_mkdirat 258 #define __NR_mknodat 259 #define __NR_fchownat 260 #define __NR_futimesat 261 #define __NR_newfstatat 262 #define __NR_unlinkat 263 #define __NR_renameat 264 #define __NR_linkat 265 #define __NR_symlinkat 266 #define __NR_readlinkat 267 #define __NR_fchmodat 268 #define __NR_faccessat 269 #endif #ifndef __NR_pselect6 #define __NR_pselect6 270 #define __NR_ppoll 271 #endif #ifndef __NR_unshare #define __NR_unshare 272 #endif #ifndef __NR_set_robust_list #define __NR_set_robust_list 273 #define __NR_get_robust_list 274 #endif #ifndef __NR_splice #define __NR_splice 275 #endif #ifndef __NR_tee #define __NR_tee 276 #endif #ifndef __NR_sync_file_range #define __NR_sync_file_range 277 #endif #ifndef __NR_vmsplice #define __NR_vmsplice 278 #endif %endif #endif EOF cat > override_headers/asm/errno.h < %ifarch alpha #ifndef ENOKEY #define ENOKEY 132 #define EKEYEXPIRED 133 #define EKEYREVOKED 134 #define EKEYREJECTED 135 #endif #ifndef EOWNERDEAD #define EOWNERDEAD 136 #define ENOTRECOVERABLE 137 #endif %endif %ifarch %{ix86} ia64 ppc ppc64 s390 s390x x86_64 #ifndef ENOKEY #define ENOKEY 126 #define EKEYEXPIRED 127 #define EKEYREVOKED 128 #define EKEYREJECTED 129 #endif #ifndef EOWNERDEAD #define EOWNERDEAD 130 #define ENOTRECOVERABLE 131 #endif %endif %ifarch sparc sparcv9 sparc64 #ifndef ENOKEY #define ENOKEY 128 #define EKEYEXPIRED 129 #define EKEYREVOKED 130 #define EKEYREJECTED 131 #endif #ifndef EOWNERDEAD #define EOWNERDEAD 132 #define ENOTRECOVERABLE 133 #endif %endif #endif EOF # A lot of programs still misuse memcpy when they have to use # memmove. The memcpy implementation below is not tolerant at # all. rm -f sysdeps/alpha/alphaev6/memcpy.S find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \; cat > find_provides.sh < check.log 2>&1 || : #echo ====================TESTING========================= #cat check.log #echo ====================TESTING END===================== mkdir -p %{?buildroot:%{buildroot}}%{_prefix}/%{target_name}/include mkdir -p %{?buildroot:%{buildroot}}%{_prefix}/%{target_name}/lib mkdir -p %{?buildroot:%{buildroot}}%{_libdir} mkdir -p %{?buildroot:%{buildroot}}%{_includedir} mkdir -p %{?buildroot:%{buildroot}}%{_mandir} mkdir -p %{?buildroot:%{buildroot}}%{_datadir} #for a in intl libiberty opcodes bfd binutils gas ld gprof etc; do #cd $a; make \ prefix=%{?buildroot:%{buildroot}}%{_prefix} \ exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \ bindir=%{?buildroot:%{buildroot}}%{_bindir} \ sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \ sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \ datadir=%{?buildroot:%{buildroot}}%{_datadir} \ includedir=%{?buildroot:%{buildroot}}%{_prefix}/%{target_name}/include \ libdir=%{?buildroot:%{buildroot}}%{_prefix}/%{target_name}/lib \ libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \ localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \ sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \ mandir=%{?buildroot:%{buildroot}}%{_mandir} \ infodir=%{?buildroot:%{buildroot}}%{_infodir} \ tooldir=%{?buildroot:%{buildroot}}%{_prefix}/%{target_name} \ install #cd ..; #done make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info gzip -q9f %{buildroot}%{_infodir}/*.info* make -C libiberty clean make CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty install -m 644 libiberty/libiberty.a %{buildroot}%{_prefix}/%{target_name}/lib install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/%{target_name}/include # Remove Windows/Novell only man pages rm -f %{buildroot}%{_mandir}/man1/{dlltool,nlmconv,windres}* /bin/rm -rf %{buildroot}%{_libdir} /bin/rm -rf %{buildroot}%{_datadir} /bin/rm -rf %{buildroot}%{_includedir} # Prevent programs to link against libbfd and libopcodes dynamically, # they are changing far too often #rm -f %{buildroot}%{_prefix}/%{_lib}/lib{bfd,opcodes}.so # Remove libtool files, which reference the .so libs #rm -f %{buildroot}%{_prefix}/%{_lib}/lib{bfd,opcodes}.la # This one comes from gcc rm -f %{buildroot}%{_infodir}/dir #rm -rf %{buildroot}%{_prefix}/%{target_name} #%ifarch %{ix86} x86_64 ppc ppc64 s390 s390x sparc sparc64 #sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include ~;}' \ #%ifarch %{ix86} x86_64 # -e 's/^#define BFD_ARCH_SIZE \(32\|64\) *$/#define BFD_ARCH_SIZE __WORDSIZE/' \ #%endif # -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \ # -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \ # -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\ ##define BFD_HOST_64_BIT long long\ ##else\ ##define BFD_HOST_64_BIT long\ ##endif/' \ # -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \ # %{buildroot}%{_prefix}/%{target_name}/include/bfd.h #%endif #touch -r ../bfd/bfd-in2.h %{buildroot}%{_prefix}/%{target_name}/include/bfd.h cd .. rm -f ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/c++filt rm -f ${RPM_BUILD_ROOT}%{_prefix}/bin/%{target_name}-c++filt cd .. %endif # to build gcc without glibc %if %{makegcc1} cd gcc-%{gcc_fver}-%{gcc_date} /bin/rm -rf obj-%{target_name} mkdir obj-%{target_name} cd obj-%{target_name} RPM_OPT_FLAGS="-O2"; export RPM_OPT_FLAGS CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS CXXFLAGS="$RPM_OPT_FLAGS"; export CXXFLAGS FFLAGS="$RPM_OPT_FLAGS"; export FFLAGS PATH=$RPM_BUILD_ROOT%{_prefix}/bin:$PATH ../configure --prefix=%{_prefix} \ --with-newlib --enable-shared --enable-languages=c \ --disable-libmudflap --disable-libssp --disable-libada --disable-libgomp \ --target=%{target_name} touch ../gcc/c-gperf.h PATH=$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make build_tooldir=$RPM_BUILD_ROOT%{_prefix}/%{target_name} PATH=$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make build_tooldir=$RPM_BUILD_ROOT%{_prefix}/%{target_name} -C %{target_name}/newlib/ crt1.o PATH=$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make prefix=$RPM_BUILD_ROOT%{_prefix} libdir=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib tooldir=$RPM_BUILD_ROOT%{_prefix}/%{target_name} libsubdir=$RPM_BUILD_ROOT%{_prefix}/lib/gcc/%{target_name}/%{gcc_ver} -e cpp_install_dir=lib/gcc/%{target_name}/%{gcc_ver} install install -m 644 %{target_name}/newlib/crt1.o %{buildroot}%{_prefix}/%{target_name}/lib $RPM_BUILD_ROOT%{_prefix}/bin/%{target_name}-gcc -dumpspecs | sed s/'lgcc$'/'lgcc -lc'/g > $RPM_BUILD_ROOT%{_prefix}/lib/gcc/%{target_name}/%{gcc_ver}/specs cd .. #mv gcc/config/arm/t-linux{,.noglibc} mv gcc/config/arm/t-linux-eabi{,.noglibc} #cp -a gcc/config/arm/t-linux{.orig,} cp -a gcc/config/arm/t-linux-eabi{.orig,} mv gcc/Makefile.in{,.noglibc} cp -a gcc/Makefile.in{.orig,} cd .. cp -a $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/libiberty.a{,.orig} /bin/rm -rf $RPM_BUILD_ROOT%{_prefix}/bin/{cpp,gcc,gcov} %endif # makegcc1 # to build glibc %if %{makeglibc} cd glibc-%{glibc_ver}-%{glibc_date} AddOns=`echo */configure | sed -e 's!/configure!!g;s!\(linuxthreads\|nptl\|rtkaio\|powerpc-cpu\)\( \|$\)!!g;s! \+$!!;s! !,!g;s!^!,!;/^,\*$/d'` targetcpu=`echo %{target_name} | cut -d- -f 1 | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.\*/arm/ -e s/sa110/arm/` if [ "$targetcpu" = "arm" ]; then AddOns=,ports$AddOns else AddOns=,rtkaio$AddOns fi rm -rf obj-%{target_name} mkdir obj-%{target_name} cd obj-%{target_name} glibcbuild=`gcc -dumpmachine` unset LD_LIBRARY_PATH || true CC=%{target_name}-gcc AR=%{target_name}-ar RANLIB=%{target_name}-ranlib PATH=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/bin:$RPM_BUILD_ROOT%{_prefix}/bin:$PATH ../configure --prefix=%{_prefix}/%{target_name} --exec-prefix=%{_prefix}/%{target_name} --datadir=%{_prefix}/%{target_name}/share --sysconfdir=/etc --localstatedir=/var --infodir=%{_infodir} --mandir=%{_mandir} --enable-add-ons=nptl$AddOns --enable-bind-now --with-tls --with-__thread --build=$glibcbuild --host=%{target_name} CC=%{target_name}-gcc AR=%{target_name}-ar RANLIB=%{target_name}-ranlib PATH=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/bin:$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make PARALLELMFLAGS=-s CC=%{target_name}-gcc AR=%{target_name}-ar RANLIB=%{target_name}-ranlib PATH=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/bin:$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make -j1 install_root=$RPM_BUILD_ROOT install PARALLELMFLAGS=-s ln -sf libbsd-compat.a %{buildroot}/%{_prefix}/%{target_name}/lib/libbsd.a cd .. cd .. %endif #makeglibc # to build gcc with glibc %if %{makegcc2} cd gcc-%{gcc_fver}-%{gcc_date} mkdir ../newlib-old mv newlib libgloss ../newlib-old/ /bin/rm -rf obj-%{target_name}2 mkdir obj-%{target_name}2 cd obj-%{target_name}2 RPM_OPT_FLAGS="-O2 -I$RPM_BUILD_ROOT%{_prefix}/%{target_name}/include"; export RPM_OPT_FLAGS CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS CXXFLAGS="$RPM_OPT_FLAGS"; export CXXFLAGS FFLAGS="$RPM_OPT_FLAGS"; export FFLAGS libsos="libc libpthread" for libso in $libsos; do mv $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so{,.orig} sed s@%{_prefix}@$RPM_BUILD_ROOT%{_prefix}@g < $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so.orig > $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so done ../configure --prefix=%{_prefix} \ --with-libs=%{_prefix}/%{target_name}/lib \ --enable-shared --enable-languages=c,c++ \ --includedir=%{_prefix}/%{target_name}/include \ --datadir=%{_prefix}/%{target_name}/share \ --with-gxx-include-dir=%{_prefix}/%{target_name}/include/c++/%{gcc_ver} \ --target=%{target_name} touch ../gcc/c-gperf.h PATH=$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make build_tooldir=$RPM_BUILD_ROOT%{_prefix}/%{target_name} PATH=$RPM_BUILD_ROOT%{_prefix}/bin:$PATH make prefix=$RPM_BUILD_ROOT%{_prefix} includedir=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/include datadir=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/share libdir=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib tooldir=$RPM_BUILD_ROOT%{_prefix}/%{target_name} libsubdir=$RPM_BUILD_ROOT%{_prefix}/lib/gcc/%{target_name}/%{gcc_ver} gxx_include_dir=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/include/c++/%{gcc_ver} -e cpp_install_dir=lib/gcc/%{target_name}/%{gcc_ver} install for libso in $libsos; do mv -f $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so{.orig,} done mv -f $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/libiberty.a{.orig,} %endif %install RPM_BUILD_ROOT2=${RPM_BUILD_ROOT}2 targetcpu=`echo %{target_name} | cut -d- -f 1 | sed -e s/i.86/386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` cd Xce-%{version} mkdir -p $RPM_BUILD_ROOT2%{_prefix}/%{target_name}/{bin,include,lib,libexec,sbin} mkdir -p $RPM_BUILD_ROOT2%{_prefix}/{bin,lib/gcc,libexec/gcc} find $RPM_BUILD_ROOT2 -type d > files-0-base-dir cd linux-%{kversion} cp -a include/asm-generic $RPM_BUILD_ROOT2%{_prefix}/%{target_name}/include/ cp -a include/asm-${targetcpu} $RPM_BUILD_ROOT2%{_prefix}/%{target_name}/include/ cp -a include/asm $RPM_BUILD_ROOT%{_prefix}/%{target_name}/sys-include/ cp -a include/linux $RPM_BUILD_ROOT2%{_prefix}/%{target_name}/include/ cd .. find $RPM_BUILD_ROOT2 -type d > files-1-header-dir find $RPM_BUILD_ROOT2 -type f > files-1-header-file find $RPM_BUILD_ROOT2 -type l >> files-1-header-file %if %{makebinutils} cd binutils-%{binutils_ver}/obj-%{target_name} make prefix=$RPM_BUILD_ROOT2%{_prefix} exec_prefix=$RPM_BUILD_ROOT2%{_prefix} bindir=$RPM_BUILD_ROOT2%{_bindir} sbindir=$RPM_BUILD_ROOT2%{_sbindir} sysconfdir=$RPM_BUILD_ROOT2%{_sysconfdir} datadir=$RPM_BUILD_ROOT2%{_datadir} includedir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name}/include libdir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name}/lib libexecdir=$RPM_BUILD_ROOT2%{_libexecdir} localstatedir=$RPM_BUILD_ROOT2%{_localstatedir} sharedstatedir=$RPM_BUILD_ROOT2%{_sharedstatedir} mandir=$RPM_BUILD_ROOT2%{_mandir} infodir=$RPM_BUILD_ROOT2%{_infodir} tooldir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name} install /bin/rm -rf $RPM_BUILD_ROOT2%{_prefix}/{info,man} /bin/rm -rf $RPM_BUILD_ROOT2%{_prefix}/share cd ../.. find $RPM_BUILD_ROOT2 -type d > files-2-binutils-dir find $RPM_BUILD_ROOT2 -type f > files-2-binutils-file find $RPM_BUILD_ROOT2 -type l >> files-2-binutils-file %endif #makebinutils %if %{makeglibc} cd glibc-%{glibc_ver}-%{glibc_date}/obj-%{target_name} cd ../../glibc-2.5-20061008T1257/obj-%{target_name}/ CC=%{target_name}-gcc AR=%{target_name}-ar RANLIB=%{target_name}-ranlib PATH=$RPM_BUILD_ROOT%{_prefix}/%{target_name}/bin:$RPM_BUILD_ROOT/usr/bin:$PATH make -j1 install_root=$RPM_BUILD_ROOT2 install PARALLELMFLAGS=-s /bin/rm -rf $RPM_BUILD_ROOT2%{_prefix}/{info,man} /bin/rm -rf $RPM_BUILD_ROOT2%{_prefix}/share ln -sf libbsd-compat.a $RPM_BUILD_ROOT2%{_prefix}/%{target_name}/lib/libbsd.a /bin/rm -rf $RPM_BUILD_ROOT2%{_sysconfdir} cd ../.. find $RPM_BUILD_ROOT2 -type d > files-3-glibc-dir find $RPM_BUILD_ROOT2 -type f > files-3-glibc-file find $RPM_BUILD_ROOT2 -type l >> files-3-glibc-file %endif #makeglibc %if %{makegcc2} cd gcc-%{gcc_fver}-%{gcc_date}/obj-%{target_name}2 libsos="libc libpthread" for libso in $libsos; do mv $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so{,.orig} sed s@%{_prefix}@$RPM_BUILD_ROOT%{_prefix}@g < $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so.orig > $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so done PATH=$RPM_BUILD_ROOT/usr/bin:$PATH make prefix=$RPM_BUILD_ROOT2/usr includedir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name}/include datadir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name}/share libdir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name}/lib tooldir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name} libsubdir=$RPM_BUILD_ROOT2%{_prefix}/lib/gcc/%{target_name}/%{gcc_ver} gxx_include_dir=$RPM_BUILD_ROOT2%{_prefix}/%{target_name}/include/c++/%{gcc_ver} -e cpp_install_dir=lib/gcc/%{target_name}/%{gcc_ver} install for libso in $libsos; do mv -f $RPM_BUILD_ROOT%{_prefix}/%{target_name}/lib/$libso.so{.orig,} done /bin/rm -rf $RPM_BUILD_ROOT2%{_prefix}/{info,man} /bin/rm -rf $RPM_BUILD_ROOT2%{_prefix}/share cd ../.. find $RPM_BUILD_ROOT2 -type d > files-4-gcc-dir find $RPM_BUILD_ROOT2 -type f > files-4-gcc-file find $RPM_BUILD_ROOT2 -type l >> files-4-gcc-file %endif #makegcc2 mv $RPM_BUILD_ROOT{,.old} mv $RPM_BUILD_ROOT{2,} %if %{makebinutils} for a in ar as ld nm objdump ranlib strip; do \ /bin/rm -f ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/$a ; \ ln -sf ../../bin/%{target_name}-$a ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/$a ; \ done %endif #makebinutils %if %{makegcc2} for a in g++ gcc; do \ /bin/rm -f ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/$a ; \ ln -sf ../../bin/%{target_name}-$a ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/$a ; \ done /bin/rm -f ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/cc ln -sf gcc ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/cc /bin/rm -f ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/c++ ln -sf g++ ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/c++ /bin/rm -f ${RPM_BUILD_ROOT}%{_prefix}/bin/%{target_name}-c++ ln -sf %{target_name}-g++ ${RPM_BUILD_ROOT}%{_prefix}/bin/%{target_name}-c++ /bin/rm -f ${RPM_BUILD_ROOT}%{_prefix}/bin/%{target_name}-cc ln -sf %{target_name}-gcc ${RPM_BUILD_ROOT}%{_prefix}/bin/%{target_name}-cc #cp -a ${RPM_BUILD_ROOT}%{_prefix}/include/g++-3/* ${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/%{target_name}/%{gcc_ver}/include/ %endif #makegcc2 #file ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/lib/*.so* | sed s/%{target_name}/CROSS_TARGET/g | grep -e 'not stripped' | grep -i -e $targetcpu | cut -d : -f 1 | sed s/CROSS_TARGET/%{target_name}/g > targetobjfiles #file ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/* | sed s/%{target_name}/CROSS_TARGET/g | grep -e 'not stripped' | grep -i -e $targetcpu | cut -d : -f 1 | sed s/CROSS_TARGET/%{target_name}/g >> targetobjfiles #${RPM_BUILD_ROOT}%{_prefix}/bin/%{target_name}-strip `cat targetobjfiles` file ${RPM_BUILD_ROOT}%{_prefix}/%{target_name}/bin/* | sed s/%{target_name}/CROSS_TARGET/g | grep -e 'not stripped' | grep -e 386 | cut -d : -f 1 | sed s/CROSS_TARGET/%{target_name}/g > i386objfiles file ${RPM_BUILD_ROOT}%{_prefix}/bin/* | grep -e 'not stripped' | grep -e 386 | cut -d : -f 1 >> i386objfiles strip `cat i386objfiles` || true %if %{makegcc2} diff files-3-glibc-dir files-4-gcc-dir | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@'%dir '@g > files-4-gcc diff files-3-glibc-file files-4-gcc-file | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@''@g | sort >> files-4-gcc %endif %if %{makeglibc} diff files-2-binutils-dir files-3-glibc-dir | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@'%dir '@g > files-3-glibc diff files-2-binutils-file files-3-glibc-file | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@''@g | sort >> files-3-glibc %endif %if %{makebinutils} diff files-1-header-dir files-2-binutils-dir | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@'%dir '@g > files-2-binutils diff files-1-header-file files-2-binutils-file | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@''@g | sort >> files-2-binutils %endif diff files-0-base-dir files-1-header-dir | grep '^>' | sed s@'> '${RPM_BUILD_ROOT2}@'%dir '@g > files-1-headers cat files-1-header-file | sed s@${RPM_BUILD_ROOT2}@''@g | sort >> files-1-headers cat files-0-base-dir | grep %{target_name} | sed s@${RPM_BUILD_ROOT2}@'%dir '@g > files-0-base cd .. %clean rm -rf ${RPM_BUILD_ROOT} rm -rf ${RPM_BUILD_ROOT}2 rm -rf ${RPM_BUILD_ROOT}.old %post %{target_name} echo %{_prefix}/%{target_name}/lib >> /etc/ld.so.conf /sbin/ldconfig %postun %{target_name} grep -v "%{_prefix}/%{target_name}/lib" /etc/ld.so.conf > /etc/ld.so.conf.new cat /etc/ld.so.conf.new > /etc/ld.so.conf rm -f /etc/ld.so.conf.new /sbin/ldconfig %files %{target_name} -f %{name}-%{version}/files-0-base %defattr(-,root,root) %files -n %{target_name}-kernel-headers-%{kversion} -f %{name}-%{version}/files-1-headers %defattr(-,root,root) %if %{makebinutils} %files -n %{target_name}-binutils-%{binutils_ver} -f %{name}-%{version}/files-2-binutils %defattr(-,root,root) %endif %if %{makeglibc} %files -n %{target_name}-glibc-%{glibc_ver} -f %{name}-%{version}/files-3-glibc %defattr(-,root,root) %endif %if %{makegcc2} %files -n %{target_name}-gcc-%{gcc_ver} -f %{name}-%{version}/files-4-gcc %defattr(-,root,root) %endif