You are not logged in.

#1 2023-09-14 08:32:31

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,794

spirv-tools-git - using upstream version in pkgver() trouble

In spirv-tools-git I currently use a simple printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" to get a consistent pkgver.() that reflects the commit used and will always be greater then previous versions.

glslang-git maintainer has asked me to prepend the latest tag so glslang-git can use a condition like spirv-tools>=2023.2 .


I looked into it and found the git tags don't match with the version reported by spirv tools in /usr/bin . Latest git tag is v2023.4.rc2

$ spirv-cfg --version
SPIRV-Tools v2023.4 unknown hash, 2023-09-13T11:14:04 EXPERIMENTAL
Target: SPIR-V 1.6
$ 

repo spirv-tools uses the same year.index scheme as described in https://github.com/KhronosGroup/SPIRV-Tools#readme .
Adding 2023.4 to the spirv-tools-git pkgver() seems like the logical solution.

I checked the sourcecode and found the version is dynamically determined at buildtime and written to build-version.inc through SPIRV-Tools/source/CMakeLists.txt .
There is a standalone target spirv-tools-build-version for cmake to create just that file.

prepare() runs before pkgver() so I could run cmake there, retrieve the year.index version from build-version.inc & put it into a shell variable.

Do you think this  is a good implementation ?

If yes, will the variable set in prepare() be useful in pkgver() ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#2 2023-09-14 12:28:49

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,794

Re: spirv-tools-git - using upstream version in pkgver() trouble

Answer to the second question : It requires special code to pass variables from inside a child process (function ) back to the parent process so they can be used in other functions.
I settled for putting cmake/make in prepare and retrieving the info from the file in pkgver .

Got a working skeleton implementation now and would like to hear opinions about this method before publishing it to AUR.

Last edited by Lone_Wolf (2023-09-14 12:30:13)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2023-09-19 14:02:35

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,794

Re: spirv-tools-git - using upstream version in pkgver() trouble

uploaded PKGBUILD with new version scheme & increased epoch to AUR.

Below are the added / changed lines to implement it. Will mark it as solved in a few days.

cmake_args=(
  -G "Unix Makefiles"
  -D CMAKE_BUILD_TYPE=Release
  -D CMAKE_INSTALL_PREFIX=/usr
  -D CMAKE_INSTALL_LIBDIR=lib
  -D SPIRV-Headers_SOURCE_DIR=/usr/
  -D BUILD_SHARED_LIBS=ON
  -D SPIRV_TOOLS_BUILD_STATIC=OFF
  -D SPIRV_WERROR=OFF
)




prepare() {
  # link external sources so cmake can find them
  pushd SPIRV-Tools/external
  ln -s "$srcdir"/googletest
  ln -s $srcdir/abseil-cpp abseil_cpp
  ln -s "$srcdir"/effcee
  ln -s "$srcdir"/re2
  popd

  cmake   -S SPIRV-Tools -B _build "${cmake_args[@]}" -Wno-dev
  make -C _build spirv-tools-build-version
}

pkgver() {
  local _ver1 _ver2 _rev _hash
  # read fails if only 1 var is used
  IFS="," read -r _ver1 _ver2 < _build/build-version.inc || [ -n "_ver1" ]
  
  # remove leading v
  _ver1=${_ver1//v/}
  cd SPIRV-Tools  
  _rev=$(git rev-list --count HEAD)
  _hash=$(git rev-parse --short=7 HEAD)

  printf "$_ver1"".r""$_rev"".""$_hash"
}

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB