alexmyczko / fnt

apt for fonts, the missing font manager for macOS/linux
Other
489 stars 20 forks source link

errors and documentation re dependencies #24

Closed CouldBeThis closed 2 months ago

CouldBeThis commented 2 years ago

I have been working at installing this because it looks great. :) There was no compatible package available so I downloaded the release v 1.4.1.

First issue is that the suggested make install results in this:

if test ! -d //usr/bin ; then mkdir -p //usr/bin ; fi
install -m 755 fnt //usr/bin/
install: cannot create regular file '//usr/bin/fnt': Permission denied
makefile:11: recipe for target 'install' failed
make: *** [install] Error 1

Which I guessed correctly meant that sudo was required. Perhaps either the error or the instructions could be clarified. So sudo make install whose output was also confusing:

if test ! -d //usr/bin ; then mkdir -p //usr/bin ; fi
install -m 755 fnt //usr/bin/
if test ! -d //usr/share/man/man1 ; then mkdir -p //usr/share/man/man1; fi
install -c -m 644 fnt.1 //usr/share/man/man1/ ; gzip -9 //usr/share/man/man1/fnt.1
if test ! -d //usr/local/share/zsh/site-functions ; then mkdir -p //usr/local/share/zsh/site-functions ; fi
install -m 755 completions/_fnt //usr/local/share/zsh/site-functions/

successful? not? easy to find out by running fnt which alerted that there are unmet dependencies:

chafa not found, please use apt to install it.

So I went to find this package chafa, which was not available via apt. On the developer's page there are instructions on how to add the ppa so I am guessing many people would not find it available by default. But installed it one way or another.

then tried running fnt

otfinfo not found, please use apt to install it.

I was able to find how to install otfinfo only as part of the package lcdf-typetools; not sure if it is available independently. The latter was available via apt while otfinfo itself was not.

I think it is traditional for dependencies to be checked during install rather than afterwards, when the program is run? Not sure if the output of make was something to do with that.

Assuming you do not want to get extremely complicated with figuring out what exactly version of OS each user is running and providing precise instructions, I don't know but maybe something like these would be helpful error messages instead:

Required package chafa not found, please consult https://hpjansson.org/chafa for install instructions.
Required package otfinfo not found, please use apt or your preferred package manager to install the parent package lcdf-typetools or consult https://www.lcdf.org/type/ for further information.

Also when I was poking around in fnt I noticed something about the the error dispayed if brew is not found on Mac.

If I am reading correctly, it looks like the error if brew is not installed would be instructions to use brew to install it. If the case, I would suggest the following instead

Required package brew not found, please consult https://brew.sh/ for further install instructions.

I am not a programmer but I did search the repo to find code about the dependencies. I think the relevant bit is here. Based on that, here is a draft/suggestion of what could reasonably included in the readme or some ancillary location for dependencies.

Dependencies

Mac

Linux

  • curl - should be installed by default
    • available via apt if needed sudo apt install curl
  • chafa - see website for install options
  • otfinfo
    • packaged with with lcdf-typetools which is likely available via sudo apt install lcdf-typetools or your preferred package manager; consult website for install options

FreeBSD

Haiku OS

Windows

  • cmd.exe

OR

  • No outside dependencies

I included explicit instructions for Mac and Linux which are the two systems I am familiar with (Mac more than the 1000 variations of Linux).


I am happy to make a PR for the readme if you are amenable to this. As I mentioned I am not a programmer or anything so if there is a bunch of requirements to setting up a development environment it is unlikely to be worth the time. If it's just textfiles and git I can do it. I'm not capable of making a PR for the error messages because they require coding.

Or you can handle it whatever way works for you, edit, discard etc.

alexmyczko commented 2 years ago

well the point is for macOS it is in brew officially, same with debian and what is based on it as well as freebsd... but thank you for your detailed report.

make install is always run as root, and sudo is not something everyone has. this is pretty standard.