Added pentium4 arch support (Raorn, #5259)

This commit is contained in:
Дмитрий Левин 2004-10-31 19:08:39 +00:00
parent 1118314978
commit 65aaf3b23d
6 changed files with 63 additions and 46 deletions

View File

@ -140,7 +140,8 @@ install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i486 ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i586 ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i686 ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/athlon ;;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/athlon ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/pentium4 ;;\
alpha*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/alpha ;\
$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/alphaev6 ;;\
sparc*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc ;\

View File

@ -35,7 +35,7 @@ rm -f ${DESTDIR}/${pkglibdir}/noarch-${OS}
ln -s ${arch}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/noarch-${OS}
case "$arch" in
i[3456]86|k6|athlon) SUBSTS='s_\(i[3456]86\|k6\|athlon\)_i386_ s_\(i[3456]86\|k6\|athlon\)_i486_ s_\(i[3456]86\|k6\|athlon\)_i586_ s_\(i[3456]86\|k6\|athlon\)_i686_ s_\(i[3456]86\|k6\|athlon\)_k6_ s_\(i[3456]86\|k6\|athlon\)_athlon_' ;;
i[3456]86|k6|athlon|pentium4) SUBSTS='s_\(i[3456]86\|k6\|athlon\|pentium4\)_i386_ s_\(i[3456]86\|k6\|athlon\|pentium4\)_i486_ s_\(i[3456]86\|k6\|athlon\|pentium4\)_i586_ s_\(i[3456]86\|k6\|athlon\|pentium4\)_i686_ s_\(i[3456]86\|k6\|athlon\|pentium4\)_k6_ s_\(i[3456]86\|k6\|athlon\|pentium4\)_athlon_ s_\(i[3456]86\|k6\|athlon\|pentium4\)_pentium4_' ;;
alpha*) SUBSTS='s_alpha_alpha_ s_alpha_alphaev5_ s_alpha_alphaev56_ s_alpha_alphapca56_ s_alpha_alphaev6_ s_alpha_alphaev67_' ;;
sparc*) SUBSTS='s_sparc\(64\|v9\)_sparc_ s_sparc64_sparcv9_;s_sparc\([^v]\|$\)_sparcv9\1_ s_sparcv9_sparc64_;s_sparc\([^6]\|$\)_sparc64\1_' ;;
powerpc*|ppc*) SUBSTS='s_ppc64_ppc_ s_ppc\([^6]\|$\)_ppc64\1_' ;;

View File

@ -467,13 +467,13 @@ static void setVarDefault(int var, const char * macroname, const char * val,
addMacro(NULL, macroname, NULL, body, RMIL_DEFAULT);
}
static void setVar( const char *macroname, const char *body )
static void setVar(const char *macroname, const char *body)
/*@globals rpmGlobalMacroContext,
internalState @*/
/*@modifies internalState @*/
{
if ( macroname && body )
addMacro( NULL, macroname, NULL, body, RMIL_DEFAULT );
if (macroname && body)
addMacro (NULL, macroname, NULL, body, RMIL_DEFAULT);
}
/*@observer@*/ /*@unchecked@*/
@ -499,33 +499,34 @@ static void rpmSetDefaults(void)
internalState @*/
/*@modifies internalState @*/
{
if ( defaultsInitialized )
if (defaultsInitialized)
return;
else
{
setVar( "_usr", "/usr" );
setVar( "_var", "/var" );
setVar( "_preScriptEnvironment", prescriptenviron );
setVar ("_usr", "/usr");
setVar ("_var", "/var");
setVar ("_preScriptEnvironment", prescriptenviron);
setVar( "_topdir", "%{_usr}/src/RPM" );
setVar( "_tmppath", "%{_var}/tmp" );
setVar( "_dbpath", "%{_var}/lib/rpm" );
setVar( "_defaultdocdir", "%{_usr}/share/doc" );
setVar ("_topdir", "%{_usr}/src/RPM");
setVar ("_tmppath", "%{_var}/tmp");
setVar ("_dbpath", "%{_var}/lib/rpm");
setVar ("_defaultdocdir", "%{_usr}/share/doc");
setVar( "_rpmfilename", "%%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" );
setVar ("_rpmfilename",
"%%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm");
setVar( "_signature", "none" );
setVar( "_buildshell", "/bin/sh" );
setVar ("_signature", "none");
setVar ("_buildshell", "/bin/sh");
setVar( "_topsrcdir", "%{_topdir}" );
setVar( "_builddir", "%{_topdir}/BUILD" );
setVar( "_rpmdir", "%{_topdir}/RPMS" );
setVar( "_srcrpmdir", "%{_topdir}/SRPMS" );
setVar( "_sourcedir", "%{_topsrcdir}/SOURCES" );
setVar( "_specdir", "%{_topsrcdir}/SPECS" );
setVar ("_topsrcdir", "%{_topdir}");
setVar ("_builddir", "%{_topdir}/BUILD");
setVar ("_rpmdir", "%{_topdir}/RPMS");
setVar ("_srcrpmdir", "%{_topdir}/SRPMS");
setVar ("_sourcedir", "%{_topsrcdir}/SOURCES");
setVar ("_specdir", "%{_topsrcdir}/SPECS");
setVarDefault (RPMVAR_OPTFLAGS, "optflags", "-O2", NULL);
setVarDefault( RPMVAR_OPTFLAGS, "optflags", "-O2", NULL );
defaultsInitialized = 1;
}
}
@ -1031,29 +1032,37 @@ static void mfspr_ill(int notused)
}
#endif
static const char *checkAMD( void )
static const char *
checkCPU (void)
{
int fd = open( "/proc/cpuinfo", O_RDONLY );
if ( !fd )
int fd = open ("/proc/cpuinfo", O_RDONLY);
if (!fd)
return 0;
else
{
char buffer[ 1 + getpagesize() ];
char buffer[1 + getpagesize ()];
memset( buffer, 0, sizeof buffer );
read( fd, buffer, sizeof buffer - 1 );
close( fd );
memset (buffer, 0, sizeof buffer);
read (fd, buffer, sizeof buffer - 1);
close (fd);
if ( !strstr( buffer, "AMD" ) )
if (strstr (buffer, "AMD"))
{
if (strstr (buffer, "Athlon")
|| strstr (buffer, "Duron"))
return "athlon";
if (strstr (buffer, "K6"))
return "k6";
} else if (strstr (buffer, "Intel"))
{
if (strstr (buffer, "Pentium(R) 4")
|| strstr (buffer, "Intel(R) Xeon(TM)")
|| strstr (buffer, "Intel(R) XEON(TM)"))
return "pentium4";
} else
return 0;
if ( strstr( buffer, "Athlon" ) || strstr( buffer, "Duron" ) )
return "athlon";
if ( strstr( buffer, "K6" ) )
return "k6";
return 0;
}
}
@ -1288,11 +1297,12 @@ static void defaultMachine(/*@out@*/ const char ** arch,
}
#endif
if ( !strcmp( un.machine, "i586" ) || !strcmp( un.machine, "i686" ) )
if (!strcmp (un.machine, "i586") || !strcmp (un.machine, "i686"))
{
const char *amd = checkAMD();
if ( amd )
strcpy( un.machine, amd );
const char *cpu = checkCPU ();
if (cpu)
strcpy (un.machine, cpu);
}
# endif

View File

@ -812,7 +812,7 @@
# rpm can use regular expressions against target platforms in macro
# conditionals.
#
%intel i386 i486 i586 i686 i786 i886 i986
%intel i386 i486 i586 i686 i786 i886 i986 pentium4
%amd k6 athlon
%ix86 %intel %amd

View File

@ -355,9 +355,10 @@ fi
%attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmpopt*
%attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmrc
%ifarch i386 i486 i586 i686 athlon
%ifarch i386 i486 i586 i686 athlon pentium4
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/i[3456]86*
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/athlon*
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/pentium4*
%endif
%ifarch alpha alphaev5 alphaev56 alphapca56 alphaev6 alphaev67
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/alpha*

View File

@ -17,6 +17,7 @@ optflags: i586 %optflags_default -march=i586 -mcpu=i686
optflags: i686 %optflags_default -march=i686
optflags: k6 %optflags_default -march=k6
optflags: athlon %optflags_default -march=athlon
optflags: pentium4 %optflags_default -march=pentium4
optflags: ia64 %optflags_default
# XXX Please note that -mieee has been added in rpm-3.0.5.
@ -67,6 +68,7 @@ optflags: s390x -O2
#############################################################
# Canonical arch names and numbers
arch_canon: pentium4: pentium4 1
arch_canon: athlon: athlon 1
arch_canon: i686: i686 1
arch_canon: k6: k6 1
@ -164,6 +166,7 @@ buildarchtranslate: osfmach3_i386: i386
buildarchtranslate: ia64: ia64
buildarchtranslate: pentium4: pentium4
buildarchtranslate: athlon: athlon
buildarchtranslate: i686: i686
buildarchtranslate: k6: k6
@ -210,6 +213,7 @@ arch_compat: alphaev56: alphaev5
arch_compat: alphaev5: alpha
arch_compat: alpha: axp noarch
arch_compat: pentium4: i686
arch_compat: athlon: i686 k6
arch_compat: i686: i586
arch_compat: k6: i586
@ -297,6 +301,7 @@ os_compat: bsdi4.0: bsdi
buildarch_compat: ia64: noarch
buildarch_compat: pentium4: i686
buildarch_compat: athlon: i686 k6
buildarch_compat: i686: i586
buildarch_compat: k6: i586