head 1.7; access; symbols pkgsrc-2026Q1:1.7.0.20 pkgsrc-2026Q1-base:1.7 pkgsrc-2025Q4:1.7.0.18 pkgsrc-2025Q4-base:1.7 pkgsrc-2025Q3:1.7.0.16 pkgsrc-2025Q3-base:1.7 pkgsrc-2025Q2:1.7.0.14 pkgsrc-2025Q2-base:1.7 pkgsrc-2025Q1:1.7.0.12 pkgsrc-2025Q1-base:1.7 pkgsrc-2024Q4:1.7.0.10 pkgsrc-2024Q4-base:1.7 pkgsrc-2024Q3:1.7.0.8 pkgsrc-2024Q3-base:1.7 pkgsrc-2024Q2:1.7.0.6 pkgsrc-2024Q2-base:1.7 pkgsrc-2024Q1:1.7.0.4 pkgsrc-2024Q1-base:1.7 pkgsrc-2023Q4:1.7.0.2 pkgsrc-2023Q4-base:1.7 pkgsrc-2023Q3:1.6.0.2 pkgsrc-2023Q3-base:1.6 pkgsrc-2023Q1:1.3.0.2 pkgsrc-2023Q1-base:1.3 pkgsrc-2022Q4:1.2.0.2 pkgsrc-2022Q4-base:1.2 pkgsrc-2022Q3:1.1.0.2 pkgsrc-2022Q3-base:1.1; locks; strict; comment @# @; 1.7 date 2023.12.07.09.21.34; author nia; state Exp; branches; next 1.6; commitid fzaF6f89IcsoWvPE; 1.6 date 2023.09.10.09.57.36; author nia; state Exp; branches; next 1.5; commitid L6uImDsWVV6kXcEE; 1.5 date 2023.09.10.09.36.38; author nia; state Exp; branches; next 1.4; commitid glCzgd02GyoVPcEE; 1.4 date 2023.04.24.07.50.40; author wiz; state dead; branches; next 1.3; commitid GTl81A3k0IEwJkmE; 1.3 date 2023.01.23.15.42.08; author wiz; state Exp; branches; next 1.2; commitid gciMqGy59KEMgGaE; 1.2 date 2022.10.31.01.57.44; author wiz; state Exp; branches; next 1.1; commitid JUg01JurxaKmpOZD; 1.1 date 2022.08.30.12.47.02; author nia; state Exp; branches; next ; commitid 99A235pJXpYyZTRD; desc @@ 1.7 log @mujs: Update to 1.3.4 Changes: - Allow disabling readline support in Makefile. - Handle sign when converting integer strings to numbers. - Fix bug when cleaning up after allocation error. - Finalize user data if object allocation fails. @ text @$NetBSD: patch-Makefile,v 1.5 2023/09/10 09:36:38 nia Exp $ - Build shared objects at build-time rather than install-time. - Honour CFLAGS and LDFLAGS. - Libtoolize. --- Makefile.orig 2023-11-21 15:27:50.000000000 +0000 +++ Makefile @@@@ -2,28 +2,18 @@@@ # # Useful targets are: release, install, uninstall. -default: build/debug/mujs build/debug/mujs-pp +default: build/release/mujs build/release/mujs-pp build/release/libmujs.la build/release/mujs.pc -CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter - -OPTIM = -O3 +CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter prefix = /usr/local bindir = $(prefix)/bin incdir = $(prefix)/include libdir = $(prefix)/lib -ifeq ($(wildcard .git),.git) - VERSION = $(shell git describe --tags --always) -else - VERSION = $(patsubst mujs-%,%,$(notdir $(CURDIR))) -endif +VERSION = $(patsubst mujs-%,%,$(notdir $(CURDIR))) -ifeq ($(shell uname),Darwin) - SO = dylib -else - SO = so -endif +SO = la ifeq ($(shell uname),FreeBSD) CFLAGS += -I/usr/local/include -L/usr/local/lib @@@@ -95,18 +85,24 @@@@ build/debug/mujs: main.c build/debug/lib build/debug/mujs-pp: pp.c build/debug/libmujs.o $(CC) $(CFLAGS) -g -o $@@ $^ -lm -build/release/libmujs.$(SO): one.c $(SRCS) $(HDRS) +build/release/libmujs.$(SO): build/release/one.lo @@mkdir -p $(@@D) - $(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -o $@@ one.c -lm -build/release/libmujs.o: one.c $(SRCS) $(HDRS) - @@mkdir -p $(@@D) - $(CC) $(CFLAGS) $(OPTIM) -c -o $@@ one.c -build/release/libmujs.a: build/release/libmujs.o - $(AR) cr $@@ $^ -build/release/mujs: main.c build/release/libmujs.o - $(CC) $(CFLAGS) $(OPTIM) -o $@@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS) -build/release/mujs-pp: pp.c build/release/libmujs.o - $(CC) $(CFLAGS) $(OPTIM) -o $@@ $^ -lm + $(LIBTOOL) --mode=link --tag=CC --quiet $(CC) $(LDFLAGS) -rpath $(PREFIX)/lib -o $@@ $^ -lm + +build/release/mujs: build/release/main.lo build/release/one.lo + $(LIBTOOL) --mode=link --tag=CC --quiet $(CC) $(LDFLAGS) -o $@@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS) + +build/release/mujs-pp: build/release/pp.lo build/release/one.lo + $(LIBTOOL) --mode=link --tag=CC --quiet $(CC) $(LDFLAGS) -o $@@ $^ -lm + +build/release/main.lo: main.c $(SRCS) $(HDRS) + $(LIBTOOL) --mode=compile --tag=CC --quiet $(CC) $(CFLAGS) -c -o $@@ $< + +build/release/pp.lo: pp.c $(SRCS) $(HDRS) + $(LIBTOOL) --mode=compile --tag=CC --quiet $(CC) $(CFLAGS) -c -o $@@ $< + +build/release/one.lo: one.c $(SRCS) $(HDRS) + $(LIBTOOL) --mode=compile --tag=CC --quiet $(CC) $(CFLAGS) -c -o $@@ $< build/release/mujs.pc: @@mkdir -p $(@@D) @@@@ -124,14 +120,14 @@@@ install-common: build/release/mujs build install -d $(DESTDIR)$(bindir) install -m 644 mujs.h $(DESTDIR)$(incdir) install -m 644 build/release/mujs.pc $(DESTDIR)$(libdir)/pkgconfig - install -m 755 build/release/mujs $(DESTDIR)$(bindir) - install -m 755 build/release/mujs-pp $(DESTDIR)$(bindir) + $(LIBTOOL) --mode=install --tag=CC --quiet install -m 755 build/release/mujs $(DESTDIR)$(bindir) + $(LIBTOOL) --mode=install --tag=CC --quiet install -m 755 build/release/mujs-pp $(DESTDIR)$(bindir) install-static: install-common build/release/libmujs.a install -m 644 build/release/libmujs.a $(DESTDIR)$(libdir) install-shared: install-common build/release/libmujs.$(SO) - install -m 755 build/release/libmujs.$(SO) $(DESTDIR)$(libdir) + $(LIBTOOL) --mode=install --tag=CC --quiet install -m 755 build/release/libmujs.$(SO) $(DESTDIR)$(libdir) install: install-static @ 1.6 log @mujs: Restore PKGCONFIG_OVERRIDE fixes that were also quietly deleted in r1.3 to ensure that dependent users have the correct RPATH. Set MAINTAINER to me as a hint that I understand the Makefile patches, and hopefully I will waste less time being confused in the future, and not be convinced that I dreamed that I fixed this package before. O.o @ text @d7 1 a7 1 --- Makefile.orig 2023-01-10 11:11:11.000000000 +0000 d42 1 a42 1 @@@@ -90,18 +80,22 @@@@ build/debug/mujs: main.c build/debug/lib d47 1 a47 1 +build/release/libmujs.$(SO): build/release/one.lo $(SRCS) $(HDRS) d51 1 a51 3 + $(LIBTOOL) --mode=link --tag=CC --quiet $(CC) $(LDFLAGS) -rpath $(PREFIX)/lib -o $@@ build/release/one.lo -lm +build/release/one.lo: one.c $(SRCS) $(HDRS) @@mkdir -p $(@@D) d56 1 a56 1 - $(CC) $(CFLAGS) $(OPTIM) -o $@@ $^ -lm -DHAVE_READLINE -lreadline d59 2 a60 7 + $(LIBTOOL) --mode=compile --tag=CC --quiet $(CC) $(CFLAGS) -c -o $@@ one.c +build/release/main.lo: main.c $(SRCS) $(HDRS) + @@mkdir -p $(@@D) + $(LIBTOOL) --mode=compile --tag=CC --quiet $(CC) $(CFLAGS) -c -o $@@ main.c +build/release/pp.lo: pp.c $(SRCS) $(HDRS) + @@mkdir -p $(@@D) + $(LIBTOOL) --mode=compile --tag=CC --quiet $(CC) $(CFLAGS) -c -o $@@ pp.c d62 2 a63 1 + $(LIBTOOL) --mode=link --tag=CC --quiet $(CC) $(LDFLAGS) -o $@@ $^ -lm -DHAVE_READLINE -lreadline d66 9 d78 1 a78 1 @@@@ -119,14 +113,14 @@@@ install-common: build/release/mujs build @ 1.5 log @mujs: In typical pkgsrc fashion, libtoolize package that attempts to hand-roll its own way of producing shared/static libaries. Install more than just the static libraries. Make the build process generally more portable and predictable by further separating compilation and link stages, and using LDFLAGS instead of CFLAGS when linking. @ text @d1 1 a1 1 $NetBSD$ d9 1 a9 1 @@@@ -2,11 +2,9 @@@@ d14 1 a14 1 +default: build/release/mujs build/release/mujs-pp build/release/libmujs.la d23 9 a31 3 @@@@ -19,11 +17,7 @@@@ else VERSION = $(patsubst mujs-%,%,$(notdir $(CURDIR))) endif d42 1 a42 1 @@@@ -90,18 +84,22 @@@@ build/debug/mujs: main.c build/debug/lib d75 1 a75 1 @@@@ -119,14 +117,14 @@@@ install-common: build/release/mujs build @ 1.4 log @mujs: update to 1.3.3. Changes not found. @ text @d1 1 a1 1 $NetBSD: patch-Makefile,v 1.3 2023/01/23 15:42:08 wiz Exp $ d3 3 a5 4 - Don't invoke git. - Honor user's CFLAGS/LDFLAGS. - libtoolize shared object creation. - The PHONY target is removed to allow PKGCONFIG_OVERRIDE to work. d7 1 a7 1 --- Makefile.orig 2022-11-07 15:24:56.000000000 +0000 d9 3 a11 3 @@@@ -9,21 +9,11 @@@@ bindir ?= $(prefix)/bin incdir ?= $(prefix)/include libdir ?= $(prefix)/lib d13 4 a16 5 -ifeq "$(wildcard .git)" ".git" - VERSION := $(shell git describe --tags --always) -else - VERSION := $(patsubst mujs-%,%,$(notdir $(CURDIR))) -endif d18 1 a18 10 -ifeq ($(shell uname),Darwin) - SO_EXT := dylib -else - SO_EXT := so -endif +SO_EXT := la # Compiler flags for various configurations: -CFLAGS := -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter d21 4 a24 4 ifeq "$(CC)" "clang" CFLAGS += -Wunreachable-code @@@@ -33,16 +23,6 @@@@ ifeq "$(shell uname)" "Linux" HAVE_READLINE := yes d27 4 a30 8 -ifeq "$(build)" "debug" - CFLAGS += -g -else ifeq "$(build)" "sanitize" - CFLAGS += -pipe -g -fsanitize=address -fno-omit-frame-pointer - LDFLAGS += -fsanitize=address -else ifeq "$(build)" "release" - CFLAGS += -O2 - LDFLAGS += -Wl,-s d32 38 a69 50 - ifeq "$(HAVE_READLINE)" "yes" CFLAGS += -DHAVE_READLINE LIBREADLINE += -lreadline @@@@ -74,33 +54,32 @@@@ one.c: $(SRCS) jsdump.c: astnames.h opnames.h -$(OUT)/%.o: %.c $(HDRS) +$(OUT)/%.lo: %.c $(HDRS) @@ mkdir -p $(@@D) - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@@ -c $< + $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) -o $@@ -c $< -$(OUT)/libmujs.o: one.c $(HDRS) +$(OUT)/libmujs.lo: one.c $(HDRS) @@ mkdir -p $(@@D) - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@@ -c $< + $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) -o $@@ -c $< -$(OUT)/libmujs.a: $(OUT)/libmujs.o +$(OUT)/libmujs.a: $(OUT)/libmujs.lo @@ mkdir -p $(@@D) $(AR) cr $@@ $^ -$(OUT)/libmujs.$(SO_EXT): one.c $(HDRS) +$(OUT)/libmujs.$(SO_EXT): $(OUT)/libmujs.lo one.c $(HDRS) @@ mkdir -p $(@@D) - $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -shared $(LDFLAGS) -o $@@ $< -lm + $(LIBTOOL) --quiet --tag=CC --mode=link $(CC) $(LDFLAGS) -rpath $(PREFIX)/lib -o $@@ $< -lm libmujs ?= libmujs.a -$(OUT)/mujs: $(OUT)/main.o $(OUT)/$(libmujs) +$(OUT)/mujs: $(OUT)/main.lo $(OUT)/libmujs.$(SO_EXT) @@ mkdir -p $(@@D) - $(CC) $(LDFLAGS) -o $@@ $< -L$(OUT) -l:$(libmujs) $(LIBREADLINE) -lm + $(LIBTOOL) --quiet --tag=CC --mode=link $(CC) $(LDFLAGS) -o $@@ $^ $(LIBREADLINE) -lm -$(OUT)/mujs-pp: $(OUT)/pp.o $(OUT)/$(libmujs) +$(OUT)/mujs-pp: $(OUT)/pp.lo $(OUT)/libmujs.$(SO_EXT) @@ mkdir -p $(@@D) - $(CC) $(LDFLAGS) -o $@@ $< -L$(OUT) -l:$(libmujs) -lm + $(LIBTOOL) --quiet --tag=CC --mode=link $(CC) $(LDFLAGS) -o $@@ $^ -lm -.PHONY: $(OUT)/mujs.pc $(OUT)/mujs.pc: @@ mkdir -p $(dir $@@) @@ echo Creating $@@ @@@@ -121,13 +100,13 @@@@ install-common: $(OUT)/mujs $(OUT)/mujs. d72 12 a83 10 install -m 644 $(OUT)/mujs.pc $(DESTDIR)$(libdir)/pkgconfig - install -m 755 $(OUT)/mujs $(DESTDIR)$(bindir) + $(LIBTOOL) --quiet --tag=CC --mode=install install -m 755 $(OUT)/mujs $(DESTDIR)$(bindir) install-static: install-common $(OUT)/libmujs.a install -m 644 $(OUT)/libmujs.a $(DESTDIR)$(libdir) install-shared: install-common $(OUT)/libmujs.$(SO_EXT) - install -m 755 $(OUT)/libmujs.$(SO_EXT) $(DESTDIR)$(libdir) + $(LIBTOOL) --quiet --tag=CC --mode=install install -m 755 $(OUT)/libmujs.$(SO_EXT) $(DESTDIR)$(libdir) @ 1.3 log @mujs: update to 1.3.2. Changes not found. @ text @d1 1 a1 1 $NetBSD: patch-Makefile,v 1.2 2022/10/31 01:57:44 wiz Exp $ @ 1.2 log @mujs: update to 1.3.0. Changes not found. @ text @d1 1 a1 1 $NetBSD: patch-Makefile,v 1.1 2022/08/30 12:47:02 nia Exp $ d8 1 a8 1 --- Makefile.orig 2022-10-11 16:18:55.000000000 +0000 d17 1 a17 1 - VERSION := $(shell basename $$PWD | sed -e s,^mujs-,,) d51 1 a51 1 @@@@ -74,31 +54,30 @@@@ one.c: $(SRCS) d57 1 a57 1 @@ mkdir -p $(dir $@@) d63 1 a63 1 @@ mkdir -p $(dir $@@) d69 1 a69 1 @@ mkdir -p $(dir $@@) d73 2 a74 2 +$(OUT)/libmujs.$(SO_EXT): $(OUT)/libmujs.lo $(HDRS) @@ mkdir -p $(dir $@@) d78 6 a83 4 -$(OUT)/mujs: $(OUT)/libmujs.o $(OUT)/main.o +$(OUT)/mujs: $(OUT)/libmujs.lo $(OUT)/main.lo @@ mkdir -p $(dir $@@) - $(CC) $(LDFLAGS) -o $@@ $^ $(LIBREADLINE) -lm d86 4 a89 4 -$(OUT)/mujs-pp: $(OUT)/libmujs.o $(OUT)/pp.o +$(OUT)/mujs-pp: $(OUT)/libmujs.lo $(OUT)/pp.lo @@ mkdir -p $(dir $@@) - $(CC) $(LDFLAGS) -o $@@ $^ -lm d96 1 a96 1 @@@@ -119,13 +98,13 @@@@ install-common: $(OUT)/mujs $(OUT)/mujs. @ 1.1 log @Add lang/mujs. MuJS is a lightweight Javascript interpreter designed for embedding in other software to extend them with scripting capabilities. MuJS was designed with a focus on small size, correctness, and simplicity. It is written in portable C and implements ECMAScript as specified by ECMA-262. The interface for binding with native code is designed to be as simple as possible to use, and is very similar to Lua. @ text @d1 1 a1 1 $NetBSD$ d8 1 a8 1 --- Makefile.orig 2021-12-08 11:56:12.000000000 +0000 d92 1 d94 1 a94 2 @@ echo > $@@ Name: mujs @@@@ -118,13 +97,13 @@@@ install-common: $(OUT)/mujs $(OUT)/mujs. @