diff options
author | Juan M. Lasca <juanmlasca@gmail.com> | 2022-08-05 06:12:15 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2022-08-06 20:16:04 +0700 |
commit | 9bcaf9107a464794d7f84a446349ccf12d488d43 (patch) | |
tree | 687ce5ddecdb3085f10a52aa7cd604cf0e14fc75 /development/quickjs/patches/01-Makefile.patch | |
parent | 1de921aa9f548768a3e8ebc2a7654583e327ec9e (diff) |
development/quickjs: Added (a small and embeddable JS engine)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development/quickjs/patches/01-Makefile.patch')
-rw-r--r-- | development/quickjs/patches/01-Makefile.patch | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/development/quickjs/patches/01-Makefile.patch b/development/quickjs/patches/01-Makefile.patch new file mode 100644 index 000000000000..2e3650369b2a --- /dev/null +++ b/development/quickjs/patches/01-Makefile.patch @@ -0,0 +1,108 @@ +01-Makefile.patch, changes: +* on x86_64 systems, install libraries in /usr/lib64 +* added shared library target +* added CFLAGS_EXTRA to pass $SLKCFLAGS (can be improved) +* avoid building examples +* disabled debug information + +--- quickjs-2021-03-27/Makefile 2021-03-27 07:00:32.000000000 -0300 ++++ quickjs-2021-03-27-modified/Makefile 2022-08-02 21:52:01.476250120 -0300 +@@ -36,12 +36,14 @@ + + ifdef CONFIG_DARWIN + # use clang instead of gcc +-CONFIG_CLANG=y ++#CONFIG_CLANG=y + CONFIG_DEFAULT_AR=y + endif + + # installation directory + prefix=/usr/local ++libdir=$(prefix)/lib ++CFLAGS_EXTRA= + + # use the gprof profiler + #CONFIG_PROFILE=y +@@ -66,7 +68,7 @@ + ifdef CONFIG_CLANG + HOST_CC=clang + CC=$(CROSS_PREFIX)clang +- CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d ++ CFLAGS= -Wall -MMD -MF $(OBJDIR)/$(@F).d + CFLAGS += -Wextra + CFLAGS += -Wno-sign-compare + CFLAGS += -Wno-missing-field-initializers +@@ -87,7 +89,7 @@ + else + HOST_CC=gcc + CC=$(CROSS_PREFIX)gcc +- CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d ++ CFLAGS= -Wall -MMD -MF $(OBJDIR)/$(@F).d + CFLAGS += -Wno-array-bounds -Wno-format-truncation + ifdef CONFIG_LTO + AR=$(CROSS_PREFIX)gcc-ar +@@ -107,12 +109,15 @@ + DEFINES+=-D__USE_MINGW_ANSI_STDIO # for standard snprintf behavior + endif + ++DEFINES += -DCONFIG_LIBDIR=\"$(libdir)\" ++ ++CFLAGS+=$(CFLAGS_EXTRA) + CFLAGS+=$(DEFINES) + CFLAGS_DEBUG=$(CFLAGS) -O0 + CFLAGS_SMALL=$(CFLAGS) -Os + CFLAGS_OPT=$(CFLAGS) -O2 + CFLAGS_NOLTO:=$(CFLAGS_OPT) +-LDFLAGS=-g ++#LDFLAGS=-g + ifdef CONFIG_LTO + CFLAGS_SMALL+=-flto + CFLAGS_OPT+=-flto +@@ -157,14 +162,14 @@ + ifdef CONFIG_ASAN + PROGS+= + else +-PROGS+=examples/hello examples/hello_module examples/test_fib ++#PROGS+=examples/hello examples/hello_module examples/test_fib + ifndef CONFIG_DARWIN +-PROGS+=examples/fib.so examples/point.so ++#PROGS+=examples/fib.so examples/point.so + endif + endif + endif + +-all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS) ++all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS) libquickjs.so + + QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDIR)/libregexp.o $(OBJDIR)/libunicode.o $(OBJDIR)/cutils.o $(OBJDIR)/quickjs-libc.o + +@@ -187,6 +192,9 @@ + qjs$(EXE): $(QJS_OBJS) + $(CC) $(LDFLAGS) $(LDEXPORT) -o $@ $^ $(LIBS) + ++libquickjs.so: $(QJS_LIB_OBJS) ++ $(CC) -shared $(LDFLAGS) -fPIC $(LDEXPORT) -o $@ $^ $(LIBS) ++ + qjs-debug$(EXE): $(patsubst %.o, %.debug.o, $(QJS_OBJS)) + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +@@ -299,13 +307,15 @@ + + install: all + mkdir -p "$(DESTDIR)$(prefix)/bin" +- $(STRIP) qjs qjsc ++ $(STRIP) qjs qjsc libquickjs.so + install -m755 qjs qjsc "$(DESTDIR)$(prefix)/bin" + ln -sf qjs "$(DESTDIR)$(prefix)/bin/qjscalc" +- mkdir -p "$(DESTDIR)$(prefix)/lib/quickjs" +- install -m644 libquickjs.a "$(DESTDIR)$(prefix)/lib/quickjs" ++ mkdir -p "$(DESTDIR)/$(libdir)/quickjs" ++ install -m644 libquickjs.a "$(DESTDIR)/$(libdir)/quickjs" ++ install -m644 libquickjs.so "$(DESTDIR)/$(libdir)/quickjs" ++ ln -s quickjs/libquickjs.so "$(DESTDIR)/$(libdir)/libquickjs.so" + ifdef CONFIG_LTO +- install -m644 libquickjs.lto.a "$(DESTDIR)$(prefix)/lib/quickjs" ++ install -m644 libquickjs.lto.a "$(DESTDIR)/$(libdir)/quickjs" + endif + mkdir -p "$(DESTDIR)$(prefix)/include/quickjs" + install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(prefix)/include/quickjs" |