nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 autoconf,
3 automake,
4 cunit,
5 fetchFromGitHub,
6 fetchpatch,
7 installShellFiles,
8 lib,
9 libtool,
10 libxml2,
11 perl,
12 postgresql,
13 postgresqlBuildExtension,
14 postgresqlTestExtension,
15 postgresqlTestHook,
16 sphinx,
17 which,
18 zlib,
19}:
20postgresqlBuildExtension (finalAttrs: {
21 pname = "pointcloud";
22 version = "1.2.5";
23
24 outputs = [
25 "out"
26 "man"
27 ];
28
29 src = fetchFromGitHub {
30 owner = "pgpointcloud";
31 repo = "pointcloud";
32 tag = "v${finalAttrs.version}";
33 hash = "sha256-uFbScxq21kt0jOjjyfMeO3i+bG2/kWS/Rrt3ZpOqEns=";
34 };
35
36 nativeBuildInputs = [
37 autoconf
38 automake
39 installShellFiles
40 libtool
41 perl
42 # for doc
43 sphinx
44 # needed by the configure phase
45 which
46 ];
47
48 buildInputs = [
49 zlib
50 ];
51
52 doCheck = !(postgresqlTestHook.meta.broken);
53
54 checkInputs = [
55 cunit
56 ];
57
58 nativeCheckInputs = [
59 postgresql
60 postgresqlTestHook
61 ];
62
63 preConfigure = ''
64 ./autogen.sh
65 '';
66
67 configureFlags = [
68 (lib.withFeatureAs true "xml2config" (lib.getExe' (lib.getDev libxml2) "xml2-config"))
69 ];
70
71 postInstall = ''
72 cd doc
73 make man
74 installManPage build/man/pgpointcloud.1
75 '';
76
77 passthru.tests = {
78 extension = postgresqlTestExtension {
79 inherit (finalAttrs) finalPackage;
80 # see https://pgpointcloud.github.io/pointcloud/concepts/schemas.html
81 withPackages = [ "postgis" ];
82 sql = builtins.readFile ./tests.sql;
83 asserts = [
84 {
85 query = "pc_version()";
86 expected = "'${lib.versions.major finalAttrs.version}.${lib.versions.minor finalAttrs.version}.${lib.versions.patch finalAttrs.version}'";
87 description = "pc_version() returns correct values.";
88 }
89 {
90 query = "pc_postgis_version()";
91 expected = "'${lib.versions.major finalAttrs.version}.${lib.versions.minor finalAttrs.version}.${lib.versions.patch finalAttrs.version}'";
92 description = "pc_postgis_version() returns correct values.";
93 }
94 # these tests are taken from the documentation of respective methods
95 {
96 query = "SELECT PC_AsText('010100000064CEFFFF94110000703000000400'::pcpoint)";
97 expected = "'{\"pcid\":1,\"pt\":[-127,45,124,4]}'";
98 description = "Creating a point and displaying as text returns correct string";
99 }
100 {
101 query = "SELECT ST_AsText(PC_MakePoint(1, ARRAY[-127, 45, 124.0, 4.0])::geometry)";
102 expected = "'POINT Z (-127 45 124)'";
103 description = "Casting a pcpoint to a postgis geometry works";
104 }
105 ];
106 };
107 };
108
109 meta = {
110 description = "PostgreSQL extension for storing point cloud (LIDAR) data";
111 longDescription = ''
112 # pgPointcloud - A PostgreSQL extension for storing point cloud (LIDAR) data.
113
114 LIDAR point cloud are becoming more and more available. Devices are easy to get, not too expensive, and provide very accurate 3D points. pgPointCLoud is an open source PostgreSQL extension for storing point cloud data and use it with PostGIS. It is very easy to use, robust and efficient.
115
116 By storing LIDAR points in a PostgreSQL database, pgPointcloud eases many problems and allows a good integration with other geo-spatial data (vector, raster) into one common framework : PostGIS.
117 '';
118 homepage = "https://pgpointcloud.github.io/pointcloud/";
119 changelog = "https://github.com/pgpointcloud/pointcloud/blob/v${finalAttrs.version}/NEWS";
120 license = lib.licenses.bsd3;
121 teams = [ lib.teams.geospatial ];
122 inherit (postgresql.meta) platforms;
123 };
124})