add pkg-config file for shared library
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/.gitignore b/.gitignore
index 4fa170a..e84e296 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,7 @@ mtest.exe
*.pdf
*.out
tommath.tex
+libtommath.pc
# ignore files generated by testme.sh
gcc_errors_*.txt
diff --git a/libtommath.pc.in b/libtommath.pc.in
new file mode 100644
index 0000000..099b1cd
--- /dev/null
+++ b/libtommath.pc.in
@@ -0,0 +1,10 @@
+prefix=@to-be-replaced@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: LibTomMath
+Description: public domain library for manipulating large integer numbers
+Version: @to-be-replaced@
+Libs: -L${libdir} -ltommath
+Cflags: -I${includedir}
diff --git a/makefile.shared b/makefile.shared
index 02d6fcc..13c8eaf 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -55,6 +55,9 @@ install: $(LIBNAME)
install -d $(INCPATH)
$(LT) --mode=install install -c $(LIBNAME) $(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS_PUB) $(INCPATH)
+ sed -e 's,^prefix=.*,prefix=$(DESTDIR),' -e 's,^Version:.*,Version: $(VERSION),' libtommath.pc.in > libtommath.pc
+ install -d $(LIBPATH)/pkgconfig
+ install -m 644 libtommath.pc $(LIBPATH)/pkgconfig/
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o