mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-05 19:00:32 -05:00
Processing to fix incompatible -O and gcc flags
Two changes: 1. Accept BUILD_TINY_HTTPD_OPTLEVEL envvar to adjust the -O<num> level. Defaults to 2. Can be negative to remove it entirely, which fixes errors with MSVC which will bail on incompatible options. 2. Do not use -fPIC with MSVC
This commit is contained in:
parent
1f60d6165d
commit
1e0bbc7f39
4 changed files with 29 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
(lang dune 2.9)
|
(lang dune 3.2)
|
||||||
(name tiny_httpd)
|
(name tiny_httpd)
|
||||||
(generate_opam_files true)
|
(generate_opam_files true)
|
||||||
|
|
||||||
|
|
|
||||||
27
src/ws/dune
27
src/ws/dune
|
|
@ -1,3 +1,28 @@
|
||||||
|
; Set BUILD_TINY_HTTPD_OPTLEVEL to the -O<num> level.
|
||||||
|
; Defaults to 2, which means -O2 is the default C optimization flag.
|
||||||
|
; Use -1 to remove the -O<num> flag entirely.
|
||||||
|
(rule
|
||||||
|
(enabled_if (>= %{env:BUILD_TINY_HTTPD_OPTLEVEL=2} 0))
|
||||||
|
(target optlevel.string)
|
||||||
|
(deps (env_var BUILD_TINY_HTTPD_OPTLEVEL))
|
||||||
|
(action (with-stdout-to %{target} (echo "-O%{env:BUILD_TINY_HTTPD_OPTLEVEL=2}"))))
|
||||||
|
(rule
|
||||||
|
(enabled_if (< %{env:BUILD_TINY_HTTPD_OPTLEVEL=2} 0))
|
||||||
|
(target optlevel.string)
|
||||||
|
(deps (env_var BUILD_TINY_HTTPD_OPTLEVEL))
|
||||||
|
(action (with-stdout-to %{target} (echo ""))))
|
||||||
|
|
||||||
|
; All compilers will include the optimization level.
|
||||||
|
; Non-MSVC compilers will include `-std=c99 -fPIC`.
|
||||||
|
(rule
|
||||||
|
(enabled_if (= %{ocaml-config:ccomp_type} msvc))
|
||||||
|
(target cflags.sexp)
|
||||||
|
(action (with-stdout-to %{target} (echo "(%{read:optlevel.string})"))))
|
||||||
|
(rule
|
||||||
|
(enabled_if (not (= %{ocaml-config:ccomp_type} msvc)))
|
||||||
|
(target cflags.sexp)
|
||||||
|
(action (with-stdout-to %{target} (echo "(-std=c99 -fPIC %{read:optlevel.string})"))))
|
||||||
|
|
||||||
(library
|
(library
|
||||||
(name tiny_httpd_ws)
|
(name tiny_httpd_ws)
|
||||||
(public_name tiny_httpd.ws)
|
(public_name tiny_httpd.ws)
|
||||||
|
|
@ -7,7 +32,7 @@
|
||||||
(foreign_stubs
|
(foreign_stubs
|
||||||
(language c)
|
(language c)
|
||||||
(names tiny_httpd_ws_stubs)
|
(names tiny_httpd_ws_stubs)
|
||||||
(flags :standard -std=c99 -fPIC -O2))
|
(flags :standard (:include cflags.sexp)))
|
||||||
(libraries
|
(libraries
|
||||||
(re_export tiny_httpd.core)
|
(re_export tiny_httpd.core)
|
||||||
threads))
|
threads))
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ tags: [
|
||||||
homepage: "https://github.com/c-cube/tiny_httpd/"
|
homepage: "https://github.com/c-cube/tiny_httpd/"
|
||||||
bug-reports: "https://github.com/c-cube/tiny_httpd/issues"
|
bug-reports: "https://github.com/c-cube/tiny_httpd/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "2.9"}
|
"dune" {>= "3.2"}
|
||||||
"seq"
|
"seq"
|
||||||
"base-threads"
|
"base-threads"
|
||||||
"result"
|
"result"
|
||||||
|
|
@ -38,11 +38,9 @@ build: [
|
||||||
name
|
name
|
||||||
"-j"
|
"-j"
|
||||||
jobs
|
jobs
|
||||||
"--promote-install-files=false"
|
|
||||||
"@install"
|
"@install"
|
||||||
"@runtest" {with-test}
|
"@runtest" {with-test}
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
["dune" "install" "-p" name "--create-install-files" name]
|
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/c-cube/tiny_httpd.git"
|
dev-repo: "git+https://github.com/c-cube/tiny_httpd.git"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ license: "MIT"
|
||||||
homepage: "https://github.com/c-cube/tiny_httpd/"
|
homepage: "https://github.com/c-cube/tiny_httpd/"
|
||||||
bug-reports: "https://github.com/c-cube/tiny_httpd/issues"
|
bug-reports: "https://github.com/c-cube/tiny_httpd/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "2.9"}
|
"dune" {>= "3.2"}
|
||||||
"tiny_httpd" {= version}
|
"tiny_httpd" {= version}
|
||||||
"camlzip" {>= "1.06"}
|
"camlzip" {>= "1.06"}
|
||||||
"iostream-camlzip" {>= "0.2.1"}
|
"iostream-camlzip" {>= "0.2.1"}
|
||||||
|
|
@ -24,11 +24,9 @@ build: [
|
||||||
name
|
name
|
||||||
"-j"
|
"-j"
|
||||||
jobs
|
jobs
|
||||||
"--promote-install-files=false"
|
|
||||||
"@install"
|
"@install"
|
||||||
"@runtest" {with-test}
|
"@runtest" {with-test}
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
["dune" "install" "-p" name "--create-install-files" name]
|
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/c-cube/tiny_httpd.git"
|
dev-repo: "git+https://github.com/c-cube/tiny_httpd.git"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue