summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ac2cab476b4c256fbefa8a474955d16edc2e6def (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Maintainer: archlinuxauruser <archlinuxauruser at messagebox dot email>
# Contributor: Julien Desgats <julien at desgats dot fr>

pkgname=osrm-backend
pkgver=26.7.3
pkgrel=1
pkgdesc="High performance routing engine written in C++14 designed to run on OpenStreetMap data."
arch=('x86_64')
url="https://github.com/Project-OSRM/${pkgname}"
license=('BSD-2-Clause') # https://spdx.org/licenses/
	# acl
	# boost
	# brotli
	# gcc-libs
	# git
	# libxml2
	# libzip
	# lz4
	# openssl
	# xz
	# zstd
depends=(
	boost-libs
	bzip2
	expat
	libarchive
	lua54
	onetbb
	zlib
)
# libtool
	# gcc
	# glibc
makedepends=(
	cmake
	doxygen
	flatbuffers
	fmt
	graphviz
	libosmium
	ninja
	pkgconf
	protozero
	qt6-base
	rapidjson
	sol2
	vtzero
)
checkdepends=(
	jq
	nodejs
)
provides=("${pkgname}")
conflicts=("${pkgname}")

source=("${pkgname}-${pkgver}-LICENSE::${url/github/raw.githubusercontent}/refs/heads/master/LICENSE.TXT"
	"${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
       # "${pkgname}-${pkgver}.patch::${url}/pull/7589.diff")
	# "${pkgname}-${pkgver}.patch")

b2sums=('7e714e99eaea01b1ce336c74e2f4a6f5af6aa059ef16d0e353864c7e188df88682ea5a41b94d42e6daeabfd96e7f352790e04a0bb273c1633747c17e5c348f5a'
        '4e6450478ff77abd9e3d3d5d9a730099844abbd8f4aac62e220f91a62e76a90deae0870d255a81cd3a604493265df639ace105c6557d4efb45131a717b7dbb09')
        # '27eaaf313bfcc8485c9d0867c79cf6871e2067ebd1d3b8b43429de101f18799dd17c10a0b301fdfd5e36a41ca4815083058083e9a50e1c1a13a17604d50aa3ec')

prepare() {
	cd "${pkgname}-${pkgver}"
	echo

	# cd ${pkgname}
	# git -c protocol.file.allow=always submodule update --init --recursive --depth=1
	# git submodule update --init --recursive --depth=1

	sed -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' -i CMakeLists.txt
	# patch -Np1 -i ../"${pkgname}-${pkgver}.patch"

	# for p in ../*.patch; do
	# 	patch -Np1 -i "$p"
	# done
}

build() {
	cd "$pkgname-$pkgver"

	local cmake_options=(
		# -B <path-to-build>           = Explicitly specify a build directory.
		# This is relative to /src
		-B build

		# -S <path-to-source>          = Explicitly specify a source directory.
		# -S "${srcdir}/${pkgname}-${pkgver}"
		# Set to debug to generate debugging symbol output
		# -D CMAKE_BUILD_TYPE=Debug
		# -D CMAKE_BUILD_TYPE=RelWithDebInfo
		-D CMAKE_BUILD_TYPE=None
		-D CMAKE_INSTALL_PREFIX=/usr
		-D CMAKE_INSTALL_LIBDIR=lib
		-D BUILD_SHARED_LIBS=ON
		-D LUA_INCLUDE_DIR=/usr/include/lua5.4
		# -D LUA_LIBRARIES=/usr/lib/liblua.so
		-W no-dev
		# -D CMAKE_C_FLAGS="-D_FORTIFY_SOURCE=2"
		# -D CMAKE_CXX_FLAGS="-D_FORTIFY_SOURCE=2"
	)
	cmake "${cmake_options[@]}"
	# make VERBOSE=1

	cmake --build build
}
check(){
	# https://github.com/Project-OSRM/osrm-backend/blob/master/docs/testing.md
	# https://deepwiki.com/Project-OSRM/osrm-backend/1.3-building-from-source
	# https://github.com/Project-OSRM/osrm-backend/blob/d8ff021d/docs/testing.md?plain=1#L33-L47

	# pwd is src/
	cd "$pkgname-$pkgver"
	echo -e "PWD::$(pwd)" # /build/osrm-backend/src/osrm-backend-26.5.0
 
	echo -e "# ----------------------------------------------------"
	echo -e "# Prepare the test data by preprocessing the dataset"
	echo -e "# ----------------------------------------------------"
	cd test/data/
	echo -e "PWD::$(pwd)"
	make

	
	echo -e "# -----------------------------"
	echo -e "# Build the unit tests"
	echo -e "# -----------------------------"
	echo -e "PWD::$(pwd)"
	cd ../../build/
	# cd build
	echo -e "PWD::$(pwd)"
	echo -e "------------------------- cmake .. ----------------------------"
	local cmake_options=(
		# --debug-output
		# Code fails without these supressions
		-D CMAKE_C_FLAGS="-Wno-error=uninitialized"
		-D CMAKE_CXX_FLAGS="-Wno-error=uninitialized"
		-W no-dev
	)
	# cmake -j$(nproc) tests
	cmake "${cmake_options[@]}" ..
	echo -e "PWD::$(pwd)"

	echo -e "------------------------- make tests ----------------------------"
	make tests
	# make --debug=a tests
	echo -e "PWD::$(pwd)"
	# cd build
	echo -e "PWD::$(pwd)"

	echo -e "# ----------------------------------------------------"
	echo -e "# Run each binary suite individually"
	echo -e "# ----------------------------------------------------"
	# You should see the compiled binaries in `build/unit_tests`, you can then run each suite individually:
	for i in ./unit_tests/*-tests ; do 
	    echo "Running $i"
	    $i
	done
}

package() {
	# echo -e "PWD: $(pwd)"
	cd "$pkgname-$pkgver"
	DESTDIR="${pkgdir}/" cmake --install build
	# install -Dvm644 -T "${srcdir}/${pkgname}-${pkgver}/LICENSE.TXT" ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
	install -Dvm644 -T ./LICENSE.TXT ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}