blob: d7c48cef0abb40f69b317d4129f4a328c56282d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# Maintainer: Horror Proton <https://github.com/horror-proton>
# Maintainer: Cryolitia <cryolitia at gmail dot com>
# shellcheck disable=SC2034 disable=SC2164
: ${WITH_CUDA:=1}
_pkgname=maa-assistant-arknights
pkgname=(maa-assistant-arknights)
_pkgver=6.0.1
pkgver=${_pkgver//-/}
pkgrel=1
pkgdesc="An Arknights assistant"
arch=(x86_64)
url="https://github.com/MaaAssistantArknights/MaaAssistantArknights"
license=('AGPL-3.0-only')
depends=(opencv onnxruntime)
makedepends=(boost eigen git cmake)
_fastdeploy_ref=e962983da6daba7d0c12f6bf5f8ff7173be70982
source=("git+$url.git#tag=v${_pkgver}"
"git+https://github.com/MaaXYZ/MaaUtils.git"
"FastDeploy-${_fastdeploy_ref}.tar.gz::https://github.com/MaaXYZ/FastDeploy/archive/$_fastdeploy_ref.tar.gz")
install="${_pkgname}.install"
md5sums=('78974044a3dbd154a941f1611ff10720'
'SKIP'
'4555f8dce0cec02022356d50c8f2275c')
if ((WITH_CUDA)); then
pkgname+=(maa-assistant-arknights-cuda)
depends+=(cuda)
fi
prepare() {
sed -e 's/35 50 52 60 61 70//g;' -i "${srcdir}/FastDeploy-${_fastdeploy_ref}/cmake/cuda.cmake"
cd "${srcdir}/MaaAssistantArknights"
git submodule init
git config submodule.src/MaaUtils.url "${srcdir}/MaaUtils"
git -c protocol.file.allow=always submodule update src/MaaUtils
sed -e '/^find_package(fast/s/^/# /;' \
-e '/maadeps/s/^/# /;' \
-e 's/imgproc/imgproc calib3d videoio xfeatures2d/' \
-e 's/ system)/ process)/'\
-i CMakeLists.txt -i src/MaaUtils/MaaUtils.cmake
sed -e '/copy_and_add_rpath_library(/s/^/# /;' \
-e '/add_compile_options/s/^/# /;' \
-i {,src/MaaUtils/}cmake/config.cmake
sed -e '/maadeps/s/^/# /;' \
-e 's/Boost::system/Boost::process/g;' \
-i {,src/MaaUtils/}cmake/utils.cmake -i src/MaaCore/CMakeLists.txt
sed -e '/MAADEPS_DIR/s/^/# /;' \
-e '/system/s/^/# /;' \
-i src/MaaUtils/MaaUtils.cmake
sed -e 's/Boost::system//g' \
-i src/MaaUtils/source/CMakeLists.txt
cat <<_EOF >>CMakeLists.txt
add_subdirectory(\${fastdeploy_SOURCE_DIR} \${fastdeploy_BINARY_DIR} EXCLUDE_FROM_ALL SYSTEM)
target_include_directories(MaaCore SYSTEM PRIVATE \${fastdeploy_SOURCE_DIR})
install(TARGETS fastdeploy_ppocr MaaUtils)
_EOF
# fix for boost 1.89
cat <<_EOF >>src/MaaUtils/include/MaaUtils/IOStream/BoostIO.hpp
// #define BOOST_PROCESS_VERSION 1
#include <boost/process/v1/child.hpp>
#include <boost/process/v1/io.hpp>
#include <boost/process/v1/pipe.hpp>
#include <boost/process/v1/search_path.hpp>
_EOF
sed -e 's/address::from_string/make_address/g' \
-e 's/\*ios\.rdbuf/ios\.socket/' \
-i src/MaaUtils/source/IOStream/SockIOStream.cpp
sed -e '4i #include <unordered_map>' \
-i src/MaaCore/Config/Roguelike/RoguelikeMapConfig.h
sed -e '24i #include <cstring>' \
-i src/MaaCore/./Utils/ExceptionStacktrace.hpp
}
build() {
local _cmake_flags=(
-DCMAKE_BUILD_TYPE=None
-DUSE_MAADEPS=OFF
-DINSTALL_RESOURCE=ON
-DINSTALL_PYTHON=ON
-DINSTALL_FLATTEN=OFF
-DBUILD_SHARED_LIBS=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_INSTALL_PREFIX="$pkgdir"/usr
-DMAA_VERSION="v$_pkgver"
-Dfastdeploy_SOURCE_DIR="$srcdir"/FastDeploy-"$_fastdeploy_ref"
-Dfastdeploy_BINARY_DIR="$srcdir"/build-FastDeploy
)
CXXFLAGS+=" -DBOOST_PROCESS_VERSION=1"
CXXFLAGS+=" -fmacro-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase:?}"
cmake -B build -S "MaaAssistantArknights" "${_cmake_flags[@]}"
cmake --build build
if ((WITH_CUDA)); then
local _cmake_flags+=(
-DWITH_CUDA=ON
-DCUDA_DIRECTORY=/opt/cuda
-DCUDA_ARCH_NAME=Auto
)
cmake -B build-cuda -S "MaaAssistantArknights" "${_cmake_flags[@]}"
cmake --build build-cuda
fi
}
package_maa-assistant-arknights() {
cmake --install "$srcdir"/build --prefix "$pkgdir"/usr
cd "$pkgdir"/usr/
mkdir -p share/"$_pkgname"
mv Python resource share/"$_pkgname"
ln -sr lib/* share/"$_pkgname"
}
package_maa-assistant-arknights-cuda() {
cmake --install "$srcdir"/build-cuda --prefix "$pkgdir"/usr
cd "$pkgdir"/usr/
mkdir -p share/"$_pkgname"
mv Python resource share/"$_pkgname"
ln -sr lib/* share/"$_pkgname"
}
|