Skip to content

Commit 68205d5

Browse files
authored
[new package] gram 2.2.0 (msys2#29867)
1 parent 41e7933 commit 68205d5

11 files changed

Lines changed: 296 additions & 0 deletions

mingw-w64-gram/PKGBUILD

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Maintainer: Maksim Bondarenkov <maksapple2306@gmail.com>
2+
3+
_realname=gram
4+
pkgbase=mingw-w64-${_realname}
5+
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
6+
pkgver=2.2.0
7+
pkgrel=1
8+
pkgdesc="A code editor for humanoid apes and grumpy toads (mingw-w64)"
9+
arch=('any')
10+
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
11+
url='https://gram-editor.com'
12+
msys2_repository_url='https://codeberg.org/GramEditor/gram'
13+
msys2_documentation_url='https://gram-editor.com/docs'
14+
license=('spdx:Apache-2.0 AND GPL-3.0-or-later')
15+
install=gram-${MSYSTEM}.install
16+
msys2_references=(
17+
'anitya:'
18+
'archlinux: gram'
19+
'aur:'
20+
)
21+
depends=("${MINGW_PACKAGE_PREFIX}-nodejs"
22+
#"${MINGW_PACKAGE_PREFIX}-libgit2"
23+
"${MINGW_PACKAGE_PREFIX}-zstd"
24+
"${MINGW_PACKAGE_PREFIX}-sqlite3")
25+
makedepends=("${MINGW_PACKAGE_PREFIX}-rust"
26+
"${MINGW_PACKAGE_PREFIX}-cmake"
27+
"${MINGW_PACKAGE_PREFIX}-pkgconf"
28+
"${MINGW_PACKAGE_PREFIX}-protobuf"
29+
"${MINGW_PACKAGE_PREFIX}-rust-bindgen"
30+
"${MINGW_PACKAGE_PREFIX}-nasm"
31+
"${MINGW_PACKAGE_PREFIX}-efxc2"
32+
'git')
33+
optdepends=("${MINGW_PACKAGE_PREFIX}-rustup: to build extensions"
34+
"${MINGW_PACKAGE_PREFIX}-git: for a better Git integration")
35+
source=("git+${msys2_repository_url}.git#tag=${pkgver}"
36+
"rust-protobuf-native.tar.gz::https://codeberg.org/GramEditor/rust-protobuf-native/archive/a70e2d9986e931f2b883b661bf8f4471c5398b7e.tar.gz"
37+
"zstd-sys.tar.gz::https://static.crates.io/crates/zstd-sys/2.0.16+zstd.1.5.7/download"
38+
"protobuf-src-abseil-Fix-compiler-warnings.patch"
39+
"protobuf-src-abseil-fix-linking-abseil_dll.patch"
40+
"protobuf-src-abseil-Remove-librt-library.patch"
41+
"protobuf-src-abseil-fix-mingw-build.patch"
42+
"protobuf-src-fix-clang-build.patch"
43+
"gram-use-patched-protobuf-src.patch"
44+
"zstd-sys-remove-statik.patch")
45+
sha256sums=('f7b6b4a1799e2873132c227a7d1821e2f34798b1ed633677db56ceb207a071ed'
46+
'8b63253a9b39f388c91af8c9dc1a9a5bc7ffeafc0367f9da3c48ea2dfe11419b'
47+
'91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748'
48+
'30fb7526d1c89f722dd0ce0c467e034370140fbf07a1ad4f91df301c7f442551'
49+
'67ee0328f1aa8e3ad24231b2e6ef6a78963218e087cc6a7230e2d4e61b27a741'
50+
'8946282db6a225b385729deb345b57e3ee75f4e859dbbc49ab7bc5604d71192f'
51+
'053d09f18bc3029ece051e59d125f8952ec847b1b8fbc21b605edde86d1c2f63'
52+
'e0918deb70ceafa5c8f99a2ffefa98da2b4139fb4b0190f51c06a8fcb86decfb'
53+
'b5d138810b3a55491fb2efbb576e4ed7c6627e5a923c0325829dc6b18e80bbe3'
54+
'48f4900ceb02d3aaf9a1020f33d56629156e96759f456c0e7ca18bfcf910767b')
55+
56+
prepare() {
57+
cd "${_realname}"
58+
rm rust-toolchain.toml
59+
60+
# link system deps dynamically
61+
patch -d ../zstd-sys-2.0.16+zstd.1.5.7 -i ../zstd-sys-remove-statik.patch
62+
# patch abseil-cpp source (version 20240722.0) in protobuf-src crate
63+
patch -d ../rust-protobuf-native/protobuf-src/protobuf/third_party/abseil-cpp/ -p1 -i "${srcdir}"/protobuf-src-abseil-Fix-compiler-warnings.patch
64+
patch -d ../rust-protobuf-native/protobuf-src/protobuf/third_party/abseil-cpp/ -p1 -i "${srcdir}"/protobuf-src-abseil-fix-linking-abseil_dll.patch
65+
patch -d ../rust-protobuf-native/protobuf-src/protobuf/third_party/abseil-cpp/ -p1 -i "${srcdir}"/protobuf-src-abseil-Remove-librt-library.patch
66+
patch -d ../rust-protobuf-native/protobuf-src/protobuf/third_party/abseil-cpp/ -p1 -i "${srcdir}"/protobuf-src-abseil-fix-mingw-build.patch
67+
patch -d ../rust-protobuf-native/protobuf-src/protobuf/ -p1 -i "${srcdir}"/protobuf-src-fix-clang-build.patch
68+
# use patched *-sys crates
69+
sed -i '/\[patch\.crates-io\]/a zstd-sys.path = "../zstd-sys-2.0.16+zstd.1.5.7"' Cargo.toml
70+
patch -p1 -i ../gram-use-patched-protobuf-src.patch
71+
72+
# change git config so `pet*` crates would be fetched without error; requires Windows registry
73+
# changes, see https://gram-editor.com/docs/development/windows#build-fails-path-too-long for details
74+
if test true != "$(git config core.longpaths)"; then
75+
git config --global core.longpaths true
76+
fi
77+
78+
cargo update -p zstd-sys
79+
cargo fetch --locked
80+
}
81+
82+
build() {
83+
cd "${_realname}"
84+
85+
export PROTOC="${MINGW_PREFIX}/bin/protoc.exe"
86+
export PROTOC_INCLUDE="${MINGW_PREFIX}/include"
87+
export OPENSSL_NO_VENDOR=1
88+
#export LIBGIT2_NO_VENDOR=1
89+
export ZSTD_SYS_USE_PKG_CONFIG=1
90+
export WINAPI_NO_BUNDLED_LIBRARIES=1
91+
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
92+
export GRAM_UPDATE_EXPLANATION='Updates are handled by pacman'
93+
export CARGO_PROFILE_RELEASE_DEBUG=0
94+
export RELEASE_CHANNEL="stable"
95+
export RELEASE_VERSION="${pkgver} (Rev${pkgrel}, Built by MSYS2 project)"
96+
# set path to our fxc compiler
97+
export GPUI_FXC_PATH="${MINGW_PREFIX}/bin/fxc.exe"
98+
# should be synced with .cargo/config.toml
99+
export RUSTFLAGS="${RUSTFLAGS/+crt-static/-crt-static} -C symbol-mangling-version=v0
100+
--cfg tokio_unstable --cfg windows_slim_errors"
101+
102+
cargo build --release --frozen -p gram -p cli
103+
}
104+
105+
check() {
106+
cd "${_realname}"
107+
108+
cargo test --release --frozen -p gram -p cli
109+
}
110+
111+
package() {
112+
install -Dm755 "${_realname}/target/release/cli" "${pkgdir}${MINGW_PREFIX}/bin/gram"
113+
install -Dm755 "${_realname}/target/release/gram" "${pkgdir}${MINGW_PREFIX}/lib/gram/gram-editor"
114+
# WSL script
115+
install -Dm755 "${_realname}/crates/gram/resources/windows/gram.sh" "${pkgdir}${MINGW_PREFIX}/bin/gram-wsl"
116+
117+
install -Dm644 "${_realname}"/LICENSE-{APACHE,GPL} -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/"
118+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
post_install() {
2+
echo "-> You need to install AMD AGS library for proper AMD GPU support:"
3+
echo " 'wcurl --output /clang64/lib/gram/amd_ags_x64.dll https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/v6.3.0/ags_lib/lib/amd_ags_x64.dll'"
4+
}
5+
6+
post_upgrade() {
7+
if [ -e /clang64/lib/gram/amd_ags_x64.dll ]; then
8+
echo "-> Ensure that you have proper version of AMD AGS driver installed. Current is 6.3.0."
9+
echo " See https://www.msys2.org/docs/ides-editors for details."
10+
fi
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
post_install() {
2+
echo "-> You need to install AMD AGS library for proper AMD GPU support:"
3+
echo " 'wcurl --output /clangarm64/lib/gram/amd_ags_x64.dll https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/v6.3.0/ags_lib/lib/amd_ags_x64.dll'"
4+
}
5+
6+
post_upgrade() {
7+
if [ -e /clangarm64/lib/gram/amd_ags_x64.dll ]; then
8+
echo "-> Ensure that you have proper version of AMD AGS driver installed. Current is 6.3.0."
9+
echo " See https://www.msys2.org/docs/ides-editors for details."
10+
fi
11+
}

mingw-w64-gram/gram-UCRT64.install

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
post_install() {
2+
echo "-> You need to install AMD AGS library for proper AMD GPU support:"
3+
echo " 'wcurl --output /ucrt64/lib/gram/amd_ags_x64.dll https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/raw/v6.3.0/ags_lib/lib/amd_ags_x64.dll'"
4+
}
5+
6+
post_upgrade() {
7+
if [ -e /ucrt64/lib/gram/amd_ags_x64.dll ]; then
8+
echo "-> Ensure that you have proper version of AMD AGS driver installed. Current is 6.3.0."
9+
echo " See https://www.msys2.org/docs/ides-editors for details."
10+
fi
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/Cargo.toml
2+
+++ b/Cargo.toml
3+
@@ -631,7 +631,7 @@
4+
[patch.crates-io]
5+
async-task = { git = "https://github.com/smol-rs/async-task.git", rev = "b4486cd71e4e94fbda54ce6302444de14f4d190e" }
6+
calloop = { git = "https://github.com/zed-industries/calloop" }
7+
-protobuf-src = { git = "https://codeberg.org/GramEditor/rust-protobuf-native", rev = "a70e2d9986e931f2b883b661bf8f4471c5398b7e" }
8+
+protobuf-src.path = "../rust-protobuf-native/protobuf-src"
9+
10+
[profile.dev]
11+
split-debuginfo = "unpacked"
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
--- a/absl/base/internal/sysinfo.cc
2+
+++ b/absl/base/internal/sysinfo.cc
3+
@@ -77,7 +77,9 @@
4+
// 0 if the number of processors is not available or can not be computed.
5+
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlogicalprocessorinformation
6+
int Win32NumCPUs() {
7+
+#ifdef _MSC_VER
8+
#pragma comment(lib, "kernel32.lib")
9+
+#endif
10+
using Info = SYSTEM_LOGICAL_PROCESSOR_INFORMATION;
11+
12+
DWORD info_size = sizeof(Info);
13+
@@ -150,7 +152,9 @@
14+
// API informing about CPU nominal frequency.
15+
return 1.0;
16+
#else
17+
+#ifdef _MSC_VER
18+
#pragma comment(lib, "advapi32.lib") // For Reg* functions.
19+
+#endif
20+
HKEY key;
21+
// Use the Reg* functions rather than the SH functions because shlwapi.dll
22+
// pulls in gdi32.dll which makes process destruction much more costly.
23+
--- a/absl/debugging/symbolize_win32.inc
24+
+++ b/absl/debugging/symbolize_win32.inc
25+
@@ -18,12 +18,16 @@
26+
#include <windows.h>
27+
28+
// MSVC header dbghelp.h has a warning for an ignored typedef.
29+
+#ifdef _MSC_VER
30+
#pragma warning(push)
31+
#pragma warning(disable:4091)
32+
#include <dbghelp.h>
33+
#pragma warning(pop)
34+
35+
#pragma comment(lib, "dbghelp.lib")
36+
+#else
37+
+#include <dbghelp.h>
38+
+#endif
39+
40+
#include <algorithm>
41+
#include <cstring>
42+
--- a/absl/random/internal/seed_material.cc
43+
+++ b/absl/random/internal/seed_material.cc
44+
@@ -44,7 +44,9 @@
45+
46+
#include <windows.h>
47+
#define ABSL_RANDOM_USE_BCRYPT 1
48+
+#ifdef _MSC_VER
49+
#pragma comment(lib, "bcrypt.lib")
50+
+#endif
51+
52+
#elif defined(__Fuchsia__)
53+
#include <zircon/syscalls.h>
54+
--- a/absl/time/internal/cctz/src/time_zone_format.cc
55+
+++ b/absl/time/internal/cctz/src/time_zone_format.cc
56+
@@ -40,7 +40,7 @@
57+
#include <limits>
58+
#include <string>
59+
#include <vector>
60+
-#if !HAS_STRPTIME
61+
+#ifndef HAS_STRPTIME
62+
#include <iomanip>
63+
#include <sstream>
64+
#endif
65+
@@ -56,7 +56,7 @@
66+
67+
namespace {
68+
69+
-#if !HAS_STRPTIME
70+
+#ifndef HAS_STRPTIME
71+
// Build a strptime() using C++11's std::get_time().
72+
char* strptime(const char* s, const char* fmt, std::tm* tm) {
73+
std::istringstream input(s);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- a/absl/base/CMakeLists.txt
2+
+++ b/absl/base/CMakeLists.txt
3+
@@ -191,7 +191,6 @@
4+
${ABSL_DEFAULT_COPTS}
5+
LINKOPTS
6+
${ABSL_DEFAULT_LINKOPTS}
7+
- $<$<BOOL:${LIBRT}>:-lrt>
8+
$<$<BOOL:${MINGW}>:-ladvapi32>
9+
DEPS
10+
absl::atomic_hook
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/absl/synchronization/internal/pthread_waiter.h
2+
+++ b/absl/synchronization/internal/pthread_waiter.h
3+
@@ -16,7 +16,7 @@
4+
#ifndef ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_
5+
#define ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_
6+
7+
-#if !defined(_WIN32) && !defined(__MINGW32__)
8+
+#if !defined(_MSC_VER)
9+
#include <pthread.h>
10+
11+
#include "absl/base/config.h"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--- a/absl/time/internal/cctz/src/time_zone_lookup.cc
2+
+++ b/absl/time/internal/cctz/src/time_zone_lookup.cc
3+
@@ -47,6 +47,7 @@
4+
#include <wchar.h>
5+
#include <windows.globalization.h>
6+
#include <windows.h>
7+
+#include <winstring.h>
8+
#endif
9+
#endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--- a/src/google/protobuf/port_def.inc
2+
+++ b/src/google/protobuf/port_def.inc
3+
@@ -736,7 +736,7 @@
4+
#error PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED was previously defined
5+
#endif
6+
#if defined(__GNUC__) && defined(__clang__) && !defined(__APPLE__) && \
7+
- !defined(_MSC_VER)
8+
+ !defined(_WIN32)
9+
#define PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED
10+
#endif
11+
12+
--- a/src/google/protobuf/repeated_ptr_field.h
13+
+++ b/src/google/protobuf/repeated_ptr_field.h
14+
@@ -766,7 +766,7 @@
15+
16+
// Appends all `std::string` values from `from` to this instance.
17+
template <>
18+
-void RepeatedPtrFieldBase::MergeFrom<std::string>(
19+
+PROTOBUF_EXPORT void RepeatedPtrFieldBase::MergeFrom<std::string>(
20+
const RepeatedPtrFieldBase& from);
21+

0 commit comments

Comments
 (0)