bcrypt_elixir icon indicating copy to clipboard operation
bcrypt_elixir copied to clipboard

Using Mingw compiler on Windows

Open remigijusj opened this issue 4 years ago • 0 comments

I wonder if it would be possible to support this option. It looks a much easier setup to me - no need to have Visual studio. I have a local installation of the compiler, the version is MinGW-W64-builds-4.3.0 (I have no doubt other versions work fine, too).

The patch I have for bcrypt_elixir:

diff --git a/Makefile b/Makefile
index 77ea2da..12635f3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+CC = gcc
 CFLAGS ?= -g -O3
 CFLAGS += -Wall -Wno-format-truncation

@@ -5,7 +6,7 @@ CFLAGS += -I"$(ERTS_INCLUDE_DIR)"
 CFLAGS += -Ic_src

 PRIV_DIR = $(MIX_APP_PATH)/priv
-LIB_NAME = $(PRIV_DIR)/bcrypt_nif.so
+LIB_NAME = $(PRIV_DIR)/bcrypt_nif.dll
 ifneq ($(CROSSCOMPILE),)
     # crosscompiling
     CFLAGS += -fPIC

diff --git a/mix.exs b/mix.exs
index 40ff3f8..6672e3f 100644
--- a/mix.exs
+++ b/mix.exs
@@ -15,6 +15,8 @@ defmodule BcryptElixir.Mixfile do
       elixir: "~> 1.7",
       start_permanent: Mix.env() == :prod,
       compilers: [:elixir_make] ++ Mix.compilers(),
+      make_executable: "mingw32-make",
+      make_makefile: "Makefile",
       make_targets: ["all"],
       make_clean: ["clean"],
       description: @description,

Unfortunately I don't have good knowledge how to integrate this patch in a robust way.

remigijusj avatar Jun 21 '21 08:06 remigijusj