Skip to content

Commit a69cc8b

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

File tree

5 files changed

+146
-0
lines changed

5 files changed

+146
-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: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Maintainer: Maksim Bondarenkov <[email protected]>
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.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/download"
21+
"remove-makedepends-jq.patch"
22+
"jemalloc-rs-support-gnullvm.patch"
23+
"jemalloc-rs-link-proper-lib.patch")
24+
sha256sums=('d7f053d430cf3e029e3cf8944ab02f11a9ef99b7cf2e8e7bf6cc85aebd7ff0fd'
25+
'cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b'
26+
'f72984fbbdce964f71cf7f69ed02fcdde5a0701b7cbd498bd88375476c4b918c'
27+
'363b12dcec4e8d7a08d6d9c9772d687859d8fbf1c6a33943060544d00bf05b39'
28+
'eb6a9c5fc37e613d9ddc7b7d951a5a1456fa6432ad206c027083cac1e3ba5e32')
29+
30+
prepare() {
31+
cd "${_realname}"
32+
33+
(
34+
cd ../tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7
35+
patch -p1 -i ../jemalloc-rs-support-gnullvm.patch
36+
# patch -p1 -i ../jemalloc-rs-link-proper-lib.patch
37+
)
38+
patch -Np1 -i ../remove-makedepends-jq.patch
39+
40+
# so tree-sitter grammars can be built
41+
if test true != "$(git config core.symlinks)"; then
42+
git config core.symlinks true &&
43+
MSYS='winsymlinks:nativestrict' git restore --source=HEAD :/
44+
fi
45+
46+
cat >> Cargo.toml <<END
47+
48+
[patch.crates-io]
49+
tikv-jemalloc-sys.path = "../tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
50+
END
51+
52+
rm rust-toolchain.toml
53+
cargo update -p tikv-jemalloc-sys
54+
cargo fetch --locked --target "${RUST_CHOST}"
55+
}
56+
57+
build() {
58+
cd "${_realname}"
59+
60+
cargo build --release --frozen
61+
62+
# documentation
63+
cd manual
64+
sed -i "s/DFT_VERSION_HERE/${pkgver}/g" -i src/introduction.md
65+
mdbook build
66+
}
67+
68+
check() {
69+
cd "${_realname}"
70+
71+
cargo test --release --frozen
72+
}
73+
74+
package_difftastic() {
75+
cd "${_realname}"
76+
77+
cargo install \
78+
--offline \
79+
--no-track \
80+
--frozen \
81+
--path . \
82+
--root "${pkgdir}${MINGW_PREFIX}"
83+
84+
install -Dm644 difft.1 "${pkgdir}${MINGW_PREFIX}/share/man/man1/difft.1"
85+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
86+
}
87+
88+
package_difftastic-docs() {
89+
pkgdesc+=' (Documentation)'
90+
depends=()
91+
92+
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
93+
cp -vr manual/book "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
94+
}
95+
96+
# vim: set ft=bash :
97+
98+
# generate wrappers
99+
for _name in "${pkgname[@]}"; do
100+
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
101+
_func="$(declare -f "${_short}")"
102+
eval "${_func/#${_short}/package_${_name}}"
103+
done
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/build.rs
2+
+++ b/build.rs
3+
@@ -341,7 +341,7 @@
4+
// intrinsics that are libgcc specific (e.g. those intrinsics aren't present in
5+
// libcompiler-rt), so link that in to get that support.
6+
if target.contains("windows") {
7+
- println!("cargo:rustc-link-lib=static=jemalloc");
8+
+ println!("cargo:rustc-link-lib=static=libjemalloc");
9+
} else {
10+
println!("cargo:rustc-link-lib=static=jemalloc_pic");
11+
}
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)