Skip to content

Commit e270ac5

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

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-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: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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}-cc-libs")
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+
"remove-makedepends-jq.patch"
22+
"dont-use-jemalloc.patch")
23+
sha256sums=('d7f053d430cf3e029e3cf8944ab02f11a9ef99b7cf2e8e7bf6cc85aebd7ff0fd'
24+
'f72984fbbdce964f71cf7f69ed02fcdde5a0701b7cbd498bd88375476c4b918c'
25+
'4de77c64e0ee3bdbcaa1476798c5223b4ab89fa6e7a6abfa235bccfcb4c83031')
26+
27+
prepare() {
28+
cd "${_realname}"
29+
30+
# so tree-sitter grammars can be built
31+
if test true != "$(git config core.symlinks)"; then
32+
git config core.symlinks true &&
33+
MSYS='winsymlinks:nativestrict' git restore --source=HEAD :/
34+
fi
35+
36+
patch -Np1 -i ../remove-makedepends-jq.patch
37+
patch -p1 -i ../dont-use-jemalloc.patch
38+
39+
rm rust-toolchain.toml
40+
cargo fetch --locked --target "${RUST_CHOST}"
41+
}
42+
43+
build() {
44+
cd "${_realname}"
45+
46+
export RUSTFLAGS="${RUSTFLAGS/+crt-static/-crt-static}"
47+
cargo build --release --frozen
48+
49+
# documentation
50+
cd manual
51+
sed -i "s/DFT_VERSION_HERE/${pkgver}/g" -i src/introduction.md
52+
mdbook build
53+
}
54+
55+
check() {
56+
cd "${_realname}"
57+
58+
cargo test --release --frozen
59+
}
60+
61+
package_difftastic() {
62+
cd "${_realname}"
63+
64+
cargo install \
65+
--offline \
66+
--no-track \
67+
--frozen \
68+
--path . \
69+
--root "${pkgdir}${MINGW_PREFIX}"
70+
71+
install -Dm644 difft.1 "${pkgdir}${MINGW_PREFIX}/share/man/man1/difft.1"
72+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
73+
}
74+
75+
package_difftastic-docs() {
76+
pkgdesc+=' (Documentation)'
77+
depends=()
78+
79+
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
80+
cp -vr "${_realname}"/manual/book "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
81+
}
82+
83+
# vim: set ft=bash :
84+
85+
# generate wrappers
86+
for _name in "${pkgname[@]}"; do
87+
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
88+
_func="$(declare -f "${_short}")"
89+
eval "${_func/#${_short}/package_${_name}}"
90+
done
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--- a/Cargo.toml
2+
+++ b/Cargo.toml
3+
@@ -128,7 +128,7 @@ tree-sitter-xml = "0.7.0"
4+
tree-sitter-yaml = "0.7.0"
5+
tree-sitter-zig = "1.1.2"
6+
7+
-[target.'cfg(not(any(target_env = "msvc", target_os = "illumos", target_os = "freebsd")))'.dependencies]
8+
+[target.'cfg(not(any(windows, target_os = "illumos", target_os = "freebsd")))'.dependencies]
9+
tikv-jemallocator = "0.6"
10+
11+
[dev-dependencies]
12+
--- a/src/main.rs
13+
+++ b/src/main.rs
14+
@@ -98,10 +98,10 @@ use crate::parse::syntax;
15+
///
16+
/// For reference, Jemalloc uses 10-20% more time (although up to 33%
17+
/// more instructions) when testing on sample files.
18+
-#[cfg(not(any(target_env = "msvc", target_os = "illumos", target_os = "freebsd")))]
19+
+#[cfg(not(any(windows, target_os = "illumos", target_os = "freebsd")))]
20+
use tikv_jemallocator::Jemalloc;
21+
22+
-#[cfg(not(any(target_env = "msvc", target_os = "illumos", target_os = "freebsd")))]
23+
+#[cfg(not(any(windows, target_os = "illumos", target_os = "freebsd")))]
24+
#[global_allocator]
25+
static GLOBAL: Jemalloc = Jemalloc;
26+
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)