This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new 42c24843e Update fast_pbkdf2 to upstream d079c45 (#4944)
42c24843e is described below

commit 42c24843e2759144381b8c2ae80dd2a003ccc899
Author: Ronny Berndt <[email protected]>
AuthorDate: Thu Jan 4 08:22:45 2024 +0100

    Update fast_pbkdf2 to upstream d079c45 (#4944)
---
 .credo.exs                          |  1 +
 src/fast_pbkdf2/Makefile            | 39 -----------------
 src/fast_pbkdf2/benchmarks/bench.ex |  7 ++--
 src/fast_pbkdf2/mix.exs             |  2 +-
 src/fast_pbkdf2/rebar.config        | 83 ++++++++++++++++++++++---------------
 src/fast_pbkdf2/rebar.config.script |  8 ++++
 6 files changed, 62 insertions(+), 78 deletions(-)

diff --git a/.credo.exs b/.credo.exs
index 59e5550fe..a07bb48a3 100644
--- a/.credo.exs
+++ b/.credo.exs
@@ -27,6 +27,7 @@
           ~r"/node_modules/",
           ~r"/src/certifi/",
           ~r"/src/excoveralls/",
+          ~r"/src/fast_pbkdf2/",
           ~r"/src/jason",
           ~r"/src/hackney",
           ~r"/src/httpotion",
diff --git a/src/fast_pbkdf2/Makefile b/src/fast_pbkdf2/Makefile
deleted file mode 100644
index b4457cc5c..000000000
--- a/src/fast_pbkdf2/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-.PHONY: rel deps test
-
-REBARVER = 3.13.2
-ifeq ($(OTPVER),24.0)
-       REBARVER = 3.15.1
-endif
-
-all: deps compile
-
-compile: rebar3
-       ./rebar3 compile
-
-deps: rebar3
-       ./rebar3 get-deps
-
-clean: rebar3
-       ./rebar3 clean
-
-test-deps: rebar3
-       ./rebar3 get-deps
-
-test-compile: rebar3 test-deps
-       ./rebar3 as test compile
-
-test: test-compile
-       ./rebar3 as test ct
-
-codecov: _build/test/cover/ct.coverdata
-       ./rebar3 as test codecov analyze
-
-gcov: test-compile
-       gcov -o c_src fast_pbkdf2
-
-rebar3:
-       wget 
https://github.com/erlang/rebar3/releases/download/${REBARVER}/rebar3 &&\
-       chmod u+x rebar3
-
-dialyzer: rebar3
-       ./rebar3 dialyzer
diff --git a/src/fast_pbkdf2/benchmarks/bench.ex 
b/src/fast_pbkdf2/benchmarks/bench.ex
index 1ac9fd14b..79464c8df 100644
--- a/src/fast_pbkdf2/benchmarks/bench.ex
+++ b/src/fast_pbkdf2/benchmarks/bench.ex
@@ -1,5 +1,4 @@
 defmodule PBKDF2.Benchmarks do
-  @moduledoc "blank"
   def pbkdf2_input itCount do
     password = :base64.encode(:crypto.strong_rand_bytes(10))
     salt = :base64.encode(:crypto.strong_rand_bytes(16))
@@ -26,9 +25,9 @@ Benchee.run(
     "1. 8" => PBKDF2.Benchmarks.pbkdf2_input(8),
     "2. 512" => PBKDF2.Benchmarks.pbkdf2_input(512),
     "3. 4096" => PBKDF2.Benchmarks.pbkdf2_input(4096),
-    "4. 10000" => PBKDF2.Benchmarks.pbkdf2_input(10_000),
-    "5. 160000" => PBKDF2.Benchmarks.pbkdf2_input(160_000),
-    "6. 500000" => PBKDF2.Benchmarks.pbkdf2_input(500_000)
+    "4. 10000" => PBKDF2.Benchmarks.pbkdf2_input(10000),
+    "5. 160000" => PBKDF2.Benchmarks.pbkdf2_input(160000),
+    "6. 500000" => PBKDF2.Benchmarks.pbkdf2_input(500000)
   },
   parallel: 12,
   time: 5,
diff --git a/src/fast_pbkdf2/mix.exs b/src/fast_pbkdf2/mix.exs
index c3d2a6124..b581df457 100644
--- a/src/fast_pbkdf2/mix.exs
+++ b/src/fast_pbkdf2/mix.exs
@@ -1,4 +1,4 @@
-defmodule FastPbkdf2.MixProject do
+defmodule Fast_Pbkdf2.MixProject do
   use Mix.Project
 
   def project do
diff --git a/src/fast_pbkdf2/rebar.config b/src/fast_pbkdf2/rebar.config
index 780eed636..391bcba45 100644
--- a/src/fast_pbkdf2/rebar.config
+++ b/src/fast_pbkdf2/rebar.config
@@ -1,6 +1,6 @@
 {erl_opts, [
   deterministic
- ]}.
+]}.
 
 {deps, []}.
 
@@ -10,51 +10,66 @@
     {deps, [
       {base16, "2.0.1"},
       {proper, "1.4.0"}
-     ]},
+    ]},
     {plugins, [
-       {rebar3_codecov, "0.3.0"}
-     ]},
-    {port_env,
-     [
-      {"CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC --coverage"},
-      {"LDFLAGS", "$LDFLAGS --coverage"},
-      {"LDLIBS", "$LDLIBS -lcrypto"},
-      {"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}
-     ]}
-   ]}
- ]
+      {rebar3_codecov, "0.6.0"}]},
+      {port_env,
+        [
+          {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
+               "CFLAGS", "$CFLAGS -std=c99 -O0 -g -Wall -Wextra -fPIC 
-I/opt/homebrew/include -I/usr/local/include --coverage"},
+          {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
+               "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ 
-L/usr/local/lib --coverage"}
+        ]
+      }
+  ]}
+]
 }.
 
-{plugins, [pc, rebar3_hex]}.
+{plugins, [pc]}.
 
-{artifacts, ["priv/fast_pbkdf2.so"]}.
+{port_env,
+  [
+    {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
+         "CFLAGS", "$CFLAGS -std=c99 -O3 -g -Wall -Wextra -fPIC 
-I/opt/homebrew/include -I/usr/local/include"},
+    {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
+         "LDLIBS", "$LDLIBS -lcrypto -L/opt/homebrew/lib/ -L/usr/local/lib"},
+    {"win32", "CFLAGS", "$CFLAGS /I${OPENSSL_INSTALL_DIR}/include /O2 /DNDEBUG 
/Wall"},
+    {"win32", "LDLIBS", "$LDLIBS /LIBPATH:${OPENSSL_INSTALL_DIR}/lib 
libcrypto.lib"},
+    {"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}
+  ]
+}.
 
 {port_specs,
- [
+  [
     {
-        % Any arch
-        ".*",
-        % Create library
-        "priv/fast_pbkdf2.so",
-        % From files
-        ["c_src/*.c"],
-        % Using options
-        [ {env, [{"(linux|solaris|darwin|freebsd)", "CFLAGS", "$CFLAGS 
-std=c99 -O3 -g -Wall -Wextra -fPIC -I/opt/homebrew/include/"},
-                 {"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"},
-                 {"(linux|solaris|darwin|freebsd)", "LDLIBS", "$LDLIBS 
-lcrypto -L /opt/homebrew/lib/"},
-                 {"win32", "LDLIBS", "$LDLIBS libcrypto.lib"},
-                 {"DRV_LINK_TEMPLATE", "$DRV_LINK_TEMPLATE $LDLIBS"}]}]
-     }
- ]}.
+      % Any arch
+      ".*",
+      % Create library
+      "priv/fast_pbkdf2.so",
+      % From files
+      ["c_src/*.c"]
+    }
+  ]}.
 
 {provider_hooks,
- [
+  [
     {post,
-     [
+      [
         {compile, {pc, compile}},
         {clean, {pc, clean}}
-     ]}
- ]}.
+      ]}
+  ]}.
 
 {cover_enabled, true}.
 {cover_export_enabled, true}.
+
+{project_plugins, [
+    rebar3_hex,
+    rebar3_ex_doc
+]}.
+
+{hex, [{doc, ex_doc}]}.
+
+{ex_doc, [
+    {source_url, <<"https://github.com/esl/fast_pbkdf2";>>}
+]}.
diff --git a/src/fast_pbkdf2/rebar.config.script 
b/src/fast_pbkdf2/rebar.config.script
new file mode 100644
index 000000000..7b602ec3d
--- /dev/null
+++ b/src/fast_pbkdf2/rebar.config.script
@@ -0,0 +1,8 @@
+Artifacts =  case os:type() of
+    {win32, _} ->
+        [{artifacts, ["priv/fast_pbkdf2.dll"]}];
+    _ ->
+        [{artifacts, ["priv/fast_pbkdf2.so"]}]
+end,
+
+CONFIG ++ Artifacts.

Reply via email to