diff --git a/src/DoConfig b/src/DoConfig index ad583c3..54e5fab 100644 --- a/src/DoConfig +++ b/src/DoConfig @@ -47,6 +47,8 @@ system("echo '*** CompilerOutput.log ***' > CompilerOutput.log"); 'TUNE' => 'generic', +'PACKAGE_VERSION' => undef, + ); @@ -283,6 +285,12 @@ if ($ConfigFlag{'NTL_GF2X_LIB'} eq 'on') { } } +# retrieve ntl version from DIRNAME +open(DIRNAME, "< DIRNAME"); +@versionline = split('-',); +chomp($versionline[1]); +$MakeVal{'PACKAGE_VERSION'} = $versionline[1]; +close(DIRNAME); # copy %MakeVal and %MakeFlag as is into %MakeSub @@ -397,7 +405,23 @@ sub GenFiles { close(MFILE); close(MFILEOUT); - + # generate ntl.pc + + open(NTLPCIN, "< ntl.pc.in"); + open(NTLPC, "> ntl.pc"); + + while ($line = ) { + + $line =~ s/@\{(.*?)\}/$MakeSub{$1}/ge; + $line =~ tr/()/{}/; + + print NTLPC $line; + + } + + close(NTLPCIN); + close(NTLPC); + # generate config.h diff --git a/src/mfile b/src/mfile index 540a3a5..56eaf39 100644 --- a/src/mfile +++ b/src/mfile @@ -453,7 +453,9 @@ install: @{LSTAT} cp -p ntl.a $(DESTDIR)$(LIBDIR)/libntl.a #LSTAT @{LSTAT} - chmod a+r $(DESTDIR)$(LIBDIR)/libntl.a #LSTAT @{LSHAR} $(LIBTOOL) --mode=install cp -p libntl.la $(DESTDIR)$(LIBDIR) #LSHAR - + mkdir -p -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig + cp -p ntl.pc $(DESTDIR)$(LIBDIR)/pkgconfig/ + - chmod a+r $(DESTDIR)$(LIBDIR)/pkgconfig/ntl.pc uninstall: @{LSTAT} rm -f $(LIBDIR)/libntl.a #LSTAT diff --git a/src/ntl.pc.in b/src/ntl.pc.in new file mode 100644 index 0000000..07e78dd --- /dev/null +++ b/src/ntl.pc.in @@ -0,0 +1,19 @@ +# Define these NTL configuration variables as they may not be +# substited by DoConfig +DEF_PREFIX=@{DEF_PREFIX} +PREFIX=@{PREFIX} +# optional dependencies +@{GF2X}GF2X_PKG=gf2x +@{GMP}GMP_PKG=gmp +# Normal pc file starts here +prefix=@{PREFIX} +libdir=@{LIBDIR} +includedir=@{INCLUDEDIR} + +Name: ntl +URL: http://www.shoup.net/ +Description: A library for doing number theory +Version: @{PACKAGE_VERSION} +Libs: -L${libdir} -lntl +Cflags: -I${includedir} @{CXXAUTOFLAGS} +Requires.private: ${GF2X_PKG} ${GMP_PKG}