summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorGreyson Christoforo2021-01-15 12:02:32 +0000
committerGreyson Christoforo2021-01-15 12:02:32 +0000
commit25ae84565dd554865a89c451144df79cbca8a17a (patch)
tree9083dba2f0bd552712f2a64a43282f3558db78d4 /PKGBUILD
parent49fb918f4695458cb5c48169d4358d5431fb282e (diff)
downloadaur-25ae84565dd554865a89c451144df79cbca8a17a.tar.gz
fix version
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD57
1 files changed, 39 insertions, 18 deletions
diff --git a/PKGBUILD b/PKGBUILD
index bb540d7aa2a9..bbea4e7601cc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,46 +1,67 @@
-# Maintainer: Frederic Van Assche <frederic@fredericva.com>
+# Maintainer: Grey Christoforo <first name at last name dot net>
pkgname=kicad-packages3d-git
-_pkgname=kicad-packages3D
-pkgver=r2020.10.06.27d653c
+_gitlab_repo=kicad/libraries/kicad-packages3D
+pkgver=20201014.0.1602698909
pkgrel=1
pkgdesc="KiCad component 3D model libraries from the official git repo"
arch=('any')
-url="https://github.com/KiCad/kicad-packages3D"
+url=https://gitlab.com/${_gitlab_repo}
license=('GPL')
options=('!strip')
-makedepends=('cmake' 'git')
+makedepends=(
+cmake
+git
+ninja
+jq
+curl
+)
conflicts=('kicad-library-bzr' 'kicad-library-git' 'kicad-library-3d' 'kicad-library' 'kicad-packages' 'kicad-packages3d')
provides=('kicad-packages3d')
source=()
-
+# do a shallow clone because the whole history here is annoying
prepare(){
- if [ -d ${_pkgname} ]; then
- cd ${_pkgname}
+ if [ -d $(basename ${_gitlab_repo}) ]; then
+ cd $(basename ${_gitlab_repo})
git fetch --depth 1
git checkout master
else
- git clone --depth 1 https://gitlab.com/kicad/libraries/kicad-packages3D.git
+ git clone --depth 1 https://gitlab.com/${_gitlab_repo}.git
fi
}
pkgver() {
- cd "$srcdir/$_pkgname"
- _DATE=$(date -d @`git log -1 --format="%at"` --rfc-3339='date')
- printf "r%s.%s" "${_DATE//-/.}" "$(git rev-parse --short HEAD)"
+ cd $(basename ${_gitlab_repo})
+ # since we did a shallow clone in prepare, we need to find a way to version this...
+ local _gitlab_repo_id=$(printf "${_gitlab_repo}" | jq -sRr @uri)
+ local _latest_commit_timestamp=$(curl -s "https://gitlab.com/api/v4/projects/${_gitlab_repo_id}/repository/commits" | jq -r '.[0]["created_at"]')
+
+ local _version_day=$(date --date=${_latest_commit_timestamp} +'%Y%m%d')
+ local _version_epoch=$(date --date=${_latest_commit_timestamp} +"%s")
+
+ # notes for github repos
+ #_num_commits=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/octocat/hello-world/stats/code_frequency" | jq -r '. | length')
+
+ printf "%s.0.%s" "${_version_day}" "${_version_epoch}"
}
build() {
- cd "$srcdir"
- mkdir -p "$srcdir/build/"
- cd "$srcdir/build"
- cmake ../${_pkgname} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
+ cd $(basename ${_gitlab_repo})
+ cmake \
+ -B "${srcdir}"/build_dir \
+ -D CMAKE_BUILD_TYPE=None \
+ -D CMAKE_INSTALL_PREFIX=/usr \
+ -G Ninja \
+ -S .
+
+ cmake --build "${srcdir}"/build_dir
}
package() {
- cd "$srcdir/build"
+ cd $(basename ${_gitlab_repo})
+ DESTDIR="${pkgdir}" cmake --build "${srcdir}/build_dir" -- install
- make DESTDIR="$pkgdir" install
+ install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 LICENSE.md
}