forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/external: Add parson library for JSON (OSGeo#3028)
* lib/external: Added documentation to adding new external libraries * Updated GRASS Programmer's manual docs * update parson from 1.5.2 to 1.5.3 released Oct 31st
- Loading branch information
Showing
13 changed files
with
3,557 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2012 - 2022 Krzysztof Gabis | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
MODULE_TOPDIR = ../../.. | ||
|
||
LIB = PARSON | ||
|
||
include $(MODULE_TOPDIR)/include/Make/Lib.make | ||
|
||
default: headers | ||
$(MAKE) lib | ||
|
||
headers: $(ARCH_INCDIR)/parson.h | ||
|
||
$(ARCH_INCDIR)/%.h: %.h | ||
$(INSTALL_DATA) $< $@ |
Oops, something went wrong.