Skip to content

Commit d88878a

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

File tree

6 files changed

+177
-0
lines changed

6 files changed

+177
-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+
"jemalloc-rs-link-from-out_dir.patch")
26+
sha256sums=('d7f053d430cf3e029e3cf8944ab02f11a9ef99b7cf2e8e7bf6cc85aebd7ff0fd'
27+
'cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b'
28+
'f72984fbbdce964f71cf7f69ed02fcdde5a0701b7cbd498bd88375476c4b918c'
29+
'363b12dcec4e8d7a08d6d9c9772d687859d8fbf1c6a33943060544d00bf05b39'
30+
'eb6a9c5fc37e613d9ddc7b7d951a5a1456fa6432ad206c027083cac1e3ba5e32'
31+
'07994619d91711e1460e9185ae6489a14bc38ff7fac9e5c44d3b1194b2e4e9ac')
32+
33+
# _env() {
34+
# # for system jemalloc linkage
35+
# export JEMALLOC_OVERRIDE="${MINGW_PREFIX}/bin/libjemalloc.dll"
36+
# export CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS=true
37+
# }
38+
39+
prepare() {
40+
cd "${_realname}"
41+
42+
(
43+
cd ../tikv-jemalloc-sys-0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7
44+
patch -p1 -i ../jemalloc-rs-support-gnullvm.patch
45+
# patch -p1 -i ../jemalloc-rs-link-proper-lib.patch
46+
patch -p1 -i ../jemalloc-rs-link-from-out_dir.patch
47+
)
48+
patch -Np1 -i ../remove-makedepends-jq.patch
49+
50+
# so tree-sitter grammars can be built
51+
if test true != "$(git config core.symlinks)"; then
52+
git config core.symlinks true &&
53+
MSYS='winsymlinks:nativestrict' git restore --source=HEAD :/
54+
fi
55+
56+
cat >> Cargo.toml <<END
57+
58+
[patch.crates-io]
59+
tikv-jemalloc-sys.path = "../tikv-jemalloc-sys-0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
60+
END
61+
62+
rm rust-toolchain.toml
63+
cargo update -p tikv-jemalloc-sys
64+
cargo fetch --locked --target "${RUST_CHOST}"
65+
}
66+
67+
build() {
68+
cd "${_realname}"
69+
70+
cargo build --release --frozen
71+
72+
# documentation
73+
cd manual
74+
sed -i "s/DFT_VERSION_HERE/${pkgver}/g" -i src/introduction.md
75+
mdbook build
76+
}
77+
78+
check() {
79+
cd "${_realname}"
80+
81+
cargo test --release --frozen
82+
}
83+
84+
package_difftastic() {
85+
cd "${_realname}"
86+
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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--- a/jemalloc-sys/build.rs
2+
+++ b/jemalloc-sys/build.rs
3+
@@ -328,6 +328,9 @@ fn main() {
4+
.arg("install_lib_static")
5+
.arg("install_include"));
6+
7+
+ // Try to remove the build directory to avoid it wasting disk space in the target directory
8+
+ let _ = fs::remove_dir_all(build_dir);
9+
+
10+
println!("cargo:root={}", out_dir.display());
11+
12+
// Linkage directives to pull in jemalloc and its dependencies.
13+
@@ -342,7 +345,7 @@ fn main() {
14+
} else {
15+
println!("cargo:rustc-link-lib=static=jemalloc_pic");
16+
}
17+
- println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
18+
+ println!("cargo:rustc-link-search=native={}/lib", out_dir.display());
19+
if target.contains("android") {
20+
println!("cargo:rustc-link-lib=gcc");
21+
} else if !target.contains("windows") {
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)