Skip to content

Commit edeb7b0

Browse files
committed
[new package] difftastic 0.67.0
1 parent a402eb8 commit edeb7b0

File tree

4 files changed

+132
-0
lines changed

4 files changed

+132
-0
lines changed

mingw-w64-difftastic/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/difftastic

mingw-w64-difftastic/PKGBUILD

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Maintainer: Maksim Bondarenkov <maksapple2306@gmail.com>
2+
3+
_realname=difftastic
4+
pkgbase=mingw-w64-${_realname}
5+
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
6+
"${MINGW_PACKAGE_PREFIX}-${_realname}-docs")
7+
pkgver=0.67.0
8+
pkgrel=1
9+
pkgdesc="A structural diff that understands syntax (mingw-w64)"
10+
arch=('any')
11+
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
12+
url='https://difftastic.wilfred.me.uk'
13+
msys2_repository_url='https://github.com/Wilfred/difftastic'
14+
license=('spdx:MIT')
15+
depends=("${MINGW_PACKAGE_PREFIX}-jemalloc")
16+
makedepends=("${MINGW_PACKAGE_PREFIX}-rust"
17+
"${MINGW_PACKAGE_PREFIX}-make"
18+
"${MINGW_PACKAGE_PREFIX}-mdbook"
19+
'git')
20+
source=("git+${msys2_repository_url}#tag=${pkgver}"
21+
"tikv-jemalloc-sys.tar.gz::https://crates.io/api/v1/crates/tikv-jemalloc-sys/0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/download"
22+
"remove-makedepends-jq.patch"
23+
"jemalloc-rs-support-gnullvm.patch")
24+
sha256sums=('d7f053d430cf3e029e3cf8944ab02f11a9ef99b7cf2e8e7bf6cc85aebd7ff0fd'
25+
'cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d'
26+
'f72984fbbdce964f71cf7f69ed02fcdde5a0701b7cbd498bd88375476c4b918c'
27+
'363b12dcec4e8d7a08d6d9c9772d687859d8fbf1c6a33943060544d00bf05b39')
28+
29+
prepare() {
30+
cd "${_realname}"
31+
32+
patch -d ../tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7 \
33+
-p1 -i ../jemalloc-rs-support-gnullvm.patch
34+
patch -Np1 -i ../remove-makedepends-jq.patch
35+
36+
# so tree-sitter grammars can be built
37+
if test true != "$(git config core.symlinks)"; then
38+
git config core.symlinks true &&
39+
MSYS='winsymlinks:nativestrict' git restore --source=HEAD :/
40+
fi
41+
42+
# cat >> Cargo.toml <<END
43+
44+
# [patch.crates-io]
45+
# tikv-jemalloc-sys.path = "../tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
46+
# END
47+
48+
rm rust-toolchain.toml
49+
# cargo update -p tikv-jemalloc-sys
50+
cargo fetch --locked --target "${RUST_CHOST}"
51+
}
52+
53+
build() {
54+
cd "${_realname}"
55+
56+
export JEMALLOC_OVERRIDE="${MINGW_PREFIX}/bin/libjemalloc.dll"
57+
cargo build --release --frozen
58+
59+
# documentation
60+
cd manual
61+
sed -i "s/DFT_VERSION_HERE/${pkgver}/g" -i src/introduction.md
62+
mdbook build
63+
}
64+
65+
check() {
66+
cd "${_realname}"
67+
68+
cargo test --release --frozen
69+
}
70+
71+
package_difftastic() {
72+
cd "${_realname}"
73+
74+
cargo install \
75+
--offline \
76+
--no-track \
77+
--frozen \
78+
--path . \
79+
--root "${pkgdir}${MINGW_PREFIX}"
80+
81+
install -Dm644 difft.1 "${pkgdir}${MINGW_PREFIX}/share/man/man1/difft.1"
82+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
83+
}
84+
85+
package_difftastic-docs() {
86+
pkgdesc+=' (Documentation)'
87+
depends=()
88+
89+
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
90+
cp -vr manual/book "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
91+
}
92+
93+
# vim: set ft=bash :
94+
95+
# generate wrappers
96+
for _name in "${pkgname[@]}"; do
97+
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
98+
_func="$(declare -f "${_short}")"
99+
eval "${_func/#${_short}/package_${_name}}"
100+
done
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- a/build.rs
2+
+++ b/build.rs
3+
@@ -426,8 +426,9 @@ fn gnu_target(target: &str) -> String {
4+
match target {
5+
"i686-pc-windows-msvc" => "i686-pc-win32".to_string(),
6+
"x86_64-pc-windows-msvc" => "x86_64-pc-win32".to_string(),
7+
- "i686-pc-windows-gnu" => "i686-w64-mingw32".to_string(),
8+
- "x86_64-pc-windows-gnu" => "x86_64-w64-mingw32".to_string(),
9+
+ "i686-pc-windows-gnu" | "i686-pc-windows-gnullvm" => "i686-w64-mingw32".to_string(),
10+
+ "x86_64-pc-windows-gnu" | "x86_64-pc-windows-gnullvm" => "x86_64-w64-mingw32".to_string(),
11+
+ "aarch64-pc-windows-gnullvm" => "aarch64-w64-mingw32".to_string(),
12+
"armv7-linux-androideabi" => "arm-linux-androideabi".to_string(),
13+
"riscv64gc-unknown-linux-gnu" | "riscv64a23-unknown-linux-gnu" => {
14+
"riscv64-linux-gnu".to_string()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--- a/manual/book.toml
2+
+++ b/manual/book.toml
3+
@@ -14,6 +14,3 @@ git-repository-url = "https://github.com/wilfred/difftastic"
4+
5+
[output.html.playground]
6+
copyable = false
7+
-
8+
-[preprocessor.replace-version-placeholder]
9+
-command = "./replace_version_placeholder.sh"
10+
--- a/manual/replace_version_placeholder.sh
11+
+++ /dev/null
12+
@@ -1,5 +0,0 @@
13+
-#!/bin/bash
14+
-
15+
-DFT_VERSION=$(cargo read-manifest | jq -r .version)
16+
-
17+
-jq .[1] | jq '.sections[0].Chapter.content |= sub("DFT_VERSION_HERE"; "'$DFT_VERSION'")'

0 commit comments

Comments
 (0)