Commit c8666a1e authored by kapsner's avatar kapsner

build our own makefile for solr

parent 384256e3
......@@ -19,71 +19,77 @@ ROOT_FILES=contrib dist
EXAMPLE_FILES=etc contexts lib resources solr-webapp \
README.txt start.jar
solr-$(SOLR_VERSION).tgz:
curl -f '$(SOLR_DL)/$(SOLR_VERSION)/solr-$(SOLR_VERSION).tgz' -o $@
DRIVER=/opt/solr/contrib/dataimporthandler/lib/$(JDBC_DRIVER)
$(DRIVER): $(JDBC_DRIVER_PATH)
mkdir -p /opt/solr/contrib/dataimporthandler/lib/
cp --reflink=auto "$<" "$@"
$(ROOT_FILES): solr-$(SOLR_VERSION).tgz
$(TAR_COMMAND) xzf $< --touch --strip-components=1 solr-$(SOLR_VERSION)/$@
build: $(DRIVER)
# solr-$(SOLR_VERSION).tgz:
# curl -f '$(SOLR_DL)/$(SOLR_VERSION)/solr-$(SOLR_VERSION).tgz' -o $@
$(EXAMPLE_FILES): solr-$(SOLR_VERSION).tgz
$(TAR_COMMAND) xzf $< --touch --strip-components=2 solr-$(SOLR_VERSION)/server/$@
# $(ROOT_FILES): solr-$(SOLR_VERSION).tgz
# $(TAR_COMMAND) xzf $< --touch --strip-components=1 solr-$(SOLR_VERSION)/$@
DRIVER=contrib/dataimporthandler/lib/$(JDBC_DRIVER)
$(DRIVER): $(JDBC_DRIVER_PATH)
test -d contrib || $(MAKE) contrib
mkdir -p contrib/dataimporthandler/lib/
cp --reflink=auto "$<" "$@"
# $(EXAMPLE_FILES): solr-$(SOLR_VERSION).tgz
# $(TAR_COMMAND) xzf $< --touch --strip-components=2 solr-$(SOLR_VERSION)/server/$@
# DRIVER=contrib/dataimporthandler/lib/$(JDBC_DRIVER)
# $(DRIVER): $(JDBC_DRIVER_PATH)
# test -d contrib || $(MAKE) contrib
# mkdir -p contrib/dataimporthandler/lib/
# cp --reflink=auto "$<" "$@"
solr:
mkdir -p solr-$(SOLR_VERSION)/example/solr/
cp -a 450solr/. solr-$(SOLR_VERSION)/example/solr/
# solr:
# mkdir -p solr-$(SOLR_VERSION)/example/solr/
# cp -a 450solr/. solr-$(SOLR_VERSION)/example/solr/
solr/collection1:
test -d solr || $(MAKE) solr #don't add dep because solr is touched on each run
mkdir -p solr/collection1/
cp -a 450solr/collection1/. solr/collection1/
rm $@/core.properties #so solr doesn't see the dir as core
# solr/collection1:
# test -d solr || $(MAKE) solr #don't add dep because solr is touched on each run
# mkdir -p solr/collection1/
# cp -a 450solr/collection1/. solr/collection1/
# rm $@/core.properties #so solr doesn't see the dir as core
CORE_TARGETS=solr/<core_name> solr/<core_name>/conf/schema.xml solr/<core_name>/conf/data-config.xml
FOUND_CORES=$(patsubst data-config/$(DBSUBDIR)/data-config_%.xml.php,\
%,\
$(wildcard data-config/$(DBSUBDIR)/data-config_*.xml.php))
FOUND_CORE_TARGETS=$(foreach corename,$(FOUND_CORES),\
$(subst <core_name>,$(corename),$(CORE_TARGETS)))
#$(info targets: $(FOUND_CORE_TARGETS))
FOUND_CORE_DIRS=$(foreach corename,$(FOUND_CORES),solr/$(corename))
FULL_IMPORT_TARGETS=$(foreach corename,$(FOUND_CORES),$(corename)_full_import)
DELTA_IMPORT_TARGETS=$(foreach corename,$(FOUND_CORES),$(corename)_delta_import)
# CORE_TARGETS=solr/<core_name> solr/<core_name>/conf/schema.xml solr/<core_name>/conf/data-config.xml
# FOUND_CORES=$(patsubst data-config/$(DBSUBDIR)/data-config_%.xml.php,\
# %,\
# $(wildcard data-config/$(DBSUBDIR)/data-config_*.xml.php))
# FOUND_CORE_TARGETS=$(foreach corename,$(FOUND_CORES),\
# $(subst <core_name>,$(corename),$(CORE_TARGETS)))
# #$(info targets: $(FOUND_CORE_TARGETS))
# FOUND_CORE_DIRS=$(foreach corename,$(FOUND_CORES),solr/$(corename))
# FULL_IMPORT_TARGETS=$(foreach corename,$(FOUND_CORES),$(corename)_full_import)
# DELTA_IMPORT_TARGETS=$(foreach corename,$(FOUND_CORES),$(corename)_delta_import)
$(FOUND_CORE_DIRS): solr/collection1 solrconfig.patch
rsync -a $</* $@
echo "name=$(notdir $@)" > $@/core.properties
rm $@/conf/schema.xml
cd $@/conf && patch -p0 < $(realpath solrconfig.patch)
# $(FOUND_CORE_DIRS): solr/collection1 solrconfig.patch
# rsync -a $</* $@
# echo "name=$(notdir $@)" > $@/core.properties
# rm $@/conf/schema.xml
# cd $@/conf && patch -p0 < $(realpath solrconfig.patch)
solr/%/conf/schema.xml: solr/% schemas/schema_%.xml
test -d solr/$* || $(MAKE) solr/$* #solr/$* is touched on each solr run
cp schemas/schema_$*.xml $@
# solr/%/conf/schema.xml: solr/% schemas/schema_%.xml
# test -d solr/$* || $(MAKE) solr/$* #solr/$* is touched on each solr run
# cp schemas/schema_$*.xml $@
solr/%/conf/data-config.xml: data-config/$(DBSUBDIR)/data-config_%.xml.php
test -d solr/$* || $(MAKE) solr/$* #solr/$* is touched on each solr run
php -d variables_order=E $< > $@
# solr/%/conf/data-config.xml: data-config/$(DBSUBDIR)/data-config_%.xml.php
# test -d solr/$* || $(MAKE) solr/$* #solr/$* is touched on each solr run
# php -d variables_order=E $< > $@
solr_home: $(EXAMPLE_FILES) $(DRIVER) $(FOUND_CORE_TARGETS) $(ROOT_FILES)
# solr_home: $(EXAMPLE_FILES) $(DRIVER) $(FOUND_CORE_TARGETS) $(ROOT_FILES)
start: solr_home
java -jar start.jar
# start: solr_home
# java -jar start.jar
$(FULL_IMPORT_TARGETS):
curl -f "http://localhost:8983/solr/$(patsubst %_full_import,%,$@)/dataimport?command=full-import&clean=true"
# $(FULL_IMPORT_TARGETS):
# curl -f "http://localhost:8983/solr/$(patsubst %_full_import,%,$@)/dataimport?command=full-import&clean=true"
$(DELTA_IMPORT_TARGETS):
curl -f "http://localhost:8983/solr/$(patsubst %_delta_import,%,$@)/dataimport?command=delta-import"
# $(DELTA_IMPORT_TARGETS):
# curl -f "http://localhost:8983/solr/$(patsubst %_delta_import,%,$@)/dataimport?command=delta-import"
clean:
rm -rf $(EXAMPLE_FILES) $(ROOT_FILES) solr solr-$(SOLR_VERSION).tgz
# clean:
# rm -rf $(EXAMPLE_FILES) $(ROOT_FILES) solr solr-$(SOLR_VERSION).tgz
clean_cores:
find solr -maxdepth 1 -mindepth 1 -type d ! -name bin ! -name collection1 -exec rm -r {} \;
# clean_cores:
# find solr -maxdepth 1 -mindepth 1 -type d ! -name bin ! -name collection1 -exec rm -r {} \;
.PHONY: start solr_home clean solr/%/conf/data-config.xml
# .PHONY: start solr_home clean solr/%/conf/data-config.xml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment