You are not logged in.

#1 2019-10-23 04:57:13

Young
Member
Registered: 2009-04-26
Posts: 50

[SOLVED] How to properly install an icon file?

Hi!

I'm creating a PKGBUILD for an application that provides an icon file (.png), but I don't know what is the proper way of installing it using a PKGBUILD. The readme file says I should run "xdg-icon-resource install", but I couldn't find any information about whether this applies to Arch or not. And if that is correct, how should I integrate it with my PKGBUILD?

Thanks for your time.

Last edited by Young (2019-10-26 02:18:26)

Offline

#2 2019-10-23 08:01:35

a821
Member
From: My Location
Registered: 2012-10-31
Posts: 138

Re: [SOLVED] How to properly install an icon file?

Have a look at https://wiki.archlinux.org/index.php/Icons. Otherwise I would simply use install(1) and place the files somewhere under /usr/share/icons

BTW, is this related to your other thread? https://bbs.archlinux.org/viewtopic.php?id=250183.  Posting the PKGBUILD will be useful.

Offline

#3 2019-10-23 12:15:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,271
Website

Re: [SOLVED] How to properly install an icon file?

Note that /usr/share/icons/ is for icon themes/sets that provide most of the common DE icons.  For an application providing it's own icon, that should go either in it's own /usr/share/$pkgname directory or /usr/share/pixmaps/.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2019-10-23 12:43:16

progandy
Member
Registered: 2012-05-17
Posts: 3,580

Re: [SOLVED] How to properly install an icon file?

Trilby wrote:

Note that /usr/share/icons/ is for icon themes/sets that provide most of the common DE icons.

There is also the hicolor theme where applications can install their own icons.

https://specifications.freedesktop.org/ … ory_layout
In order to have a place for third party applications to install their icons there should always exist a theme called "hicolor" [1]. The data for the hicolor theme is available for download at: [the arch linux hicolor-icon-theme package]. Implementations are required to look in the "hicolor" theme if an icon was not found in the current theme.

Last edited by progandy (2019-10-23 12:45:06)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2019-10-24 22:25:33

Young
Member
Registered: 2009-04-26
Posts: 50

Re: [SOLVED] How to properly install an icon file?

a821 wrote:

Have a look at https://wiki.archlinux.org/index.php/Icons. Otherwise I would simply use install(1) and place the files somewhere under /usr/share/icons

BTW, is this related to your other thread? https://bbs.archlinux.org/viewtopic.php?id=250183.  Posting the PKGBUILD will be useful.

Yes, it's related. I'm creating a PKGBUILD for an application called Portugol Studio, which is a tool to create code in the Portugol programming language (an educational language made for programming students that speak the portuguese language). Here's what I have so far:

# Maintainer: Young Acinonyx <young[dot]acinonyx[at]gmail[dot]com>
pkgname=portugol-studio
pkgver=2.7.4
pkgrel=1
epoch=
pkgdesc="Ambiente de Programação didático para a linguagem Portugol 2.0."
arch=('x86_64')
url="http://lite.acad.univali.br/portugol/"
license=('GPL')
groups=()
depends=('java-runtime=11')
makedepends=('xdg-utils')
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=("https://github.com/UNIVALI-LITE/Portugol-Studio/releases/download/v$pkgver/$pkgname-$pkgver-linux-x64-standalone.zip"
	"portugol-console"
	"portugol-studio")
noextract=()
md5sums=('06ff5fc05064754a457ad99cd7d2a001'
         'f6afcaf3530c3606d24861e6771ae600'
         '8b5a45ab020accd444e4ff420385f1b6')
validpgpkeys=()

prepare() {
	cd "$srcdir"

	# Change the path of the java executable to Arch's default
	sed -i 's#caminho_java=".*#caminho_java="java"#g' "$srcdir/$pkgname/"*.sh

	# Replace "/usr/local/portugol-studio" with "/usr/share/portugol-studio" inside the desktop file
	sed -i 's#/usr/local#/usr/share#g' "$srcdir/arquivos-auxiliares/$pkgname.desktop"
	
	# Remove the precompiled java provided by the package in favor of using Arch's official java-runtime
	rm -rf "$srcdir/$pkgname/java"
}

package() {
	cd "$srcdir"

	# Set the correct permissions
	chmod -R 755 "$srcdir/$pkgname"
	find "$srcdir/$pkgname" -type f -execdir chmod 644 "{}" \;
	chmod 755 "$srcdir/$pkgname/executar-console-linux.sh"
	chmod 755 "$srcdir/$pkgname/executar-studio-linux.sh"

	# Install the shell executables
	install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -Dm755 "portugol-console" "$pkgdir/usr/bin/portugol-console"

	# Install the desktop file
	install -Dm644 "$srcdir/arquivos-auxiliares/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"

	# Install the icon file
	???

	# Install the mime type association xml
	install -Dm644 "$srcdir/arquivos-auxiliares/application-x-portugol.xml" "$pkgdir/usr/share/mime/packages/application-x-portugol.xml"

	# Copy the necessary files
	cp -R "$srcdir/$pkgname" "$pkgdir/usr/share/"
}

I think the "xdg-icon-resource install" command would be used to create an association of the icon (.png inside /usr/share/portugol-studio/) with the files created inside the program (.por). I don't know if that command should be inside the PKGBUILD or perhaps inside an "install" file (portugol-sudio.install). I couldn't find any information about integrating that command with a PKGBUILD. Any help would be greatly appreciated.

Thanks again.

Offline

#6 2019-10-25 11:45:11

a821
Member
From: My Location
Registered: 2012-10-31
Posts: 138

Re: [SOLVED] How to properly install an icon file?

Young wrote:
	# Replace "/usr/local/portugol-studio" with "/usr/share/portugol-studio" inside the desktop file
	sed -i 's#/usr/local#/usr/share#g' "$srcdir/arquivos-auxiliares/$pkgname.desktop"

I quickly look at the desktop file. Running that line would change the icon path to

Icon=/usr/share/portugol-studio/aplicacao/icones/linux/portugol-studio.png

therefore, I would keep it simple and in `package` I would add something like the following (untested!)

install -Dm644 "$srcdir/portugol-studio/aplicacao/icones/linux/portugol-studio.png" "$pkgdir/usr/share/portugol-studio/aplicacao/icones/linux/portugol-studio.png"

Also, remove the empty arrays in the PKGBUILD.

Offline

#7 2019-10-25 12:22:18

progandy
Member
Registered: 2012-05-17
Posts: 3,580

Re: [SOLVED] How to properly install an icon file?

You should also call your package portugol-studio-bin if you intend to publish the PKGBUILD in the AUR. The sources are available, but you don't use them.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2019-10-26 02:17:39

Young
Member
Registered: 2009-04-26
Posts: 50

Re: [SOLVED] How to properly install an icon file?

I was finally able to install it correctly. I experimented a little with the command "xdg-icon-resource install". Apparently, the only think it does is to copy the icon file (.png) to the directory of the hicolor theme (unless another one is specified) and resize it if needed. Instead of using that, I used the "install" command, so I don't need to include "xdg-utils" as a dependency anymore. Now the PKGBUILD will copy (install) the icons to the /usr/share/icons/hicolor/256x256/ directory. Since the application provides an icon for the main program and also an icon for the mime type, I placed them in their respective subdirectories (apps and mimetypes). I also changed the name to portugol-studio-bin (as suggested by progandy) and uploaded it to the AUR.

Thanks once again for all your help!

Offline

Board footer

Powered by FluxBB