1
0
Fork 0

Add liblpeg-darwin

This commit is contained in:
Daniel Kempkens 2023-05-03 17:16:35 +02:00
parent ff52e75cf5
commit 36f2ccd665
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
3 changed files with 76 additions and 0 deletions

View file

@ -10,4 +10,6 @@
q = import ./packages/q.nix { inherit system lib pkgs; };
rimgo = import ./packages/rimgo.nix { inherit system lib pkgs; };
website-docs-nifoc-pw = import ./packages/website-docs-nifoc-pw.nix { inherit system lib pkgs; };
liblpeg-darwin = import ./packages/liblpeg-darwin.nix { inherit system lib pkgs; };
}

View file

@ -0,0 +1,23 @@
{ system, lib, pkgs }:
pkgs.stdenv.mkDerivation {
pname = "liblpeg";
inherit (pkgs.luajitPackages.lpeg) version src;
nativeBuildInputs = [ pkgs.fixDarwinDylibNames ];
buildInputs = [ pkgs.luajit ];
patches = [ ../patches/liblpeg-makefile.patch ];
installPhase = ''
mkdir -p $out/lib
install -D lpeg.dylib $out/lib/lpeg.dylib
'';
meta = {
homepage = "http://www.inf.puc-rio.br/~roberto/lpeg.html";
description = "Parsing Expression Grammars For Lua";
license.fullName = "MIT/X11";
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
};
}

View file

@ -0,0 +1,51 @@
--- a/makefile 2019-03-11 15:08:29
+++ b/makefile 2023-05-03 17:12:18
@@ -1,30 +1,7 @@
+.DEFAULT_GOAL := macosx
+
LIBNAME = lpeg
-LUADIR = ../lua/
-COPT = -O2 -DNDEBUG
-# COPT = -g
-
-CWARNS = -Wall -Wextra -pedantic \
- -Waggregate-return \
- -Wcast-align \
- -Wcast-qual \
- -Wdisabled-optimization \
- -Wpointer-arith \
- -Wshadow \
- -Wsign-compare \
- -Wundef \
- -Wwrite-strings \
- -Wbad-function-cast \
- -Wdeclaration-after-statement \
- -Wmissing-prototypes \
- -Wnested-externs \
- -Wstrict-prototypes \
-# -Wunreachable-code \
-
-
-CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
-CC = gcc
-
FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
# For Linux
@@ -33,11 +10,14 @@ macosx:
# For Mac OS
macosx:
- $(MAKE) lpeg.so "DLLFLAGS = -bundle -undefined dynamic_lookup"
+ $(MAKE) lpeg.dylib "DLLFLAGS = -dynamiclib -undefined dynamic_lookup"
lpeg.so: $(FILES)
env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
+lpeg.dylib: $(FILES)
+ env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.dylib
+
$(FILES): makefile
test: test.lua re.lua lpeg.so