export CC_OPTS = -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
-I$(LIBXML2_HEADERS)/libxml -I$(TMP) -I$(TMPDIR)
-all: mod_xmltools
+all: mod_xmltools mod_ils_rest_gateway
install: perl-install web-install string-templates-install storage-bootstrap xsl-install
-web-install: webcore-install autojs-install mod_xmltools-install
+web-install: webcore-install autojs-install mod_xmltools-install mod_ils_rest_gateway-install
# -----------------------------------------------------------------------------------
# Web stuff
# -----------------------------------------------------------------------------------
+mod_ils_rest_gateway:
+ echo $@
+ make -C apachemods mod_ils_rest_gateway.so
+
+mod_ils_rest_gateway-install:
+ echo $@
+ make -C apachemods mod_ils_rest_gateway-install
+
mod_xmltools:
echo $@
make -C apachemods mod_xmltools.so
LD_OPTS += -lxml2 -lc_utils -lxslt
-all: mod_xmltools.so
+all: mod_xmltools.so mod_ils_rest_gateway.so
-install: mod_xmltools-install
+install: mod_xmltools-install mod_ils_rest_gateway-install libfieldmapper-install
mod_xmltools.so: apachetools.o xmltools.o mod_xmltools.c mod_xmltools.h
echo $@
echo $@
$(CC) -c $(CC_OPTS) xmltools.c -o $@
+fieldmapper_lookup.c: fieldmapper_lookup.h
+ ./fieldmapper_lookup-gen.pl fieldmapper_lookup.c
+
+json_xml.o: json_xml.c json_xml.h
+ echo $@
+ $(CC) -c $(CC_OPTS) json_xml.c -o $@
+
+fieldmapper_lookup.o: fieldmapper_lookup.c fieldmapper_lookup.h
+ echo $@
+ $(CC) -c $(CC_OPTS) fieldmapper_lookup.c -o $@
+
+libfieldmapper.so: fieldmapper_lookup.o
+ echo $@
+ $(CC) $(LD_OPTS) -shared -W1 fieldmapper_lookup.o -o $@
+
+libfieldmapper-install: libfieldmapper.so
+ echo installing libfieldmapper.so
+ mkdir -p $(INCLUDEDIR)/
+ cp fieldmapper_lookup.h $(INCLUDEDIR)/
+ cp libfieldmapper.so $(LIBDIR)/libfieldmapper.so
+
+ils_rest_gateway.o: mod_rest_gateway.c mod_rest_gateway.h fieldmapper_lookup.h
+ echo $@
+ $(CC) -c $(CC_OPTS) mod_rest_gateway.c -o $@
+
+mod_ils_rest_gateway.so: libfieldmapper.so ils_rest_gateway.o
+ echo $@
+ $(CC) $(LD_OPTS) -shared -W1 ils_rest_gateway.o -lfieldmapper -o $@
+
+
+mod_ils_rest_gateway-install:
+ echo $@
+ $(APXS2) -i -a -n mod_ils_rest_gateway mod_ils_rest_gateway.so
+ echo "-----------------------------------------------";
+ echo -e "* Important * : Change httpd.conf from this: \n \
+ LoadModule mod_ils_rest_gateway_module modules/mod_ils_rest_gateway.so \n \
+ to this: \n \
+ LoadModule mod_ils_rest_gateway modules/mod_ils_rest_gateway.so"
+ echo -e "Supported configuration options:\
+ \nILSRestGatewayConfig <config-file>\
+ echo "-----------------------------------------------";
+ echo ""
+
mod_xmltools-install:
echo $@
$(APXS2) -i -a -n mod_xmltools mod_xmltools.so
clean:
echo $@
- /bin/rm -f *.o xmltools mod_xmltools.so
+ /bin/rm -f *.o xmltools mod_xmltools.so libfieldmapper.so mod_ils_rest_gateway.so
+ /bin/rm -f fieldmapper_lookup.c
my $map = {};
eval "
use lib '../perlmods/';
+ use lib '../../../OpenSRF/src/perlmods/';
use OpenILS::Utils::Fieldmapper;
";
$map = $Fieldmapper::fieldmap unless ($@);
}
int isFieldmapper(char* class) {
- if (class == NULL) return NULL;
+ if (class == NULL) return 0;
C
for my $object (keys %$map) {
my $short_name= $map->{$object}->{hint};
- print SOURCE " else if (!strcmp(class, \"$short_name\")) return 1;";
+ print SOURCE " else if (!strcmp(class, \"$short_name\")) return 1;\n";
}
print SOURCE <<C;
- return NULL;
+ return 0;
}
-int fm_ntop(char* class, char* field);
- if (class == NULL) return NULL;
+int fm_ntop(char* class, char* field) {
+ if (class == NULL) return 0;
C
print SOURCE " }\n"
}
-print SOURCE " return -1;\n}";
+print SOURCE " return -1;\n}\n";
warn "done\n";
#include <string.h>
#include <stdio.h>
-/* the JSON parser, so we can read the response we're XMLizing */
-#include "objson/object.h"
-#include "objson/json_parser.h"
-#include "utils.h"
-
int isFieldmapper(char*);
-int fm_ntop(char*,char*);
-char* fm_pton(char*,int);
+char * fm_pton(char *, int);
+int fm_ntop(char *, char *);
-#include "mod_ils_gateway.h"
+#include "mod_rest_gateway.h"
char* ils_rest_gateway_config_file;
#include "objson/object.h"
#include "objson/json_parser.h"
-#include "rest_xml.h"
+#include "json_xml.h"
#define GATEWAY_CONFIG "ILSRestGatewayConfig"
#define MODULE_NAME "ils_rest_gateway_module"
#define CONFIG_CONTEXT "rest_gateway"
-I$(LIBXML2_HEADERS)/libxml -I$(TMP) -I$(TMPDIR)
-all: prep router srfsh jserver gateway rest_gateway
+all: prep router srfsh jserver gateway
install: install-prep transport-install stack-install gateway-install \
router-install srfsh-install jserver-install perl-install \
gateway: stack
make -C gateway
-rest_gateway: stack
- make -e -C gateway rest_gateway
-
jserver: c_utils
make -C jserver
;;
"opensrf_gateway" )
- if building; then
- $MAKE -C "$OPENSRFDIR" "gateway";
- $MAKE -C "$OPENSRFDIR" "rest_gateway";
- fi;
-
+ if building; then $MAKE -C "$OPENSRFDIR" "gateway"; fi;
if installing; then $MAKE -C "$OPENSRFDIR" "gateway-install"; fi;
;;
"openils_web" )
if building; then $MAKE -C "$OPENILSDIR" "mod_xmltools"; fi;
+ if building; then $MAKE -C "$OPENILSDIR" "mod_ils_rest_gateway"; fi;
if installing; then $MAKE -C "$OPENILSDIR" "web-install"; fi;
;;