File: README.md

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (120 lines) | stat: -rw-r--r-- 2,452 bytes parent folder | download | duplicates (2)
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
# How to add a new external library

The following procedure will walk you through adding a new third-party
library to GRASS GIS.

## License

Before you start, make sure that the library you want to include is in
compliance with the GRASS GIS licence.

### Approved Third-Party Licenses

* MIT/X
* GPLv2
* LGPL 2.1
* MPL 2.0
* BSD-3-Clause
* Public Domain

## Procedure

* Create a directory that will contain the new library's files
in `lib/external/<new-library>`

* Add the new libraries header and source files, license, and README to the newly
created directory.

* Add a new `Makefile` to the directory.

```make
MODULE_TOPDIR = ../../..

# replace SHAPE with new library name
LIB = SHAPE

include $(MODULE_TOPDIR)/include/Make/Lib.make

default: headers
    $(MAKE) lib

# Update header file reference to the new library
headers: $(ARCH_INCDIR)/shapefil.h

$(ARCH_INCDIR)/%.h: %.h
    $(INSTALL_DATA) $< $@
```

* Update `lib/external/Makefile` to include the new subdirectory.

```make
MODULE_TOPDIR = ../..

SUBDIRS = \
    ccmath  \
    parson  \
    shapelib \
    # Add new directory here

include $(MODULE_TOPDIR)/include/Make/Dir.make

default: parsubdirs
```

* Update the `lib/external/README.license` with a new entry containing
 the *library name*, *license*, *description*, *version*, *copyright*,
 and *authors name*.

```txt
* parson/ (MIT/X)
   JSON parsing and encoding functions version 1.5.2.
   Copyright (c) 2022, Krzysztof Gabis
```

* Update `lib/README` with a new entry under external libraries.

```md
 external: external libraries
    - external/parson: JSON serialization and deserialization functions
    - external/shapelib: SHAPE file management functions
    <!-- - Add new entry here -->
```

* Update `include/Make/Install.make`

```make
-cp -rL --parents lib/external/<new library> ./grass-lib-$(GRASS_VERSION_NUMBER)
```

* Add reference to library in `include/Make/Grass.make` in alphabetical order.

```make
<Uppercase library name>:<Lowercase library name>

# example for the parson library
PARSON:parson \
```

* Add reference to library in the root `Makefile`.

```make
LIBDIRS = \
    lib/external/parson \
    lib/external/shapelib \
    # New reference
    ...
```

* The library should now be able to successfully compile.

To test run the `make` command.

```bash
make
```

* If no errors are found the library should now be able to be used in development.

```c
#include <grass/<new-library.h>
```