From 769bc44921da2fb907dde11b4efd354187ca86ae Mon Sep 17 00:00:00 2001 From: Christiano Haesbaert Date: Fri, 14 Apr 2017 20:40:01 +0200 Subject: [PATCH] Convert to topkg build. --- .gitignore | 2 +- .travis.yml | 20 ++++++++++++++------ CHANGES.md | 20 ++++++++++++++++++++ LICENSE => LICENSE.md | 0 README.md | 4 +--- _tags | 7 +++---- all.itarget | 5 ----- build.sh | 2 +- doc/api.odocl | 2 ++ myocamlbuild.ml | 3 +-- opam | 9 +++++---- {lib => pkg}/META | 5 +++-- pkg/pkg.ml | 14 ++++++++++++++ rawlink.install | 23 ----------------------- 14 files changed, 65 insertions(+), 51 deletions(-) create mode 100644 CHANGES.md rename LICENSE => LICENSE.md (100%) delete mode 100644 all.itarget create mode 100644 doc/api.odocl rename {lib => pkg}/META (73%) create mode 100644 pkg/pkg.ml delete mode 100644 rawlink.install diff --git a/.gitignore b/.gitignore index 2181ea6..5c4e8f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *.byte *.native -*.cma _build +rawlink.install diff --git a/.travis.yml b/.travis.yml index b8ee7ae..a210a14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,19 @@ env: global: - PACKAGE="rawlink.9999" matrix: - - DISTRO="debian-stable" OCAML_VERSION="4.02.3" - - DISTRO="debian-testing" OCAML_VERSION="4.03.0" - - DISTRO="ubuntu-14.04" OCAML_VERSION="4.02.3" - - DISTRO="ubuntu-16.04" OCAML_VERSION="4.02.3" - - DISTRO="centos-7" OCAML_VERSION="4.02.3" - - DISTRO="centos-6" OCAML_VERSION="4.02.3" - DISTRO="alpine-3.4" OCAML_VERSION="4.03.0" + - DISTRO="alpine-3.4" OCAML_VERSION="4.04.0" + - DISTRO="centos-6" OCAML_VERSION="4.03.0" + - DISTRO="centos-6" OCAML_VERSION="4.04.0" + - DISTRO="centos-7" OCAML_VERSION="4.03.0" + - DISTRO="centos-7" OCAML_VERSION="4.04.0" + - DISTRO="debian-stable" OCAML_VERSION="4.03.0" + - DISTRO="debian-stable" OCAML_VERSION="4.04.0" + - DISTRO="debian-testing" OCAML_VERSION="4.03.0" + - DISTRO="debian-testing" OCAML_VERSION="4.04.0" - DISTRO="fedora-24" OCAML_VERSION="4.03.0" + - DISTRO="fedora-24" OCAML_VERSION="4.04.0" + - DISTRO="ubuntu-14.04" OCAML_VERSION="4.03.0" + - DISTRO="ubuntu-14.04" OCAML_VERSION="4.04.0" + - DISTRO="ubuntu-16.04" OCAML_VERSION="4.03.0" + - DISTRO="ubuntu-16.04" OCAML_VERSION="4.04.0" diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..b19e363 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,20 @@ +## 0.5 (2017-04-16) + +* Convert to topkg + +## 0.4 (2016-12-17) + +* Convert to ppx + +## 0.3 (2015-08-30) + +* Fix fd leak in bpf_open +* Fix linux send function + +## 0.2 (2015-08-28) + +* Fix to bpf_split_buf + +## 0.1 (2015-10-09) + +* Initial release diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/README.md b/README.md index 78c6ecd..5807009 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# Rawlink - -A portable library to read and write raw packets. +## Rawlink - portable library to read and write raw packets. [![Build Status](https://travis-ci.org/haesbaert/rawlink.svg)](https://travis-ci.org/haesbaert/rawlink) diff --git a/_tags b/_tags index af0f860..01dfb38 100644 --- a/_tags +++ b/_tags @@ -1,7 +1,6 @@ -true: debug, bin_annot, strict_sequence -true: package(cstruct), package(cstruct.ppx) -true: package(lwt.unix), package(lwt.ppx), ppopt(-lwt-debug) +true: color(auto), debug, bin_annot, strict_sequence +true: package(cstruct cstruct.ppx lwt.unix lwt.ppx) true: use_rawlink_stubs - +"lib": include <*.byte>: linkdep(rawlink_stubs.o), custom <*.native>: linkdep(rawlink_stubs.o) diff --git a/all.itarget b/all.itarget deleted file mode 100644 index ee0e74d..0000000 --- a/all.itarget +++ /dev/null @@ -1,5 +0,0 @@ -lib/rawlink.cma -lib/rawlink.cmxa -lib/lwt_rawlink.cma -lib/lwt_rawlink.cmxa -lib/librawlink_stubs.a diff --git a/build.sh b/build.sh index 60a02c9..cb5374e 100755 --- a/build.sh +++ b/build.sh @@ -15,4 +15,4 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -ocamlbuild -no-links -use-ocamlfind all.otarget $@ +topkg build diff --git a/doc/api.odocl b/doc/api.odocl new file mode 100644 index 0000000..3c1a7a3 --- /dev/null +++ b/doc/api.odocl @@ -0,0 +1,2 @@ +Rawlink +Lwt_rawlink diff --git a/myocamlbuild.ml b/myocamlbuild.ml index c923fb9..f3568ff 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -19,13 +19,12 @@ dispatch begin function | After_rules -> pflag ["ocaml";"compile";] "ppopt" (fun s -> S [A"-ppopt"; A s]); pflag ["ocaml";"ocamldep";] "ppopt" (fun s -> S [A"-ppopt"; A s]); - pdep ["link"] "linkdep" (fun param -> [param]); (* Linking generated stubs *) dep ["ocaml"; "link"; "byte"; "library"; "use_rawlink_stubs"] ["lib/dllrawlink_stubs"-.-(!Options.ext_dll)]; flag ["ocaml"; "link"; "byte"; "library"; "use_rawlink_stubs"] & S[A"-dllib"; A"-lrawlink_stubs"]; - + pdep ["link"] "linkdep" (fun param -> [param]); dep ["ocaml"; "link"; "native"; "library"; "use_rawlink_stubs"] ["lib/librawlink_stubs"-.-(!Options.ext_lib)]; flag ["ocaml"; "link"; "native"; "library"; "use_rawlink_stubs"] & diff --git a/opam b/opam index 8aa1e7d..0b0d01a 100644 --- a/opam +++ b/opam @@ -1,19 +1,20 @@ opam-version: "1.2" name: "rawlink" -version: "0.4" maintainer: "Christiano F. Haesbaert " authors: "Christiano F. Haesbaert " +license: "ISC" homepage: "https://github.com/haesbaert/rawlink" bug-reports: "https://github.com/haesbaert/rawlink/issues" -license: "ISC" dev-repo: "https://github.com/haesbaert/rawlink.git" -build: ["sh" "build.sh"] +doc: "https://haesbaert.github.io/rawlink/api" +build: [ "ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" ] depends: [ "ocamlfind" {build} + "topkg" {build} "lwt" {>= "2.4.7"} "cstruct" {>= "1.9"} "ocamlbuild" {build} ] depexts: [[ ["alpine"] ["linux-headers"] ]] -available: [ocaml-version >= "4.02.3"] +available: [ocaml-version >= "4.03.0"] diff --git a/lib/META b/pkg/META similarity index 73% rename from lib/META rename to pkg/META index 246d206..cbddc36 100644 --- a/lib/META +++ b/pkg/META @@ -1,9 +1,10 @@ -version = "0.4" +version = "%%VERSION_NUM%%" description = "Rawlink is a portable interface to BPF/AF_SOCKET" requires = "unix lwt.unix lwt cstruct cstruct.ppx" archive(byte) = "rawlink.cma" +plugin(byte) = "rawlink.cma" archive(byte, plugin) = "rawlink.cma" archive(native) = "rawlink.cmxa" -archive(native, plugin) = "rawlink.cmxs" +plugin(native) = "rawlink.cmxs" exists_if = "rawlink.cma" diff --git a/pkg/pkg.ml b/pkg/pkg.ml new file mode 100644 index 0000000..447cc1c --- /dev/null +++ b/pkg/pkg.ml @@ -0,0 +1,14 @@ +#!/usr/bin/env ocaml +#use "topfind" +#require "topkg" +open Topkg + +let () = + let opams = + [ Pkg.opam_file "opam" ~lint_deps_excluding:(Some ["ppx_tools" ; "ppx_sexp_conv"]) ] + in + Pkg.describe ~opams "rawlink" @@ fun _ -> + Ok [ + Pkg.clib "lib/librawlink_stubs.clib"; + Pkg.mllib "lib/rawlink.mllib"; + ]; diff --git a/rawlink.install b/rawlink.install deleted file mode 100644 index 4c352af..0000000 --- a/rawlink.install +++ /dev/null @@ -1,23 +0,0 @@ -lib: [ - "lib/META" {"META"} - - "_build/lib/librawlink_stubs.a" {"librawlink_stubs.a"} - - "_build/lib/rawlink.a" {"rawlink.a"} - "_build/lib/rawlink.cma" {"rawlink.cma"} - "_build/lib/rawlink.cmi" {"rawlink.cmi"} - "_build/lib/rawlink.cmt" {"rawlink.cmt"} - "_build/lib/rawlink.cmti" {"rawlink.cmti"} - "_build/lib/rawlink.cmx" {"rawlink.cmx"} - "_build/lib/rawlink.cmxa" {"rawlink.cmxa"} - "_build/lib/rawlink.mli" {"rawlink.mli"} - - "_build/lib/lwt_rawlink.a" {"lwt_rawlink.a"} - "_build/lib/lwt_rawlink.cma" {"lwt_rawlink.cma"} - "_build/lib/lwt_rawlink.cmi" {"lwt_rawlink.cmi"} - "_build/lib/lwt_rawlink.cmt" {"lwt_rawlink.cmt"} - "_build/lib/lwt_rawlink.cmti" {"lwt_rawlink.cmti"} - "_build/lib/lwt_rawlink.cmx" {"lwt_rawlink.cmx"} - "_build/lib/lwt_rawlink.cmxa" {"lwt_rawlink.cmxa"} - "_build/lib/lwt_rawlink.mli" {"lwt_rawlink.mli"} -]