freebsd.eclass change

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

freebsd.eclass change

Richard Yao
I want to add freebsd_get_cpuarch() to freebsd.eclass. This will give us
a platform-independent way of generating MACHINE_CPUARCH, which will
make building FreeBSD components on other platforms (i.e. Linux and
Prefix) easier.

--- freebsd.eclass.old  2012-07-01 19:15:56.157277000 -0400
+++ freebsd.eclass      2012-07-01 19:44:08.093698000 -0400
@@ -58,6 +58,24 @@ freebsd_get_bmake() {
        echo "${bmake}"
 }

+freebsd_get_cpuarch() {
+       local arch=$(uname -m)
+       case $(uname -m) in
+               x86_64)
+                       return 'amd64';;
+               arm*)
+                       return 'arm';;
+               i?86)
+                       return 'i386';;
+               ppc*)
+                       return 'powerpc';;
+               mips*)
+                       return 'mips';;
+               sparc*)
+                       return 'sparc';;
+               *)
+                       return arch;
+       esac
+}
+
 freebsd_do_patches() {
        if [[ ${#PATCHES[@]} -gt 1 ]] ; then
                for x in "${PATCHES[@]}"; do

Does anyone have any objections?


signature.asc (918 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: freebsd.eclass change

Javier Villavicencio-2
On 01/07/2012 20:48, Richard Yao wrote:

> I want to add freebsd_get_cpuarch() to freebsd.eclass. This will give us
> a platform-independent way of generating MACHINE_CPUARCH, which will
> make building FreeBSD components on other platforms (i.e. Linux and
> Prefix) easier.
>
> --- freebsd.eclass.old  2012-07-01 19:15:56.157277000 -0400
> +++ freebsd.eclass      2012-07-01 19:44:08.093698000 -0400
> @@ -58,6 +58,24 @@ freebsd_get_bmake() {
>          echo "${bmake}"
>   }
>
> +freebsd_get_cpuarch() {
> +       local arch=$(uname -m)
> +       case $(uname -m) in
> +               x86_64)
> +                       return 'amd64';;
> +               arm*)
> +                       return 'arm';;
> +               i?86)
> +                       return 'i386';;
> +               ppc*)
> +                       return 'powerpc';;
> +               mips*)
> +                       return 'mips';;
> +               sparc*)
> +                       return 'sparc';;
> +               *)
> +                       return arch;
> +       esac
> +}
> +
>   freebsd_do_patches() {
>          if [[ ${#PATCHES[@]} -gt 1 ]] ; then
>                  for x in "${PATCHES[@]}"; do
>
> Does anyone have any objections?
>

Wouldn't you want to echo '...' instead of return?
Last one should be return $arch;; btw.

And I think the tc-arch() function of toolchain-funcs.eclass is pretty
complete, what is it missing (besides powerpc that we may never support)?