diff --git a/mastodont.pc b/mastodont.pc new file mode 100644 index 0000000..33be142 --- /dev/null +++ b/mastodont.pc @@ -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 \ No newline at end of file diff --git a/premake4.lua b/premake4.lua index 42b8fcc..dbc5a32 100644 --- a/premake4.lua +++ b/premake4.lua @@ -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 +} \ No newline at end of file