Distributing engines for Mac/OSX

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Distributing engines for Mac/OSX

Post by JoshPettus »

hgm wrote: You can always pop up a dialog to apologize for startling him. :lol:
I do kind of want to see that. :lol:

I've been thinking about everything you guys said. I think .pkg installers to install linux style plugins is the way to go. That way we don't have multiple standards to maintain, if we don't need it. I'll try to make a generic package maker people can use to bundle their engines, but package maker is a little burried in XCode these days. Hopefully they haven't gotten rid of it..

There doesn't have to be any options to select. Options are optional. What will happen is the user downloads the .dmg, then clicks on the Engine.pkg program. First a dialog pops up asking for admin privlages. After that it opens, and they see a license. Click next, it shows the HardDrives which this can be installed where only the system disk is the possible option. Click next, you see a bar installing the engine and when it finishes it says installed successfully and you click done. That's all. No mess. And it will automatically work with any GUI supporting that style plugin.

Biggest concern is apple's rootless in 10.11 El Captian which makes it impossible to install files in system folders even as root. But I believe anything in the /usr/local folder is fair game, and is all we need correct?

Also is there documentation for the linux plugin I can look at?
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Distributing engines for Mac/OSX

Post by JoshPettus »

Turns out they did get rid of the GUI package builder, which is a shame.

Fortunately the commandline pkgbuild is still alive and well, and actually may be more ideal for our purposes. I can write a script which makes it simple for people wanting to bundle their engines

I can make the script ask for the various resources, executable, logo, manual, license to display at the beginning process, copy them, package them, and bundle them in a dmg image.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Distributing engines for Mac/OSX

Post by hgm »

If we are going to use a real installer, would it be possible to package several versions of an engine, compiled for different architectures, in the .dmg file, and then only install the one that fits the current architecture, preferably under a generic name. E.g. my Stockfish download for Windows contained

Stockfish-6-32.exe
Stockfish-6-64.exe
Stockfish-6-bmi2.exe
Stockfish-6-sse4.exe

It would have been nice if just a single Stockfish-6.exe (or on Linux/Mac just 'stockfish') would have resulted from the 'install'. We would not want the auto-install to register all these versions with XBoard, especially not those that could not run on the current machine.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Distributing engines for Mac/OSX

Post by JoshPettus »

Installers are great for that.

Almost all intel macs are 64bit, and the couple that aren't couldn't run 10.6 so I wouldn't worry about that. Unless you really want to run a 32 bit engine?

But regarding cpu features E.G. bmi2 and sse4, I suppose there might be a way to auto detect the cpu? We could even determine it by model. Or much easier would be to let the user choose. If they get it wrong and it doesn't work, they can reinstall. Who knows they may have a hakentosh.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Distributing engines for Mac/OSX

Post by hgm »

Having the user decide is exactly what the installer is supposed to avoid. The average computer user would have no idea what sse4.1 means...

On Linux I can look in the /proc/cpuinfo file to get the capabilities of the CPU. Like

Code: Select all

hgm@hgm-xboard:~$ cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz
stepping	: 9
cpu MHz		: 2217.568
cache size	: 6144 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 5
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good pni monitor ssse3 lahf_lm
bogomips	: 4435.13
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

hgm@hgm-xboard:~$ 
cat /proc/cpuinfo | grep flags

would print the relevant line. (Strange enough there doesn't seem to be any explicit info on whether the CPU is 32-bit or 64-bit. But the 'arch' command can tell you that.)

If the installer can run arbitrary shell scripts as part of the install, I suppose we could put a conditional rename based on occurrence of the required feature in the flags line. And then delete all the original names.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Distributing engines for Mac/OSX

Post by JoshPettus »

Fair enough, for OSX I can get cpu features with

Code: Select all

sysctl -a | grep machdep.cpu.features
oddly enough arch tells me my cpu is
i386 which of course if false
stevenaaus
Posts: 608
Joined: Wed Oct 13, 2010 9:44 am
Location: Australia

Re: Distributing engines for Mac/OSX

Post by stevenaaus »

Maybe you are running 10.6 ? It in fact has some funny 32 bit kernel with support for running 64 bit apps.
Almost all intel macs are 64bit, and the couple that aren't couldn't run 10.6 so I wouldn't worry about that. Unless you really want to run a 32 bit engine?

All Intel Macs can run 10.6. Wiki -
Snow Leopard is the last release of Mac OS X to support the 32-bit Intel Core Solo and Intel Core Duo CPUs
.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Distributing engines for Mac/OSX

Post by JoshPettus »

ah it was 10.7 that was the cut off. Still only the very first model intel macs were 32bit. That I know.

As to my OS. No it's 10.11 and my cpu is a 5 year old i7 duo. 2.8 Ghtz