How to compile app for Manjaro when repo is out of date

This may be badly placed as a post. I have gone with Newbie since I don't even think I am fully asking correctly, but if I find an answer others may gain from the pursuit.

I use my wonderful Manjaro Stable system to do work, and mostly mapping/GIS.

I use QGIS all the time.
I have installed it through paman and from a flat installation.
But the development is so frequent, and the stable updates so important to me, that I wish to be on the latest Stable release. Not only that, when a stable release happens, I get notified to update from within the program!

I go through the QGIS process which leads to downloads for many popular Linux Distros, including ArchLinux and Flatpak, but those always seem to be way behind in packages.
QGIS Downloads

If there is a way to reasonably learn how to package QGIS for Manjaro, I would like to start doing it, since I want it anyway.

Is there a step-by-step, or is someone willing to take me through the process of setting up to do this? Or is it too invasive for a Stable working system, or changes?

Thanx all!

Start here:

https://wiki.archlinux.org/index.php/Arch_Build_System

Read all of the related articles, too.

1 Like

I edited your post title as qgis is in the community repo, not the AUR. :wink: However, there is a bleeding-edge qgis-git package there.

1 Like

@Yochanan thank you for editing. I always hesitate to post because I know how much I don't know!

That said, I was only trying to point out that I knew I could go bleeding edge of git through AUR install, but even that, right now, is at:
qgis-git 3.9.0_master.r54615.7f95991edf-1
while the formal release of QGIS on their pages is 3.10, which has a very important feature for me to be using.

I will read the link(s) from @merlock as soon as I can, to see if I can be part of the solution at some point. I am nervouse, but hey! If I build it, and it works for me, it might work for others!

Thank you!

Don't hesitate, there's plenty of helpful folks here. We won't bite... much. :grin:

VCS packages always pull from the latest commit. These will be packages ending in -cvs , -svn , -hg , -darcs , -bzr , -git etc. At build time, the version will be regenerated based on the latest tag, revision and commit. If you build it right now, I imagine it will be something like 3.10_master.rXXXX...

Well, as much as I want/need some of the newer mapping options, I DO NOT want the bleeding edge. It sounds like, from what you have shared, if I go with the git, it will NOT be the latest Stable version, but whatever is being tested newer, right?

Thanx @Yochanan

Yes, you have it right that the git will just be whatever git is currently at

OK ..

So .. first - we are currently exactly where arch is:

https://www.archlinux.org/packages/?sort=&q=qgis&maintainer=&flagged=

https://manjaro32.org/repo-compare/community.html

Now .. if you want to avoid the git version, cant use the repo or upstream or development buils .. then you might want to build manually, out of the package manager. In which case you would follow the normal procedure and/or the instructions after downloading the version you want from the release page (read the readme):

Now if you want to make your own package (this would be better than just building manually as it would be recognized by your package management and such)
You would need to write a PKGBUILD that points to the right release (and works).
You may be able to do this rather trivially by just cannibalizing one of the existing pkgbuilds .. but it may also be more involved.

1 Like

Thanx @cscs.

I do want to build manually. I am not sure of the "normal procedure" but I will be looking.

@merlock gave me a link to read first, so i will start there.

But I would really like to start with a PKBUILD that I can cannibalize, but just as much to look and understand what is happening in there.

So, are you saying I could take a PKGBUILD from somewhere that is working for installing a previous version, from somewhere? I will look for that.

This may be beyond me, but I won't know until I try!

Any other suggestions to get me started?

UPDATE: I was curious how you got to the git where the stable releases were, so I started at QGIS to see where that led, and I got to here:
https://qgis.org/en/site/forusers/download.html

... and then cllicking on sources? which offers to download a .bz2 file. This leaves me a little confused as to where I should go. Sorry for the question BEFORE reading thoroughly. Just excited.

I would probably start with this one:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=qgis-git

Then mainly - replace a few things like

name as something like qgis-310-final
the (first) defining pkgver line with something like 3.10-final
remove the _pkgver lines and the second pkgver lines (and the code after it)
and point the source directly to your release
..and maybe a few more ?

I already pointed you to releases:
https://github.com/qgis/QGIS/releases/

When I follow QGIS it leads me to this, which is different than the page you listed. I also tried to just go to git and search for QGIS, and again I got the one that QGIS page points to.

So, how did you get to the page you suggested previously? Just really curious.

Thanx

Thanx @cscs

I just searched for the project source (and it is apparently hosted on github) and went to the 'releases' page :wink:

(as it was the same source mentioned in pkgbuilds, has 3.1k stars, is a 'sponsor' and is from team/user qgis .. I felt pretty confident I had the 'true' source [sometimes you must be careful with this .. that you are not taking from a random 'same-named' fork from someone else, or worse, something malicious])

Wow! This is cool, and it appears something I could MAYBE figure out and do.

Thanx again @cscs

I also saw this with interest:
https://repology.org/project/qgis/versions

I have finally had some time to dig into this and I have not made much progress. So, I asked on the QGIS irc for some help and hand-holding rather than busying this post up. As or if I gain insight and some success at building QGIS for Manjaro, I will post back. I have a few days to play with it, so I am hopeful.

Thanx all.

Why bother? It was updated a couple days ago in Arch to v3.10.0 it’ll hit Manjaro very soon, assuming it isn’t already in unstable.

https://www.archlinux.org/packages/community/x86_64/qgis/

In fact it’s already in unstable and testing :wink:

It does not seem to work even though it is there. It appears to install, but will not launch.

Besides, if I can learn how to do this, I can build it and others can use it too!

You can see below what I was trying to do.
I assumed I was supposed to point to MY SOURCE, which I downloaded. However, I suspect it will not be recognised in the download format I got it.

The short story is that I just dont understand enough yet. I will get there.

# Maintainer: gaelic <gaelic@luchmhor.net>
#             Fincer <fincer@example.com>

# Previous Maintainer: scimmia, XavierCLL, SaultDon, Lantald, Thomas Dziedzic, dibblethewrecker, Gerardo Exequiel Pozzi, Eric Forgeot

pkgname=qgis-git
_pkgname=qgis
pkgver=3.10-final

pkgrel=1
pkgdesc='Geographic Information System (GIS) that supports vector, raster & database formats - Development master'
url='http://qgis.org/'
license=('GPL')
arch=('i686' 'x86_64')
depends=('qt5-tools' 'qt5-script' 'qtkeychain' 'qca-qt5' 'qt5-webkit' 'qt5-3d' 'qt5-serialport' 'proj' 'geos' 'sqlite' 'python-pyqt5' 'python-gdal' 'python-owslib' 'python-future' 'python-sip' 'python-sip-pyqt5' 'python-psycopg2' 'python-yaml' 'python-numpy' 'python-jinja' 'python-pygments' 'qwtpolar' 'expat' 'python-qscintilla-qt5' 'spatialindex' 'gsl' 'libzip' 'sip' 'exiv2' 'qt5-xmlpatterns' 'ocl-icd')

makedepends=('git' 'cmake' 'txt2tags')
optdepends=('grass: for GRASS providers and plugin (6 or 7)'
#            'gsl: for georeferencer'
            'postgresql: for postgis and SPIT support'
            'gpsbabel: for gps plugin'
            'fcgi: for qgis mapserver'
            'ocilib: oracle provider')

#install="$_pkgname.install"
source=("${_pkgname}::/home/jim/Downloads/qgis-3.10.0-1-x86_64.pkg")
md5sums=('SKIP')
#conflicts=('qgis')


prepare() {
  cd $_pkgname

  # Fix desktop file for /usr/bin/qgis-github
  
#  sed -e 's/\/usr\/bin\/qgis/\/usr\/bin\/qgis-git/g' \

   sed -e 's/Exec=qgis/Exec=qgis-git/g' \
  		-e 's/Icon=qgis/Icon=qgis-git/g' \
  		-i linux/org.qgis.qgis.desktop.in
  #cp linux/org.qgis.qgis.desktop.in linux/org.qgis.qgis-git.desktop

  # Remove mime types already defined by freedesktop.org
  sed -e '/type="image\/tiff"/,/<\/mime-type>/d' \
      -e '/type="image\/jpeg"/,/<\/mime-type>/d' \
      -e '/type="image\/jp2"/,/<\/mime-type>/d' \
      -e '/type="application\/x-adobe-mif"/,/<\/mime-type>/d' \
      -i debian/qgis.xml

  [[ -d build ]] || mkdir build
}

build() {
  cd $_pkgname/build
  
  cmake -G "Unix Makefiles" ../ \
    -DCMAKE_INSTALL_PREFIX=/opt/$pkgname \
    -DQGIS_MANUAL_SUBDIR=share/man \
    -DENABLE_TESTS=FALSE \
    -DWITH_INTERNAL_QWTPOLAR=FALSE \
    -DWITH_INTERNAL_{HTTPLIB2,JINJA2,MARKUPSAFE,OWSLIB,PYGMENTS,DATEUTIL,PYTZ,YAML,NOSE2,SIX,FUTURE}=FALSE \
    -DWITH_GEOREFERENCER=TRUE \
    -DWITH_3D=TRUE
#    -DWITH_SERVER=TRUE \
#    -DWITH_GLOBE=TRUE

  make
}

package() {
  cd $_pkgname/build

  # Add optional deps based on selected or autodetected options
  [[ -n "$(sed -n '/^GRASS_PREFIX:/ s/.*=//p' CMakeCache.txt)" ]] && optdepends+=('grass6: GRASS6 plugin')
  [[ -n "$(sed -n '/^GRASS_PREFIX7:/ s/.*=//p' CMakeCache.txt)" ]] && optdepends+=('grass: GRASS7 plugin')
  [[ "$(sed -n '/^WITH_SERVER:/ s/.*=//p' CMakeCache.txt)" == "TRUE" ]] && optdepends+=('fcgi: Map Server')
  [[ "$(sed -n '/^WITH_GLOBE:/ s/.*=//p' CMakeCache.txt)" == "TRUE" ]] && optdepends+=('osgearth: Globe plugin')

  make DESTDIR="$pkgdir" install

  cd "$srcdir/$_pkgname"
  
  install -d -m755 $pkgdir/usr/bin
  ln -s /opt/$pkgname/bin/qgis "$pkgdir/usr/bin/qgis-git"
  
  # install desktop files and icons
#  install -Dm644 linux/org.qgis.qgis-git.desktop -t "$pkgdir/usr/share/applications/"
  install -Dm644 build/org.qgis.qgis.desktop "$pkgdir/usr/share/applications/org.qgis.qgis-git.desktop"
  for resolution in `ls /usr/share/icons/hicolor/|egrep '[0-9]'`; do
  	if [ -e debian/icons/qgis-icon{$resolution}.png ]
  	then
	  	install -Dm644 debian/icons/qgis-icon${resolution}.png "$pkgdir/usr/share/icons/hicolor/${resolution}/apps/$pkgname.png"
	  fi 
  done
	install -Dm644 images/icons/qgis_icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"
	
  # install mime information and icon
  
  install -Dm644 debian/qgis.xml "$pkgdir/usr/share/mime/packages/qgis-git.xml"
  for resolution in `ls /usr/share/icons/hicolor/|egrep '[0-9]'`; do
  	if [ -e debian/icons/qgis-mime-icon{$resolution}.png ]
  	then
	  	install -Dm644 debian/icons/qgis-mime-icon${resolution}.png "$pkgdir/usr/share/icons/hicolor/${resolution}/mimetypes/qgis-git-mime.png"
	  fi
	done
	install -Dm644 images/icons/qgis_mime_icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/mimetypes/qgis-git-mime.svg"
	  
	for type in qgs qlr qml qpt; do
		for resolution in `ls /usr/share/icons/hicolor/|egrep '[0-9]'`; do
			if [ -e debian/icons/qgis-${type}${resolution}.png ]
  		then
	  		install -Dm644 debian/icons/qgis-${type}${resolution}.png "$pkgdir/usr/share/icons/hicolor/${resolution}/mimetypes/qgis-git-$type.png"
	  	fi
		done
	done
	for type in asc ddf dem dt0 dxf gml img mime mldata qgs qlr qml qpt shp sqlite; do
    install -Dm644 images/icons/qgis_${type}_icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/mimetypes/qgis-git-$type.svg"
  done

  # compile python files, since the cmake option doesn't seem to account for DESTDIR
  python -m compileall -q "$pkgdir"
  
  # link libraries
  install -d -m755 "${pkgdir}"/etc/ld.so.conf.d/
  echo '/opt/qgis-git/lib' > "${pkgdir}"/etc/ld.so.conf.d/qgis-git.conf
}

Did you actually change branch or did you just grab the main file itself?

There are a heap of python dependencies for the main package and python has undergone a huge rebuild which has yet to hit stable.

Point I’m making is you will need to change branch to test it is actually working properly and not just grab the main package itself.

OK. I will try to figure that out.
Thanx @anon34396487

@anon34396487 I think what you are suggesting is to go into pamac and search for QGIS, and install from extra or community, but 3.10 does not show up anywhere. It is listed as 3.8....

In "changing branches" you mean to use something other than STABLE, right?

This is not my work machine, it is a laptop I got set up to try and start to build it into a pamac package for myself and others, so I am willing to go a little off-path on this, from Stable. But I don't want to go too far because I do DO some work stuff on this still and if I create an unstable system, I do not yet have the skills to recover to stable.

With that said, can you give me the steps you intend for me to use to install from a different branch?

Thanx!

Changing branch is quite simple.

sudo pacman-mirrors --api --set-branch testing

sudo pacman -Syyu

That will put you on testing branch.

Then to change back to stable branch repeat the above obviously changing testing for stable. If you also want to fully sync back to stable branch packages too then,

sudo pacman -Syyuu

Forum kindly sponsored by