Skip to content

Commit a57238a

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

File tree

5 files changed

+156
-0
lines changed

5 files changed

+156
-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: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/download"
22+
"remove-makedepends-jq.patch"
23+
"jemalloc-rs-support-gnullvm.patch"
24+
"jemalloc-rs-link-proper-lib.patch")
25+
sha256sums=('d7f053d430cf3e029e3cf8944ab02f11a9ef99b7cf2e8e7bf6cc85aebd7ff0fd'
26+
'cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b'
27+
'f72984fbbdce964f71cf7f69ed02fcdde5a0701b7cbd498bd88375476c4b918c'
28+
'363b12dcec4e8d7a08d6d9c9772d687859d8fbf1c6a33943060544d00bf05b39'
29+
'eb6a9c5fc37e613d9ddc7b7d951a5a1456fa6432ad206c027083cac1e3ba5e32')
30+
31+
_env() {
32+
# for system jemalloc linkage
33+
export JEMALLOC_OVERRIDE="${MINGW_PREFIX}/bin/libjemalloc.dll"
34+
export CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS=true
35+
}
36+
37+
prepare() {
38+
cd "${_realname}"
39+
40+
(
41+
cd ../tikv-jemalloc-sys-0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7
42+
patch -p1 -i ../jemalloc-rs-support-gnullvm.patch
43+
# patch -p1 -i ../jemalloc-rs-link-proper-lib.patch
44+
)
45+
patch -Np1 -i ../remove-makedepends-jq.patch
46+
47+
# so tree-sitter grammars can be built
48+
if test true != "$(git config core.symlinks)"; then
49+
git config core.symlinks true &&
50+
MSYS='winsymlinks:nativestrict' git restore --source=HEAD :/
51+
fi
52+
53+
# cat >> Cargo.toml <<END
54+
55+
# [patch.crates-io]
56+
# tikv-jemalloc-sys.path = "../tikv-jemalloc-sys-0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
57+
# END
58+
59+
rm rust-toolchain.toml
60+
# cargo update -p tikv-jemalloc-sys
61+
cargo fetch --locked --target "${RUST_CHOST}"
62+
}
63+
64+
build() {
65+
cd "${_realname}"
66+
67+
_env
68+
cargo build --release --frozen
69+
70+
# documentation
71+
cd manual
72+
sed -i "s/DFT_VERSION_HERE/${pkgver}/g" -i src/introduction.md
73+
mdbook build
74+
}
75+
76+
check() {
77+
cd "${_realname}"
78+
79+
_env
80+
cargo test --release --frozen
81+
}
82+
83+
package_difftastic() {
84+
cd "${_realname}"
85+
86+
_env
87+
cargo install \
88+
--offline \
89+
--no-track \
90+
--frozen \
91+
--path . \
92+
--root "${pkgdir}${MINGW_PREFIX}"
93+
94+
install -Dm644 difft.1 "${pkgdir}${MINGW_PREFIX}/share/man/man1/difft.1"
95+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
96+
}
97+
98+
package_difftastic-docs() {
99+
pkgdesc+=' (Documentation)'
100+
depends=()
101+
102+
mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
103+
cp -vr manual/book "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/manual"
104+
}
105+
106+
# vim: set ft=bash :
107+
108+
# generate wrappers
109+
for _name in "${pkgname[@]}"; do
110+
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
111+
_func="$(declare -f "${_short}")"
112+
eval "${_func/#${_short}/package_${_name}}"
113+
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)