diff --git a/lang/mujs/Makefile b/lang/mujs/Makefile index 4a2c2b887a0e4..cedc3f3797dc2 100644 --- a/lang/mujs/Makefile +++ b/lang/mujs/Makefile @@ -1,22 +1,23 @@ PORTNAME= mujs -DISTVERSION= 1.0.7 -PORTREVISION= 1 +DISTVERSION= 1.1.1 CATEGORIES= lang devel -PATCH_SITES= https://github.com/${GH_ACCOUNT}/${PORTNAME}/commit/ -PATCHFILES= d9a1f4c57f976eeb67d877101fcdca89ecc047ed.patch:-p1 # Enable readline on FreeBSD - MAINTAINER= yuri@FreeBSD.org COMMENT= Embeddable Javascript interpreter in C LICENSE= ISCL LICENSE_FILE= ${WRKSRC}/COPYING +TEST_DEPENDS= git:devel/git + USES= compiler:c11 gmake readline # c11 is induced by the FreeBSD headers via isnan(3), etc, otherwise the project is all c99 code +USE_LDCONFIG= yes + USE_GITHUB= yes GH_ACCOUNT= ccxvii -USE_LDCONFIG= yes + ALL_TARGET= shared static + INSTALL_TARGET= install-shared install-static .if defined(WITH_DEBUG) # this project manages its build options itself @@ -38,7 +39,23 @@ OPTIONS_DEFAULT= 32BIT SANITIZED_DESC= Sanitized build (only for debugging) SANITIZED_MAKE_ARGS= build=sanitize -post-install: # https://github.com/ccxvii/mujs/issues/99 - @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libmujs.so +do-test: # Test-262 JavaScript testsuite is downloaded and run. + # Something is off with the test harness so too many tests fail: https://github.com/ccxvii/mujs/issues/147 + ${RM} -r ${WRKDIR}/testing && \ + ${MKDIR} -p ${WRKDIR}/testing && \ + cd ${WRKDIR}/testing && \ + git clone https://github.com/tc39/test262.git && \ + fetch https://github.com/ccxvii/mujs/files/2332077/mujs-test262-harness-and-output.zip && \ + unzip mujs-test262-harness-and-output.zip && \ + (${TAIL} -3 mujs-harness-out.txt > mujs-harness-out-3.txt) && \ + cd test262 && \ + git checkout es5-tests && \ + ${ECHO} "Running MuJS tests ..." && \ + (${FIND} test/suite -name '*.js' | ${STAGEDIR}${PREFIX}/bin/mujs ../mujs-harness.js > mujs-harness-out-our.txt) && \ + ${ECHO} "MuJS tests finished: " && \ + (${TAIL} -3 mujs-harness-out-our.txt | tee mujs-harness-out-our-3.txt) && \ + ${ECHO} "" && \ + ${ECHO} "Compare with reference results:" && \ + ${DIFF} ../mujs-harness-out-3.txt mujs-harness-out-our-3.txt .include diff --git a/lang/mujs/distinfo b/lang/mujs/distinfo index 7588f22e88592..7113a49334bf3 100644 --- a/lang/mujs/distinfo +++ b/lang/mujs/distinfo @@ -1,5 +1,3 @@ -TIMESTAMP = 1587257472 -SHA256 (ccxvii-mujs-1.0.7_GH0.tar.gz) = 9081244e070381300acaa5bf306a8b8b6f6231932ef4dca122992d3f6d243446 -SIZE (ccxvii-mujs-1.0.7_GH0.tar.gz) = 122041 -SHA256 (d9a1f4c57f976eeb67d877101fcdca89ecc047ed.patch) = de236ceb1d7df002bf0930ff31f07f58260e0faf780edef72f05d478185cb279 -SIZE (d9a1f4c57f976eeb67d877101fcdca89ecc047ed.patch) = 589 +TIMESTAMP = 1618693139 +SHA256 (ccxvii-mujs-1.1.1_GH0.tar.gz) = ade588c10e1cbed1eaca933a89f3199a1e6b826a6a00b48dc29b99630f017764 +SIZE (ccxvii-mujs-1.1.1_GH0.tar.gz) = 123984 diff --git a/lang/mujs/files/patch-Makefile b/lang/mujs/files/patch-Makefile index 89da50f8a2526..d0e4718377102 100644 --- a/lang/mujs/files/patch-Makefile +++ b/lang/mujs/files/patch-Makefile @@ -1,6 +1,10 @@ ---- Makefile.orig 2019-03-15 16:38:36 UTC +Patch contains 2 changes: +- enable readline on FreeBSD (upstream never accepted this PR) +- use -O3 on FreeBSD + +--- Makefile.orig 2021-04-13 02:22:04 UTC +++ Makefile -@@ -15,7 +15,8 @@ endif +@@ -17,7 +17,8 @@ endif # Compiler flags for various configurations: @@ -10,12 +14,23 @@ ifeq "$(CC)" "clang" CFLAGS += -Wunreachable-code -@@ -31,7 +32,7 @@ else ifeq "$(build)" "sanitize" +@@ -27,13 +28,18 @@ ifeq "$(shell uname)" "Linux" + HAVE_READLINE := yes + endif + ++ifeq "$(shell uname)" "FreeBSD" ++ HAVE_READLINE := yes ++ CFLAGS += -I$(prefix)/include ++endif ++ + ifeq "$(build)" "debug" + CFLAGS += -g + else ifeq "$(build)" "sanitize" CFLAGS += -pipe -g -fsanitize=address -fno-omit-frame-pointer LDFLAGS += -fsanitize=address - else -- CFLAGS += -Os -+ CFLAGS += -O3 # use -O3 on FreeBSD instead of -Os because this isn't an embedded platform + else ifeq "$(build)" "release" +- CFLAGS += -O2 ++ CFLAGS += -O3 LDFLAGS += -Wl,-s endif