You are not logged in.

#1 2017-04-13 14:53:53

hashhar
Member
From: New Delhi, India
Registered: 2017-04-08
Posts: 18
Website

[SOLVED] Namcap complains about CARCH? How does CARCH work?

I have a binary package with different sources for i686 and x86_64 architectures.

Here's the PKGBUILD:

# Maintainer: hashhar <hashhar_dev AT outlook DOT com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: maoserr

pkgname=redshiftgui-bin
pkgver=0.2.4
pkgrel=1
pkgdesc='Monitor color adjustment tool'
arch=('x86_64' 'i686')
url='http://github.com/maoserr/redshiftgui'
license=('GPL2')
depends=('gtk2' 'curl' 'libxcb' 'libxrandr' 'libxxf86vm' 'libsm')
replaces=('redshiftgui')
if [[ $CARCH = x86_64 ]]; then
  source=("https://github.com/maoserr/redshiftgui/releases/download/$pkgver-Arch64/RedshiftGUI-$pkgver-Linux-x86_64.tar.gz"
          'redshiftgui.sh')
  sha256sums=('1170e8d8eca1b7b936ffb5e70763259b3f15db810bf2d05b3b0221d8e35bbb27'
              'df03e192fe32bda2ea546be85faf51c030ae8dd46c40aad229e39b6b296897b5')
else
  source=("https://github.com/maoserr/redshiftgui/releases/download/$pkgver-Arch64/RedshiftGUI-$pkgver-Linux-i686.tar.gz"
          'redshiftgui.sh')
  sha256sums=('4d34de7b9bf106569bd7b87f2cd96640e60f723cf27e37e89219c8ea5b14cb2d'
              'df03e192fe32bda2ea546be85faf51c030ae8dd46c40aad229e39b6b296897b5')
fi

package() {
  cd "RedshiftGUI-${pkgver}-Linux-${CARCH}"
  install -Dm755 bin/redshiftgui "$pkgdir/usr/bin/redshiftgui.elf"
  install -Dm755 "$srcdir/redshiftgui.sh" "$pkgdir/usr/bin/redshiftgui"
  install -d "$pkgdir/usr/share"
  mv share/* "$pkgdir/usr/share/"
}

# vim:set ts=2 sw=2 et:

So is it safe to replace the

arch

array with simply

$CARCH

instead of explicitly saying i686 and x86_64?

How does the $CARCH variable work?

Last edited by hashhar (2017-04-13 15:17:54)

Offline

#2 2017-04-13 14:56:54

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,553

Re: [SOLVED] Namcap complains about CARCH? How does CARCH work?

CARCH is the current architecture you're building for.

Also, please see https://wiki.archlinux.org/index.php/PKGBUILD#Sources

Offline

#3 2017-04-13 15:17:30

hashhar
Member
From: New Delhi, India
Registered: 2017-04-08
Posts: 18
Website

Re: [SOLVED] Namcap complains about CARCH? How does CARCH work?

Scimmia wrote:

CARCH is the current architecture you're building for.

Also, please see https://wiki.archlinux.org/index.php/PKGBUILD#Sources

Okay, so it means that using $CARCH in the arch array is a bad idea if I don't know that it will run on ARM for example.

Thanks for the link to the wiki. I must have overlooked that. Makes things a lot simpler and cleaner.

Marking as SOLVED.

Offline

#4 2017-04-13 16:08:46

mis
Member
Registered: 2016-03-16
Posts: 234

Re: [SOLVED] Namcap complains about CARCH? How does CARCH work?

Instead of the  $CARCH  if  else  for source and checksums it's also possible to use:

# common sources for both architectures
sources=()
sha256sums=()

# architecture specific
sources_i686=()
sha256sums_i686=()

sources_x86_64=()
sha256sums_x86_64=()

Offline

#5 2017-04-13 16:10:20

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,553

Re: [SOLVED] Namcap complains about CARCH? How does CARCH work?

mis wrote:

Instead of the  $CARCH  if  else  for source and checksums it's also possible to use:

Yeah, that's what the link above says

Offline

#6 2017-04-13 18:29:52

mis
Member
Registered: 2016-03-16
Posts: 234

Re: [SOLVED] Namcap complains about CARCH? How does CARCH work?

Ah ok, I didn't click it. big_smile

Offline

Board footer

Powered by FluxBB