Skip to content

Commit

Permalink
OASIS → topkg (fixes #1).
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Oct 10, 2014
1 parent 8734642 commit 00ebaa2
Show file tree
Hide file tree
Showing 17 changed files with 415 additions and 133 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
_build
*.native
*.byte
*.bak
setup.log
setup.data
24 changes: 24 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

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 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.

For more information, please refer to <http://unlicense.org/>
59 changes: 21 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,24 @@
# OASIS_START
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
build:
ocaml pkg/build.ml native=true native-dynlink=true

SETUP = ocaml setup.ml

build: setup.data
$(SETUP) -build $(BUILDFLAGS)

doc: setup.data build
$(SETUP) -doc $(DOCFLAGS)

test: setup.data build
$(SETUP) -test $(TESTFLAGS)

all:
$(SETUP) -all $(ALLFLAGS)

install: setup.data
$(SETUP) -install $(INSTALLFLAGS)

uninstall: setup.data
$(SETUP) -uninstall $(UNINSTALLFLAGS)

reinstall: setup.data
$(SETUP) -reinstall $(REINSTALLFLAGS)
test: build
rm _build/src_test/ -rf
ocamlbuild -classic-display -use-ocamlfind src_test/test_ppx_getenv.byte --

clean:
$(SETUP) -clean $(CLEANFLAGS)

distclean:
$(SETUP) -distclean $(DISTCLEANFLAGS)

setup.data:
$(SETUP) -configure $(CONFIGUREFLAGS)

configure:
$(SETUP) -configure $(CONFIGUREFLAGS)

.PHONY: build doc test all install uninstall reinstall clean distclean configure

# OASIS_STOP
ocamlbuild -clean

.PHONY: build test clean

release:
@if [ -z "$(VERSION)" ]; then echo "Usage: make release VERSION=1.0.0"; exit 1; fi
git checkout -B release
sed -i 's/%%VERSION%%/$(VERSION)/' pkg/META
git add .
git commit -m "Prepare for release."
git tag -a v$(VERSION) -m "Version $(VERSION)"
git checkout @{-1}
git branch -D release
git push origin v$(VERSION)

.PHONY: release
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ A sample syntax extension that uses OCaml's new extension points API.
Take a look at [the guide to extension points in OCaml][guide].

[guide]: http://whitequark.org/blog/2014/04/16/a-guide-to-extension-points-in-ocaml/

License
-------

[Public domain](LICENSE.txt)
25 changes: 0 additions & 25 deletions _oasis

This file was deleted.

4 changes: 4 additions & 0 deletions _tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
true: warn(@5@8@10@11@12@14@23@24@26@29@40), bin_annot, safe_string

<src/*.{ml,mli,byte,native}>: package(ppx_tools.metaquot)
<src_test/*.{ml,byte,native}>: debug, package(oUnit)
27 changes: 0 additions & 27 deletions configure

This file was deleted.

13 changes: 10 additions & 3 deletions myocamlbuild.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
open Ocamlbuild_plugin

(* used in tests *)
let _ =
Unix.putenv "PPX_GETENV_CHECK" "42"

(* OASIS_START *)
(* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;;
let () = dispatch (
function
| After_rules ->
flag ["ocaml"; "compile"; "ppx_byte"] &
S[A"-ppx"; A"src/ppx_getenv.byte"];
flag ["ocaml"; "compile"; "ppx_native"] &
S[A"-ppx"; A"src/ppx_getenv.native"]
| _ -> ())
20 changes: 20 additions & 0 deletions opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
opam-version: "1.2"
maintainer: "Peter Zotov <whitequark@whitequark.org>"
authors: [ "Peter Zotov <whitequark@whitequark.org>" ]
license: "Public domain"
homepage: "https://github.com/whitequark/ppx_getenv"
bug-reports: "https://github.com/whitequark/ppx_getenv/issues"
dev-repo: "git://github.com/whitequark/ppx_getenv.git"
tags: [ "syntax" ]
build: [
"ocaml" "pkg/build.ml" "native=%{ocaml-native}%"
"native-dynlink=%{ocaml-native-dynlink}%"
]
build-test: [
"ocamlbuild" "-classic-display" "-use-ocamlfind" "src_test/test_ppx_getenv.byte" "--"
]
depends: [
"ppx_tools" {>= "0.99.1"}
"ounit" {test}
]
available: [ocaml-version >= "4.02.0"]
3 changes: 3 additions & 0 deletions pkg/META
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version = "%%VERSION%%"
description = "A -ppx extension to replace [%getenv "<var>"] with compile-time value"
ppx = "./ppx_getenv"
15 changes: 15 additions & 0 deletions pkg/build.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ocaml
#directory "pkg"
#use "topkg.ml"

let () =
let oc = open_out "src_test/_tags" in
output_string oc (if Env.native then "<*.ml>: ppx_native" else "<*.ml>: ppx_byte");
close_out oc

let () =
Pkg.describe "ppx_getenv" ~builder:`OCamlbuild [
Pkg.lib "pkg/META";
Pkg.bin ~auto:true "src/ppx_getenv" ~dst:"../lib/ppx_getenv/ppx_getenv";
Pkg.doc "README.md";
Pkg.doc "LICENSE.txt"]
Loading

0 comments on commit 00ebaa2

Please sign in to comment.