$NetBSD: patch-Makefile,v 1.4 2022/01/30 10:55:03 he Exp $ Portability patch for NetBSD. --- Makefile.orig 2021-03-27 10:00:32.000000000 +0000 +++ Makefile @@ -22,13 +22,19 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -ifeq ($(shell uname -s),Darwin) +OPSYS=$(shell uname -s) +ifeq ($(OPSYS),Darwin) CONFIG_DARWIN=y endif +ifeq ($(OPSYS),NetBSD) +CONFIG_NETBSD=y +endif # Windows cross compilation from Linux #CONFIG_WIN32=y # use link time optimization (smaller and faster executables but slower build) +ifndef CONFIG_NETBSD CONFIG_LTO=y +endif # consider warnings as errors (for development) #CONFIG_WERROR=y # force 32 bit build for some utilities @@ -40,6 +46,10 @@ CONFIG_CLANG=y CONFIG_DEFAULT_AR=y endif +ifndef CONFIG_NETBSD +CONFIG_LDL=y +endif + # installation directory prefix=/usr/local @@ -48,7 +58,8 @@ prefix=/usr/local # use address sanitizer #CONFIG_ASAN=y # include the code for BigInt/BigFloat/BigDecimal and math mode -CONFIG_BIGNUM=y +# Set via environment in pkg Makefile if supported: +#CONFIG_BIGNUM=y OBJDIR=.obj @@ -174,12 +185,18 @@ QJS_LIB_OBJS+=$(OBJDIR)/libbf.o QJS_OBJS+=$(OBJDIR)/qjscalc.o endif -HOST_LIBS=-lm -ldl -lpthread +HOST_LIBS=-lm +ifndef CONFIG_NETBSD +HOST_LIBS+=-ldl +endif +HOST_LIBS+=-lphtread LIBS=-lm ifndef CONFIG_WIN32 -LIBS+=-ldl -lpthread +ifndef CONFIG_NETBSD +LIBS+=-ldl +endif +LIBS+=-lpthread endif -LIBS+=$(EXTRA_LIBS) $(OBJDIR): mkdir -p $(OBJDIR) $(OBJDIR)/examples $(OBJDIR)/tests @@ -205,6 +222,9 @@ QJSC_DEFINES:=-DCONFIG_CC=\"$(QJSC_CC)\" ifdef CONFIG_LTO QJSC_DEFINES+=-DCONFIG_LTO endif +ifdef CONFIG_LDL +QJSC_DEFINES+=-DCONFIG_LDL +endif QJSC_HOST_DEFINES:=-DCONFIG_CC=\"$(HOST_CC)\" -DCONFIG_PREFIX=\"$(prefix)\" $(OBJDIR)/qjsc.o: CFLAGS+=$(QJSC_DEFINES)