herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
458 stars 157 forks source link

common.mk: do not assume openssl install path for Darwin #29

Closed aitjcize closed 6 years ago

aitjcize commented 6 years ago

Non-root installation of homebrew does not install openssl under /usr/local. Let user handle the LDFLAG and include path on their own.

herumi commented 6 years ago

How about not changing anything about common.mk and using CFLAGS_USER and LDFLAG_USER for no-root user?

aitjcize commented 6 years ago

I think it does not make sense to assume user installed their openssl under a certain prefix. Just like you won't assume that on other platforms such as Linux. The best way is for the user themselves to specify those if they have a non-standard installation path.

herumi commented 6 years ago

How about https://github.com/herumi/mcl/commit/ac4366e85ed9043cfd7168c3e929183596be18d7 ?

aitjcize commented 6 years ago

that's slightly better, thanks!

aitjcize commented 6 years ago

oops, reopening this as your commit haven't make it's way to master.

herumi commented 6 years ago

Okay, I pushed it to master.

aitjcize commented 6 years ago

Ok, I just found out that you need gmp as well, which means you need to add

GMP_DIR?=...
CFLAGS+=-I$(OPENSSL_DIR)/include -I$(GMP_DIR)/include
LDFLAGS+=-L$(OPENSSL_DIR)/lib -I $(GMP_DIR)/lib

So I would probably stick to my original proposal, which is don't make an assumption on user's lib installation path, and just deal with MacOS like other platforms.

herumi commented 6 years ago

I added it. https://github.com/herumi/mcl/commit/be1211d42ef2098015eda3a9f09992b9cfddba40