Get architecture?

I’m probably missing something obvious, but is there a way for my script to find out if it is running on x86_gcc2h or x86_64?

Try to parse the uname output.
Get more Info about the available options with --help.

Thanks, I will.

I think there is something like this on besly.de descript but i does not found it so fast. I can check my beslysat app, it could that i have done this for it.

Try getarch.

EDIT: Scratch that, I misread the question.
uname seems to be the best option.

By checking the installed core packages. In my case, since I have a GCC2_Hybrid image, I have the haiku-r1~alpha4_pm_hrev51227-1-x86_gcc2.hpkg package. So the output of these commands:
find /boot/system/packages -name "*hrev*" | head -1 | cut -d'-' -f 4 | cut -f 1 -d '.'
Will give x86_gcc2 as result.

Info_GccVersion$=System$(“getarch”)

… doesn’t work on my system, because I have a lot of stuff in ‘administrative/’ that ‘find’ finds!

This, OTOH, works, and I think should do so generally:

ls /boot/system/packages/**hrev* | head -1 | cut -d'-' -f 4 | cut -f 1 -d '.'

1 Like

MACHINE=$(shell uname -m)
ifeq ($(MACHINE), BePC)
HAIKU = x86_gcc2h
else
HAIKU = x86_64
endif

Just curious…:slight_smile: What language is that? bash has no ‘ifeq’ keyword (nor ‘endif’), and doesn’t recognize – or need – ‘shell’ in that context (etc.).

Makefile, real life example, so please, use something like this instead of sed magic.

Ah, yes… I wasn’t thinking along those lines! Not sure where you’d use that in other than a Makefile, though. Got the impression that Michel was looking for something like a bash script. I tweaked to get it in that form:

MACHINE=$(uname -m) if [ $(MACHINE) = BePC ]; then HAIKU=x86_gcc2h else HAIKU=x86_64 fi
(Didn’t actually see any “sed magic” in the previous suggestions. :grinning:)

1 Like

On an x86_64 system:

~/Desktop> getarch
x86_64
~/Desktop>

on an x86_gcc2h system:

~/Desktop> getarch
x86_gcc2
~/Desktop>