From: Kyungwook Tak Date: Thu, 19 Nov 2015 05:36:30 +0000 (+0900) Subject: Add devel package with pkg-config for clients X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F00%2F52100%2F1;p=platform%2Fupstream%2Fcsf-framework.git Add devel package with pkg-config for clients Change-Id: Iba15d965308789fa6006454754fce3d5648d97f0 Signed-off-by: Kyungwook Tak --- diff --git a/framework/Makefile b/framework/Makefile index fc00d3e..c613ca3 100644 --- a/framework/Makefile +++ b/framework/Makefile @@ -29,8 +29,11 @@ # OF THE POSSIBILITY OF SUCH DAMAGE. # +MAJOR := $(shell echo "$(VERSION)" | awk -F. '{print $$1}') +NAME := secfw OUTDIR = lib -TARGET = $(OUTDIR)/libsecfw.so +TARGET = lib$(NAME).so +TARGET_PC = csf-framework.pc SRCDIR = . INCLUDE = -I. $(TCS_INC) -I../plugin LD_FLAGS := $(LD_FLAGS) -ldl -lpthread $(shell pkg-config --libs libtzplatform-config) @@ -80,24 +83,49 @@ else endif SOURCES = $(SRCDIR)/TCSImpl.c $(SRCDIR)/TWPImpl.c - OBJECTS = $(OUTDIR)/TCSImpl.o $(OUTDIR)/TWPImpl.o $(OUTDIR)/%.o: $(SRCDIR)/%.c $(CC) $(CFLAGS) $(PKGCFLAGS) -I. -o $(OUTDIR)/$*.o -c $(SRCDIR)/$*.c -all: $(OUTDIR) $(TARGET) +$(OUTDIR)/$(TARGET).$(VERSION): $(OBJECTS) + $(CC) -shared -Wl,-zdefs,-soname,$(TARGET).$(MAJOR) -o $@ $(OBJECTS) $(LD_FLAGS) $(PKGLD_FLAGS) + +all: $(OUTDIR) $(OUTDIR)/$(TARGET) $(OUTDIR)/${TARGET_PC} -$(TARGET): $(OBJECTS) - $(CC) -shared -Wl,-zdefs -o $(TARGET) $(OBJECTS) $(LD_FLAGS) $(PKGLD_FLAGS) +# this symlinks generation is for dependent package (TWPSerDaemon) +$(OUTDIR)/$(TARGET): $(OUTDIR)/$(TARGET).$(VERSION) + ln -s $(TARGET).$(VERSION) $(OUTDIR)/$(TARGET).$(MAJOR) + ln -s $(TARGET).$(MAJOR) $(OUTDIR)/$(TARGET) $(OUTDIR): @mkdir $(OUTDIR) +$(OUTDIR)/$(TARGET_PC): $(OUTDIR/$(TARGET) + @ ( \ + echo 'prefix=$(PREFIX)'; \ + echo 'libdir=$${prefix}/lib'; \ + echo 'includedir=$${prefix}/include'; \ + echo ''; \ + echo 'Name: csf-framework'; \ + echo 'Description: Content screening framework'; \ + echo 'Version: $(VERSION)'; \ + echo 'Libs: -L$${libdir} -l$(NAME)'; \ + echo 'Cflags: -I$${includedir}/csf' ) > $@ + distclean: clean @rm -rf $(OUTDIR) clean: - @rm -f $(TARGET) + @rm -f $(OUTDIR)/* @rm -f $(OBJECTS) *~ @rm -f *.bb *.bbg *.da *.gcov + +install: + install $(OUTDIR)/$(TARGET).$(VERSION) $(LIB_DESTDIR) + ln -s $(TARGET).$(VERSION) $(LIB_DESTDIR)/$(TARGET).$(MAJOR) + ln -s $(TARGET).$(MAJOR) $(LIB_DESTDIR)/$(TARGET) + install -m0644 TCSImpl.h $(HEADER_DESTDIR) + install -m0644 TWPImpl.h $(HEADER_DESTDIR) + install -m0644 TCSErrorCodes.h $(HEADER_DESTDIR) + install -m0644 $(OUTDIR)/$(TARGET_PC) $(LIB_DESTDIR)/pkgconfig diff --git a/packaging/csf-framework.spec b/packaging/csf-framework.spec index 4b63aca..a36740d 100644 --- a/packaging/csf-framework.spec +++ b/packaging/csf-framework.spec @@ -19,6 +19,14 @@ BuildRequires: pkgconfig(libxml-2.0) %description A general purpose content screening and reputation solution. +%package devel +Summary: Development files +Group: Development/Libraries +Requires: %name = %version-%release + +%description devel +Development files + %prep %setup -q cp %{SOURCE1001} . @@ -28,22 +36,21 @@ cp %{SOURCE1004} . cp %{SOURCE1005} . %build -cd framework # Build Framework Library -make -f Makefile all +make -C framework -f Makefile all VERSION=%version PREFIX=%_prefix # Build IPC Client Library -make -f Makefile_channel_client all +make -C framework -f Makefile_channel_client all # Build IPC Server Library -make -f Makefile_channel_server all +make -C framework -f Makefile_channel_server all # Build Plugin Control Service -make -f Makefile_TPCSSerDaemon all +make -C framework -f Makefile_TPCSSerDaemon all # Build Web Protection Control Service -make -f Makefile_TWPSerDaemon all +make -C framework -f Makefile_TWPSerDaemon all %install rm -rf %{buildroot} @@ -51,7 +58,6 @@ mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_libdir} mkdir -p %{buildroot}%{_unitdir} mkdir -p %{buildroot}/%{_sysconfdir}/dbus-1/system.d -install -D framework/lib/libsecfw.so %{buildroot}%{_libdir}/ install -D framework/lib/libscclient.so %{buildroot}%{_libdir}/ install -D framework/lib/libscserver.so %{buildroot}%{_libdir}/ install -D framework/bin/TPCSSerDaemon %{buildroot}%{_bindir}/ @@ -61,6 +67,14 @@ install -m0644 %{SOURCE1003} %{buildroot}%{_sysconfdir}/dbus-1/system.d/ install -m0644 %{SOURCE1004} %{buildroot}%{_unitdir} install -m0644 %{SOURCE1005} %{buildroot}%{_unitdir} +mkdir -p %buildroot%_includedir/csf +mkdir -p %buildroot%_libdir/pkgconfig + +make install -C framework \ + LIB_DESTDIR=%buildroot%_libdir \ + HEADER_DESTDIR=%buildroot%_includedir/csf \ + VERSION=%version + %post /sbin/ldconfig systemctl daemon-reload @@ -90,7 +104,7 @@ rm -fr /usr/bin/tpcs_config.xml %files %manifest %{name}.manifest %defattr(-,root,root,-) -%{_libdir}/libsecfw.so +%{_libdir}/libsecfw.so.* %{_libdir}/libscclient.so %{_libdir}/libscserver.so %defattr(0755,root,root) @@ -101,3 +115,10 @@ rm -fr /usr/bin/tpcs_config.xml %config %{_sysconfdir}/dbus-1/system.d/com.tsc.ipc.server.wp.conf %{_unitdir}/tpcsserdaemon.service %{_unitdir}/twpserdaemon.service + +%files devel +%_includedir/csf/TCSErrorCodes.h +%_includedir/csf/TCSImpl.h +%_includedir/csf/TWPImpl.h +%_libdir/pkgconfig/%name.pc +%_libdir/libsecfw.so