Skip to content

Commit

Permalink
Close snoyberg#145. Create a separate libyaml package.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Franchuk committed Oct 10, 2018
1 parent 4c08154 commit baa8da7
Show file tree
Hide file tree
Showing 27 changed files with 96 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "vendor/libyaml"]
path = vendor/libyaml
path = libyaml/vendor/libyaml
url = https://github.com/snoyberg/libyaml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

Provides support for parsing and emitting Yaml documents.

This package includes the [full libyaml C library version 0.2.1 by Kirill Simonov](https://github.com/yaml/libyaml) in the package so you don't need to worry about any non-Haskell dependencies.
This project includes a `libyaml` package, which has the [full libyaml C library version 0.2.1 by Kirill Simonov](https://github.com/yaml/libyaml) in the package so you don't need to worry about any non-Haskell dependencies.

The package is broken down into two primary modules. `Data.Yaml` provides a high-level interface based around the JSON datatypes provided by the `aeson` package. `Text.Libyaml` provides a lower-level, streaming interface. For most users, `Data.Yaml` is recommended.
The project is broken down into two primary packages/modules. `yaml` contains `Data.Yaml`, which provides a high-level interface based around the JSON datatypes provided by the `aeson` package. `libyaml` contains `Text.Libyaml`, which provides a lower-level, streaming interface. For most users, `yaml` and `Data.Yaml` is recommended.

### Examples

Usage examples can be found in the `Data.Yaml` documentation or in the [examples](https://github.com/snoyberg/yaml/tree/master/examples) directory.

### Additional modules
### Additional `yaml` modules

* `Data.Yaml.Include` supports adding `!include` directives to your YAML files.
* `Data.Yaml.Builder` and `Data.Yaml.Parser` allow more fine-grained control of parsing an rendering, as opposed to just using the aeson typeclass and datatype system for parsing and rendering.
Expand Down
10 changes: 0 additions & 10 deletions copy-libyaml.sh

This file was deleted.

3 changes: 3 additions & 0 deletions libyaml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.stack-work/
libyaml.cabal
*~
6 changes: 6 additions & 0 deletions libyaml/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog for libyaml

## 0.1.0.0

* Split `libyaml` into a separate package from `yaml`. This split occurred at
`yaml` version 0.10.4.0.
File renamed without changes.
3 changes: 3 additions & 0 deletions libyaml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# libyaml

This package provides a haskell wrapper over the [libyaml C library version 0.2.1 by Kirill Simonov](https://github.com/yaml/libyaml). It contains the C source so you don't need to worry about any non-Haskell dependencies.
2 changes: 2 additions & 0 deletions libyaml/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions libyaml/copy-libyaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -ex

rm -rf libyaml_src
mkdir -p libyaml_src
cp vendor/libyaml/LICENSE libyaml_src
cp vendor/libyaml/src/*.c libyaml_src
cp vendor/libyaml/src/*.h libyaml_src
cp vendor/libyaml/include/*.h libyaml_src
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions libyaml/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: libyaml
version: 0.1.0.0
synopsis: Low-level, streaming YAML interface.
description: README and API documentation are available at <https://www.stackage.org/package/libyaml>
category: Text
author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
maintainer: Michael Snoyman <michael@snoyman.com>
license: BSD3
github: snoyberg/yaml
stability: stable

extra-source-files:
- c/helper.h
- libyaml_src/yaml_private.h
- libyaml_src/yaml.h
- libyaml_src/LICENSE
- README.md
- ChangeLog.md

flags:
system-libyaml:
description: Use the system-wide libyaml instead of the bundled copy
manual: false
default: false
no-unicode:
description: Don't enable unicode output. Instead, unicode characters will be escaped.
manual: false
default: false

dependencies:
- base >=4.9.1 && <5 # GHC 8.0.2 and later
- bytestring >=0.9.1.4
- conduit >=1.2.8 && <1.4
- filepath
- resourcet >=0.3 && <1.3

library:
c-sources: c/helper.c
ghc-options: -Wall
include-dirs:
- c
source-dirs: src
when:
- condition: flag(no-unicode)
cpp-options: -D__NO_UNICODE__
- condition: ! '!(flag(system-libyaml))'
then:
c-sources:
- libyaml_src/api.c
- libyaml_src/dumper.c
- libyaml_src/emitter.c
- libyaml_src/loader.c
- libyaml_src/parser.c
- libyaml_src/reader.c
- libyaml_src/scanner.c
- libyaml_src/writer.c
include-dirs:
- libyaml_src
else:
extra-libraries: yaml
- condition: os(windows)
cpp-options: -DWINDOWS

File renamed without changes.
36 changes: 1 addition & 35 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ github: snoyberg/yaml
stability: stable

extra-source-files:
- c/helper.h
- libyaml/yaml_private.h
- libyaml/yaml.h
- libyaml/LICENSE
- test/largest-string.yaml
- test/json.yaml
- test/resources/foo.yaml
Expand All @@ -36,14 +32,6 @@ flags:
description: don't build the examples
manual: false
default: true
system-libyaml:
description: Use the system-wide libyaml instead of the bundled copy
manual: false
default: false
no-unicode:
description: Don't enable unicode output. Instead, unicode characters will be escaped.
manual: false
default: false

dependencies:
- base >=4.9.1 && <5 # GHC 8.0.2 and later
Expand All @@ -62,39 +50,17 @@ dependencies:
- filepath
- directory
- template-haskell
- libyaml >=0.1 && <0.2
when:
condition: "!impl(ghc >= 8.0)"
dependencies:
- semigroups

library:
c-sources: c/helper.c
other-extensions:
- LambdaCase
ghc-options: -Wall
include-dirs:
- c
source-dirs: src
when:
- condition: flag(no-unicode)
cpp-options: -D__NO_UNICODE__
- condition: ! '!(flag(system-libyaml))'
then:
c-sources:
- libyaml/api.c
- libyaml/dumper.c
- libyaml/emitter.c
- libyaml/loader.c
- libyaml/parser.c
- libyaml/reader.c
- libyaml/scanner.c
- libyaml/writer.c
include-dirs:
- libyaml
else:
extra-libraries: yaml
- condition: os(windows)
cpp-options: -DWINDOWS

executables:
json2yaml:
Expand Down
4 changes: 4 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ resolver: lts-11.10
flags:
yaml:
no-examples: false

packages:
- .
- libyaml

0 comments on commit baa8da7

Please sign in to comment.