pkg-config file

FossilOrigin-Name: d3f51656b06b06361158288c26c31402948ed0b2fa7a37c0db598712c00f8150
This commit is contained in:
nekobit 2023-03-23 14:19:04 +00:00
parent 04626f9e3f
commit ec186e9a18
2 changed files with 29 additions and 3 deletions

10
mastodont.pc Normal file
View file

@ -0,0 +1,10 @@
prefix=/usr/local
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: mastodont
Description: The mastodont library
Version: 0.0.1
Cflags: -I${includedir}/mastodont
Libs: -L${libdir} -lmastodont

View file

@ -8,9 +8,9 @@ language("C");
files { "include/*.h", "src/*.c" };
includedirs { "include/" };
configuration { "linux", "bsd", "gmake" }
linkoptions { "`curl-config --libs`" }
linkoptions { "`pkg-config --libs cjson`" }
configuration { "linux", "bsd", "gmake" };
linkoptions { "`curl-config --libs`" };
linkoptions { "`pkg-config --libs cjson`" };
configuration { "Debug" };
defines { "DEBUG" };
@ -20,3 +20,19 @@ configuration { "Release" };
defines { "NDEBUG" };
flags("Optimize");
-- END Mastodont-c
local prefix = os.getenv("PREFIX") or "/usr/local";
local pkgconfig_path = os.getenv("PKG_CONFIG_PATH") or
(os.isdir(prefix .. "/pkgconfig") and prefix .. "/pkgconfig") or
prefix .. "/share/pkgconfig";
newaction {
trigger = "install",
description = "install the library",
execute = function()
os.copyfile("libmastodont.a", prefix .. "/lib");
os.execute("install -d include/ " .. prefix .. "/include");
os.mkdir(pkgconfig_path);
os.copyfile("mastodont.pc", pkgconfig_path .. "/mastodont.pc");
end
}