wtarreau / bootterm

The terminal written for its users by its users
MIT License
215 stars 11 forks source link

makefile: macOS compatible install command #2

Closed JaCzekanski closed 3 years ago

JaCzekanski commented 3 years ago

make install fails on macOS due to a non-GNU version of install command.

jakub@jakub-mbp :: 23:43:56 :: ~/dev/heap/bootterm 
$ make
  CC      src/bt.o
  LD      bin/bt
rm src/bt.o
jakub@jakub-mbp :: 23:43:57 :: ~/dev/heap/bootterm 
$ make install
  STRIP   install-bins
  INSTALL install-bins
install: illegal option -- t
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install-bins] Error 64

Fix applied:

jakub@jakub-mbp :: 23:50:44 :: ~/dev/heap/bootterm 
$ make
  CC      src/bt.o
m  LD      bin/bt
rm src/bt.o
jakub@jakub-mbp :: 23:50:46 :: ~/dev/heap/bootterm 
$ make install
  STRIP   install-bins
  INSTALL install-bins

I hope this doesn't cause any issues on other *nix systems.

JaCzekanski commented 3 years ago

Using /sys/class/tty isn't compatible with macOS - as for now, I don't have any ideas about how to properly scan for serial devices. A naive approach is to just scan /dev for files starting with cu., but at least in my case, that includes unconnected serial devices like Bluetooth SPP endpoints.

wtarreau commented 3 years ago

Thanks, I don't think it should cause any issue. I think that install -t creates the target directory if it doesn't exist, but quite frankly this is not important. I'll take your patch.

Regarding auto-detection, of course /sys/class/* will not work on macos. One discovery method per OS is needed. I have already identified the use of sysctl() for freebsd. Could you please issue sysctl -a|grep ^dev on macos to see if it shares anything with freebsd just in case ?

wtarreau commented 3 years ago

By the way, regarding scanning /dev/cu* or /dev/tty*, it was in my original approach but I prefer to keep it as a last resort only, because I fear that just probing them by tring to open the devices will lead to errors or kernel messages on certain platforms.

wtarreau commented 3 years ago

Merged manually to remove a trailing space. Thanks!