cc'ing ports@ as many of the comments here are going to be useful to other people who are working on ports (some of them just apply to things affecting this particular port and are relatively unimportant, but there are a few things which will crop up in many ports so it's good to have a wider audience for them).
On 2012/10/19 16:20, Gleydson Soares wrote: > here is an updated tarball(luakit and luajit) with some slight tweaks for > both. > i did some tests and luakit works fine here @i386. a few notes on the things I spotted in luajit; they're all fixed in the diff to tgz below, and the new tgz attached. builds OK on amd64/i386 and I've added a minimal do-regress to check that it runs, but otherwise untested. . lowercase start of COMMENT, no trailing full stop . move from devel/ to lang/ . don't strip "beta11", it's part of the version number, the package tools know how to work with certain suffixes like beta/pre/rc; the rules are in packages-specs(7) - I would suggest PKGNAME = ${DISTNAME:L:S/-beta/beta/} . would look better if some of the make variables are aligned, no need to go overboard but something like this would be nice I think. ONLY_FOR_ARCHS = amd64 i386 COMMENT = just-in-time compiler for Lua DISTNAME = LuaJIT-2.0.0-beta11 PKGNAME = ${DISTNAME:L:S/-beta11//} CATEGORIES = devel HOMEPAGE = http://luajit.org MAINTAINER = Aaron Bieber <abie...@openbsd.org> . consistency tweaks, NO_REGRESS = YES NO_REGRESS = Yes . ONLY_FOR_ARCHS not ARCHES; add this to /etc/mk.conf which will add some .poison's to catch common misspellings: .include "/usr/ports/infrastructure/templates/mk.conf.template" . set SHARED_ONLY=Yes, this is a clue to update-plist to put everything into the PLIST file rather than using PFRAG.shared, and as it's only for amd64/i386 this doesn't further restrict the arch . typo CPPFLGS -> CPPFLAGS (but this is unused anyway) . they're using CCOPT to set the optimizer flags so we probably want to pass CFLAGS in to there rather than directly into CFLAGS. . gets built with -march=i686, this needs to go. . they are running strip on the library, this needs to be patched away . they are running ldconfig, this needs to be patched away . looking at the plist, @bin bin/${FULLPKGNAME}-beta11 - the only time FULLPKGNAME should be used in PLIST is for the pkg-readmes stuff - this should be renamed or symlinked to a filename which doesn't change for every port update; since this is based on lua 5.1 I have taken the approach of the main lua port and named it luajit51. @bin lib/libluajit-${MODLUA_VERSION}.so.2.0.0 this is being built wrongly, indicated by the @bin marker which comes from file(1) output showing as 'executable' rather than 'shared object', also the filename is wrong, the actual name needs to be controlled by the SHARED_LIBS variable in the port Makefile and the name should be like 'libfoo.so.x.y' rather than '...so.x.y.z', this need changes to the build, also there is a library symlink created, libluajit-${MODLUA_VERSION}.so, this should be patched away or @comment'ed . looking at patches, rather than patching wrksrc/Makefile to set variables and then SUBST_CMD them, you can just override them via MAKE_FLAGS. (MAKE_ENV gets overridden by variables set in a Makefile whereas MAKE_FLAGS overrides vars in a Makefile). . rather than patching all the build lines to change $(E) and $(Q) it would be simpler to switch things around just above '# Make targets', they have Q= @ E= @echo #Q= #E= @: so the commented-out ones can just be uncommented to replace the others: Q= E= @: maybe this could also be done via MAKE_FLAGS but patching is probably easier for this one (unlike patch-Makefile this one doesn't involve SUBST_CMD, and SUBST_CMD makes 'make update-patches' harder to use). ======== diff --git Makefile Makefile index 28e2d93..8f3075d 100644 --- Makefile +++ Makefile @@ -1,14 +1,17 @@ # $OpenBSD: Makefile.template,v 1.61 2012/03/29 13:41:58 sthen Exp $ -ONLY_FOR_ARCHES = amd64 i386 +ONLY_FOR_ARCHS = amd64 i386 +SHARED_ONLY = Yes +SHARED_LIBS += luajit-${MODLUA_VERSION} 0.0 # 2.0.0 -COMMENT = Just-In-Time Compiler for Lua. -DISTNAME = LuaJIT-2.0.0-beta11 -PKGNAME = ${DISTNAME:L:S/-beta11//} +COMMENT = just-in-time compiler for Lua +V = 2.0.0-beta11 +DISTNAME = LuaJIT-${V} +PKGNAME = ${DISTNAME:L:S/-beta/beta/} -CATEGORIES = devel +CATEGORIES = lang -HOMEPAGE = http://luajit.org +HOMEPAGE = http://luajit.org/ MAINTAINER = Aaron Bieber <abie...@openbsd.org> @@ -18,19 +21,28 @@ PERMIT_PACKAGE_FTP = Yes PERMIT_DISTFILES_CDROM =Yes PERMIT_DISTFILES_FTP = Yes -WANTLIB = c m +WANTLIB = c m -MASTER_SITES = http://luajit.org/download/ +MASTER_SITES = ${HOMEPAGE}download/ -MODULES = lang/lua +MODULES = lang/lua -MAKE_ENV+= CFLAGS+="${CFLAGS}" CPPFLAGS="${CPPFLGS}" +MAKE_FLAGS += \ + CC="${CC}" \ + CCOPT="${CFLAGS}" \ + CCOPT_x86="" \ + INSTALL_LJLIBD="${DESTDIR}${MODLUA_DATADIR}" \ + INSTALL_MAN="${DESTDIR}${PREFIX}/man/man1" \ + INSTALL_SONAME=libluajit-${MODLUA_VERSION}.so.${LIBluajit-${MODLUA_VERSION}_VERSION} \ + PREFIX="${PREFIX}" -NO_REGRESS = YES +USE_GMAKE = Yes +SUBST_VARS += V -USE_GMAKE = Yes +post-install: + mv ${PREFIX}/bin/luajit-$V ${PREFIX}/bin/luajit${MODLUA_DEP_VERSION} -pre-configure: - ${SUBST_CMD} ${WRKDIST}/Makefile +do-regress: + ${WRKSRC}/src/luajit -e "print('hello world')" | grep "^hello world$$" .include <bsd.port.mk> diff --git patches/patch-Makefile patches/patch-Makefile index f8035aa..0358f81 100644 --- patches/patch-Makefile +++ patches/patch-Makefile @@ -1,28 +1,11 @@ $OpenBSD$ ---- Makefile.orig Tue Oct 16 12:30:00 2012 -+++ Makefile Wed Oct 17 17:24:15 2012 -@@ -25,7 +25,7 @@ ABIVER= 5.1 - # Change the installation path as needed. This automatically adjusts - # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path! - # --export PREFIX= /usr/local -+export PREFIX= ${PREFIX} - ############################################################################## - - DPREFIX= $(DESTDIR)$(PREFIX) -@@ -34,13 +34,13 @@ INSTALL_LIB= $(DPREFIX)/lib - INSTALL_SHARE= $(DPREFIX)/share - INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) - --INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION) -+INSTALL_LJLIBD= ${DESTDIR}${MODLUA_DATADIR} - INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit - INSTALL_LMODD= $(INSTALL_SHARE)/lua - INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER) - INSTALL_CMODD= $(INSTALL_LIB)/lua - INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER) --INSTALL_MAN= $(INSTALL_SHARE)/man/man1 -+INSTALL_MAN= $(DPREFIX)/man/man1 - INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig - - INSTALL_TNAME= luajit-$(VERSION) +--- Makefile.orig Sat Oct 20 10:44:26 2012 ++++ Makefile Sat Oct 20 10:44:34 2012 +@@ -111,7 +111,6 @@ install: $(INSTALL_DEP) + $(RM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) + cd src && test -f $(FILE_SO) && \ + $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \ +- $(LDCONFIG) $(INSTALL_LIB) && \ + $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \ + $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || : + cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN) diff --git patches/patch-src_Makefile patches/patch-src_Makefile index cb54519..c9ffe8c 100644 --- patches/patch-src_Makefile +++ patches/patch-src_Makefile @@ -1,111 +1,38 @@ $OpenBSD$ ---- src/Makefile.orig Tue Oct 16 12:30:00 2012 -+++ src/Makefile Wed Oct 17 10:36:36 2012 -@@ -588,45 +588,45 @@ depend: - ############################################################################## - - $(MINILUA_T): $(MINILUA_O) -- $(E) "HOSTLINK $@" -+ $(E) $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) - $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) - - host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) -- $(E) "DYNASM $@" -+ $(E) $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) - $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) - - host/buildvm.o: $(DASM_DIR)/dasm_*.h - - $(BUILDVM_T): $(BUILDVM_O) -- $(E) "HOSTLINK $@" -+ $(E) $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS) - $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS) - - $(LJVM_BOUT): $(BUILDVM_T) -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@ - $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@ - - lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C) -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C) - $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C) - - lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C) - $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C) - - lj_libdef.h: $(BUILDVM_T) $(LJLIB_C) -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C) - $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C) - - lj_recdef.h: $(BUILDVM_T) $(LJLIB_C) -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C) - $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C) - - $(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C) -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C) - $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C) - - lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c -- $(E) "BUILDVM $@" -+ $(E) $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c - $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c +--- src/Makefile.orig Tue Oct 16 19:30:00 2012 ++++ src/Makefile Sat Oct 20 10:57:31 2012 +@@ -304,6 +304,11 @@ ifeq (iOS,$(TARGET_SYS)) + TARGET_DYNXLDOPTS= + TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) + else ++ifeq (OpenBSD,$(TARGET_SYS)) ++ TARGET_XSHLDFLAGS= -shared -fPIC ++ TARGET_XCFLAGS+= -fno-stack-protector ++ TARGET_STRIP= @: ++else + ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs))) + TARGET_XCFLAGS+= -fno-stack-protector + endif +@@ -321,6 +326,7 @@ else + endif + endif + endif ++endif + + ifneq ($(HOST_SYS),$(TARGET_SYS)) + ifeq (Windows,$(TARGET_SYS)) +@@ -549,10 +555,10 @@ endif + endif + endif + +-Q= @ +-E= @echo +-#Q= +-#E= @: ++#Q= @ ++#E= @echo ++Q= ++E= @: ############################################################################## -@@ -634,21 +634,23 @@ lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c - ############################################################################## - - %.o: %.c -- $(E) "CC $@" -+ $(E) $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< - $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< -+ $(E) $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< - $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< - - %.o: %.s -- $(E) "ASM $@" -+ $(E) $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< - $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< -+ $(E) $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< - $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< - - $(LUAJIT_O): -- $(E) "CC $@" -+ $(E) $(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $< - $(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $< - - $(HOST_O): %.o: %.c -- $(E) "HOSTCC $@" -+ $(E) $(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $< - $(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $< - - include Makefile.dep -@@ -658,18 +660,20 @@ include Makefile.dep - ############################################################################## - - $(LUAJIT_A): $(LJVMCORE_O) -- $(E) "AR $@" -+ $(E) $(Q)$(TARGET_AR) $@ $(LJVMCORE_O) - $(Q)$(TARGET_AR) $@ $(LJVMCORE_O) - - # The dependency on _O, but linking with _DYNO is intentional. - $(LUAJIT_SO): $(LJVMCORE_O) -- $(E) "DYNLINK $@" -+ $(E) $(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS) - $(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS) -+ $(E) $(Q)$(TARGET_STRIP) $@ - $(Q)$(TARGET_STRIP) $@ - - $(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP) -- $(E) "LINK $@" -+ $(E) $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS) - $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS) -+ $(E) $(Q)$(TARGET_STRIP) $@ - $(Q)$(TARGET_STRIP) $@ - $(E) "OK Successfully built LuaJIT" - + # Make targets. diff --git pkg/PLIST pkg/PLIST index 66d6834..c2c9e0f 100644 --- pkg/PLIST +++ pkg/PLIST @@ -1,5 +1,5 @@ @comment $OpenBSD$ -@bin bin/${FULLPKGNAME}-beta11 +@bin bin/luajit include/luajit-2.0/ include/luajit-2.0/lauxlib.h include/luajit-2.0/lua.h @@ -8,7 +8,8 @@ include/luajit-2.0/luaconf.h include/luajit-2.0/luajit.h include/luajit-2.0/lualib.h lib/libluajit-${MODLUA_VERSION}.a -@bin lib/libluajit-${MODLUA_VERSION}.so.2.0.0 +@comment lib/libluajit-${MODLUA_VERSION}.so +@lib lib/libluajit-${MODLUA_VERSION}.so.${LIBluajit-5.1_VERSION} lib/pkgconfig/luajit.pc @man man/man1/luajit.1 share/lua/${MODLUA_VERSION}/jit/
luajit.tgz
Description: application/tar-gz