You are not logged in.

#26 2020-11-03 14:24:04

loqs
Member
Registered: 2014-03-06
Posts: 12,134

Re: [Request] Atkinson Hyperlegible Font

PKGBUILD is guaranteed to be executed by bash because makepkg itself is executed by #!/usr/bin/bash.  bash is a dependency of pacman which is in base-devel.
Numerous variables in PKGBUILD are arrays such as license,  source,  checksum,  arch,  depends and options.

Offline

#27 2020-11-03 18:06:10

MountainX
Member
Registered: 2016-02-08
Posts: 286

Re: [Request] Atkinson Hyperlegible Font

nstickney wrote:

@MountainX, would you like to Co-Maintain the package?

Yes, as long as you don't object to the fact that I'm inexperienced. It will be a good learning experience for me. Thank you.


nstickney wrote:
MountainX wrote:

Here is the final PKGBUILD we came up with (thanks to the help above):

  ...
  local _typeface=(Bold BoldItalic Italic Regular)
  for _font in "${_typeface[@]}" 
  ...
}

Using arrays is a Bashism, and bash isn't in base-devel.

Why not just this?

for _font in $_pkgname-*-${pkgver/./}.otf

I would not object to something like that, but it has to be a little more complex. It would have to do case-insensitive matching on the file names, for example.

I'm also OK with something similar to what you used in your PKGBUILD or what I used in the version I tested locally.

Your version installs both OTF and TTF, but doesn't remove the version number from the installed files (which I think it should). Also, the package version should be 1.02, not 1.

pkgver=1
package() {
	mkdir -p "$pkgdir"/usr/share/fonts/{TTF,OTF}
	install -D -m0644 "$srcdir"/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/"Print Fonts"/*.otf "$pkgdir"/usr/share/fonts/OTF/
	install -D -m0644 "$srcdir"/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/"Web Fonts"/TTF/*.ttf "$pkgdir"/usr/share/fonts/TTF/
}

I had a version that only installed OTF fonts, but did clean up the installed filenames, and I didn't use a loop at all:

pkgver=1.02
package() {
  install -dm 755 "${pkgdir}/usr/share/fonts/OTF"
  cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514"/'Print Fonts'
  install -m 644 Atkinson-Hyperlegible-Bold-${pkgver/./}.otf "${pkgdir}/usr/share/fonts/OTF/Atkinson-Hyperlegible-Bold.otf"
  install -m 644 Atkinson-Hyperlegible-BoldItalic-${pkgver/./}.otf "${pkgdir}/usr/share/fonts/OTF/Atkinson-Hyperlegible-BoldItalic.otf"
  install -m 644 Atkinson-Hyperlegible-Italic-${pkgver/./}.otf "${pkgdir}/usr/share/fonts/OTF/Atkinson-Hyperlegible-Italic.otf"
  install -m 644 Atkinson-Hyperlegible-Regular-${pkgver/./}.otf "${pkgdir}/usr/share/fonts/OTF/Atkinson-Hyperlegible-Regular.otf"
  install -dm 755 "${pkgdir}/usr/share/licenses/$pkgname"
  install  -m 644 "${srcdir}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

I think it might be better to install both TTF and OTF versions, although I will personally only use OTF.

I'm OK with whatever those of you with more experience recommend. I'll test the preferred PKGBUILD in a chroot env.

Offline

#28 2020-11-03 19:09:13

MountainX
Member
Registered: 2016-02-08
Posts: 286

Re: [Request] Atkinson Hyperlegible Font

I can't get case-insensitive matching to work with this, but otherwise it might be suitable if we want code that is more generic.

EDIT: I do have a version that works around the file name casing issue. I have done a little testing so far and it looks like it is working.

# Maintainer: Stick <stick@stma.is>

pkgname=atkinson-hyperlegible
pkgver=1.02
pkgrel=1
pkgdesc='font that is easier to read across the entire visual-ability spectrum. Focuses on letterform distinction.'
arch=('any')
url='https://www.brailleinstitute.org/freefont'
license=('custom')
source=("https://www.brailleinstitute.org/wp-content/uploads/atkinson-hyperlegible-font/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514.zip" LICENSE)
md5sums=('8b01675977bd6228cb7352af67b9a160'
         'de83b41a6fe51ec631930f34459574f3')
sha256sum=('9e1a65d53ddadc8253791e958a07bf5aba210ef6155ea9c91b2b4c46bbce53e3'
          '3fef2367bc4803bef3c06adad5f05f59305612009fee07a92bb6b574ad5e5974')

package() {

  _fver=${pkgver/./};

  install -dm 755 "${pkgdir}/usr/share/fonts/OTF"; 
  install -dm 755 "${pkgdir}/usr/share/fonts/TTF";

  for _dir in 'Print Fonts' 'Web Fonts/TTF'; do 
    cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/$_dir"; 
    for _font in *.?tf;  do 
      _family=${_font/Atkinson-Hyperlegible-/}; 
      _family=${_family/-$_fver.?tf/}; 
      _ext="${_font##*.}";
      _EXT="${_ext^^}";
      install -m 644 $_font "${pkgdir}/usr/share/fonts/$_EXT/$pkgname-$_family.$_ext"; 
    done; 
  done;

  install -dm 755 "${pkgdir}/usr/share/licenses/$pkgname";
  install  -m 644 "${srcdir}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE";
}

Not sure this generic approach is any better than simply hard coding the file names as in a post above. Opinions?

One other thing. If we change the pkgname as follows, the "-fonts" has to be stripped off in the package() function:

pkgname=atkinson-hyperlegible-fonts
_pkgname=${pkgname/-fonts/}

Then use "$_pkgname" inside the package() function.

Last edited by MountainX (2020-11-03 21:03:01)

Offline

#29 2020-11-03 21:12:49

MountainX
Member
Registered: 2016-02-08
Posts: 286

Re: [Request] Atkinson Hyperlegible Font

I tested this PKGBUILD:

# Maintainer: Stick <stick@stma.is>

pkgname=atkinson-hyperlegible-fonts
pkgver=1.02
pkgrel=1
pkgdesc='font that is easier to read across the entire visual-ability spectrum. Focuses on letterform distinction.'
arch=('any')
url='https://www.brailleinstitute.org/freefont'
license=('custom')
source=("https://www.brailleinstitute.org/wp-content/uploads/atkinson-hyperlegible-font/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514.zip" LICENSE)
md5sums=('8b01675977bd6228cb7352af67b9a160'
         'de83b41a6fe51ec631930f34459574f3')
sha256sum=('9e1a65d53ddadc8253791e958a07bf5aba210ef6155ea9c91b2b4c46bbce53e3'
          '3fef2367bc4803bef3c06adad5f05f59305612009fee07a92bb6b574ad5e5974')

package() {
  _pkgname=${pkgname/-fonts/}
  _fver=${pkgver/./};

  install -dm 755 "${pkgdir}/usr/share/fonts/OTF"; 
  install -dm 755 "${pkgdir}/usr/share/fonts/TTF";

  for _dir in 'Print Fonts' 'Web Fonts/TTF'; do 
    cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/$_dir"; 
    for _font in *.?tf;  do 
      _family=${_font/Atkinson-Hyperlegible-/}; 
      _family=${_family/-$_fver.?tf/}; 
      _ext="${_font##*.}";
      _EXT="${_ext^^}";
      install -m 644 $_font "${pkgdir}/usr/share/fonts/$_EXT/$_pkgname-$_family.$_ext"; 
    done; 
  done;

  install -dm 755 "${pkgdir}/usr/share/licenses/$pkgname";
  install  -m 644 "${srcdir}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE";
}

Her are the contents of atkinson-hyperlegible-fonts-1.02-1-any.pkg.tar.zst

$ tree -a .
.
├── .BUILDINFO
├── .MTREE
├── .PKGINFO
└── usr
    └── share
        ├── fonts
        │   ├── OTF
        │   │   ├── atkinson-hyperlegible-BoldItalic.otf
        │   │   ├── atkinson-hyperlegible-Bold.otf
        │   │   ├── atkinson-hyperlegible-Italic.otf
        │   │   └── atkinson-hyperlegible-Regular.otf
        │   └── TTF
        │       ├── atkinson-hyperlegible-BoldItalic.ttf
        │       ├── atkinson-hyperlegible-Bold.ttf
        │       ├── atkinson-hyperlegible-Italic.ttf
        │       └── atkinson-hyperlegible-Regular.ttf
        └── licenses
            └── atkinson-hyperlegible-fonts
                └── LICENSE

7 directories, 12 files

Offline

#30 2020-11-04 02:00:10

nstickney
Member
From: Amateur Yak Shaver
Registered: 2011-03-11
Posts: 12
Website

Re: [Request] Atkinson Hyperlegible Font

MountainX wrote:
nstickney wrote:

@MountainX, would you like to Co-Maintain the package?

Yes, as long as you don't object to the fact that I'm inexperienced. It will be a good learning experience for me. Thank you.

I don't! What's your AUR username? What do you want in the

# Maintainer

line?


MountainX wrote:
nstickney wrote:

Why not just this?

for _font in $_pkgname-*-${pkgver/./}.otf

I would not object to something like that, but it has to be a little more complex. It would have to do case-insensitive matching on the file names, for example.

So

for _font in *-{pkgver/./}.otf

. Simpler is better.


MountainX wrote:

I had a version that ... did clean up the installed filenames...

I do like cleaning them up. No reason not to.

We can go way simpler, though:

package() {
	mkdir -p "$pkgdir"/usr/share/{fonts/{TTF,OTF},licenses/"$pkgname"}
	install -D -m0644 "$srcdir"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/

	for _dir in 'Print Fonts' 'Web Fonts/TTF'; do
		cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/$_dir" || exit
		for _font in *.?tf; do
			_EXT="${_font##*.}"
			install -m 644 "$_font" "$pkgdir"/usr/share/fonts/"${_EXT^^}"/"${_font/-${pkgver/./}/}"
		done
	done
}

Offline

#31 2020-11-04 02:07:10

loqs
Member
Registered: 2014-03-06
Posts: 12,134

Re: [Request] Atkinson Hyperlegible Font

		cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/$_dir" || exit

If any call in a PKGBUILD fails makepkg will exit with an error so why the || exit?

Offline

#32 2020-11-04 02:10:21

nstickney
Member
From: Amateur Yak Shaver
Registered: 2011-03-11
Posts: 12
Website

Re: [Request] Atkinson Hyperlegible Font

Fixed PKGBUILD is in! As soon as you get me a name/email address, I'll add you to co-maintain.

Offline

#33 2020-11-04 02:25:23

nstickney
Member
From: Amateur Yak Shaver
Registered: 2011-03-11
Posts: 12
Website

Re: [Request] Atkinson Hyperlegible Font

loqs wrote:
		cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/$_dir" || exit

If any call in a PKGBUILD fails makepkg will exit with an error so why the || exit?

So that shellcheck will leave me alone XD

Offline

#34 2020-11-04 02:28:17

nstickney
Member
From: Amateur Yak Shaver
Registered: 2011-03-11
Posts: 12
Website

Re: [Request] Atkinson Hyperlegible Font

loqs wrote:

PKGBUILD is guaranteed to be executed by bash because makepkg itself is executed by #!/usr/bin/bash.  bash is a dependency of pacman which is in base-devel.
Numerous variables in PKGBUILD are arrays such as license,  source,  checksum,  arch,  depends and options.

:facepalm:

Offline

#35 2020-11-04 02:34:21

MountainX
Member
Registered: 2016-02-08
Posts: 286

Re: [Request] Atkinson Hyperlegible Font

nstickney wrote:

Fixed PKGBUILD is in! As soon as you get me a name/email address, I'll add you to co-maintain.

I received an email message from notify@aur.archlinux.org:

You were added to the co-maintainer list of atkinson-hyperlegible-
fonts [1].
[1] https://aur.archlinux.org/pkgbase/atkin … ble-fonts/

I'm happy with the "# Maintainer" line you added already. So all is good.

I will test the updated PKGBUILD in a clean chroot asap. I'm looking forward to co-maintaining this package with you.

Offline

#36 2020-11-04 02:39:39

loqs
Member
Registered: 2014-03-06
Posts: 12,134

Re: [Request] Atkinson Hyperlegible Font

nstickney wrote:
loqs wrote:
		cd "$srcdir/Atkinson-Hyperlegible-Font-Print-and-Web-2020-0514/$_dir" || exit

If any call in a PKGBUILD fails makepkg will exit with an error so why the || exit?

So that shellcheck will leave me alone XD

What about:

# shellcheck disable=SC2164

or

shellcheck -e SC2164 PKGBUILD

Offline

#37 2020-11-04 04:56:18

Awebb
Member
Registered: 2010-05-06
Posts: 5,645

Re: [Request] Atkinson Hyperlegible Font

Shellcheck will one day responsible for a lot of code garbage in otherwise fine bash scripts because of rules like this.

Offline

#38 2020-11-05 01:20:09

nstickney
Member
From: Amateur Yak Shaver
Registered: 2011-03-11
Posts: 12
Website

Re: [Request] Atkinson Hyperlegible Font

loqs wrote:

What about:

# shellcheck disable=SC2164

Because || exit is less typing (and instantly understandable, unlike shellcheck "annotations").

loqs wrote:

or

shellcheck -e SC2164 PKGBUILD

Because my environment runs shellcheck for me and I'm too lazy to configure it (see above re: less typing).

Awebb wrote:

Shellcheck will one day responsible for a lot of code garbage in otherwise fine bash scripts because of rules like this.

Much rather have || exit and not need it than the alternatives (including shellcheck comments).

Offline

#39 2020-11-05 08:53:32

MountainX
Member
Registered: 2016-02-08
Posts: 286

Re: [Request] Atkinson Hyperlegible Font

MountainX wrote:

I will test the updated PKGBUILD in a clean chroot ...

I did not find any problems. The package built correctly in a chroot and it installed correctly on a fresh test system. I learned a lot in this thread.

Offline

#40 2020-11-21 23:22:05

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,839
Website

Re: [Request] Atkinson Hyperlegible Font

Just a note, The Braille institute has now published a custom license governing the use of the font.

It's kind of gross (in that it's so custom and oddly permissive and restrictive at the same time, also it's a PDF). But, it is the license, so packaging it may be a good idea.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

Board footer

Powered by FluxBB