Skip to content

Commit 4efb0e9

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

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-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: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
makedepends=("${MINGW_PACKAGE_PREFIX}-rust"
16+
"${MINGW_PACKAGE_PREFIX}-make"
17+
"${MINGW_PACKAGE_PREFIX}-mdbook"
18+
'git')
19+
source=("git+${msys2_repository_url}#tag=${pkgver}"
20+
"tikv-jemalloc-sys.tar.gz::https://crates.io/api/v1/crates/tikv-jemalloc-sys/0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/download"
21+
"remove-makedepends-jq.patch"
22+
"jemalloc-rs-support-gnullvm.patch")
23+
sha256sums=('d7f053d430cf3e029e3cf8944ab02f11a9ef99b7cf2e8e7bf6cc85aebd7ff0fd'
24+
'cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d'
25+
'f72984fbbdce964f71cf7f69ed02fcdde5a0701b7cbd498bd88375476c4b918c'
26+
'363b12dcec4e8d7a08d6d9c9772d687859d8fbf1c6a33943060544d00bf05b39')
27+
28+
prepare() {
29+
cd "${_realname}"
30+
31+
patch -d ../tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7 \
32+
-p1 -i ../jemalloc-rs-support-gnullvm.patch
33+
patch -Np1 -i ../remove-makedepends-jq.patch
34+
35+
cat >> Cargo.toml <<END
36+
37+
[patch.crates-io]
38+
tikv-jemalloc-sys.path = "../tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
39+
END
40+
41+
rm rust-toolchain.toml
42+
cargo update -p tikv-jemalloc-sys
43+
cargo fetch --locked --target "${RUST_CHOST}"
44+
}
45+
46+
build() {
47+
cd "${_realname}"
48+
49+
cargo build --release --frozen
50+
51+
# documentation
52+
cd manual
53+
sed -i "s/DFT_VERSION_HERE/${pkgver}/g" -i src/introduction.md
54+
mdbook build
55+
}
56+
57+
check() {
58+
cd "${_realname}"
59+
60+
cargo test --release --frozen
61+
}
62+
63+
package_difftastic() {
64+
cd "${_realname}"
65+
66+
cargo install \
67+
--offline \
68+
--no-track \
69+
--frozen \
70+
--path . \
71+
--root "${pkgdir}${MINGW_PREFIX}"
72+
73+
install -Dm644 difft.1 "${pkgdir}${MINGW_PREFIX}/share/man/man1/difft.1"
74+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
75+
}
76+
77+
package_difftastic-docs() {
78+
pkgdesc+=' (Documentation)'
79+
80+
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
81+
cp -vr manual/book "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
82+
}
83+
84+
# vim: set ft=bash :
85+
86+
# generate wrappers
87+
for _name in "${pkgname[@]}"; do
88+
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
89+
_func="$(declare -f "${_short}")"
90+
eval "${_func/#${_short}/package_${_name}}"
91+
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)