# 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)
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
%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} .
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}
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}/
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
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_libdir}/libsecfw.so
+%{_libdir}/libsecfw.so.*
%{_libdir}/libscclient.so
%{_libdir}/libscserver.so
%defattr(0755,root,root)
%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