linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06907
[Branch ~dcplusplus-team/dcpp-plugin-sdk-c/trunk] Rev 19: info.xml generator
------------------------------------------------------------
revno: 19
committer: poy <poy@xxxxxxxxxx>
branch nick: dcpp-plugin-sdk-c
timestamp: Wed 2013-05-22 21:25:44 +0200
message:
info.xml generator
added:
packaging/
packaging/packager/
packaging/packager/packager.cpp
modified:
.bzrignore
projects/make/Makefile
--
lp:dcpp-plugin-sdk-c
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcpp-plugin-sdk-c.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/trunk/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore 2013-04-28 21:07:59 +0000
+++ .bzrignore 2013-05-22 19:25:44 +0000
@@ -12,6 +12,8 @@
./doc/build.bat
./doc/html
./doc/latex
+./packaging/*
+!./packaging/packager
./projects/make/build*
./projects/vs2010/Debug
./projects/vs2010/ipch
=== added directory 'packaging'
=== added directory 'packaging/packager'
=== added file 'packaging/packager/packager.cpp'
--- packaging/packager/packager.cpp 1970-01-01 00:00:00 +0000
+++ packaging/packager/packager.cpp 2013-05-22 19:25:44 +0000
@@ -0,0 +1,68 @@
+// Generate an info.xml template from the version.h file.
+
+#include <fstream>
+#include <iostream>
+
+#include <pluginsdk/PluginDefs.h>
+#include <src/version.h>
+
+using namespace std;
+
+string escape(string str) {
+ size_t i = 0;
+ while((i = str.find_first_of("<>&", i)) != string::npos) {
+ switch(str[i]) {
+ case '<': str.replace(i, 1, "<"); i += 4; break;
+ case '>': str.replace(i, 1, ">"); i += 4; break;
+ case '&': str.replace(i, 1, "&"); i += 5; break;
+ default: ++i; break;
+ }
+ }
+ return str;
+}
+
+enum { Path = 1, LastCompulsory = Path };
+
+int main(int argc, char* argv[]) {
+ if(argc <= LastCompulsory) {
+ cout << "packager: no path given by the build script" << endl;
+ return 1;
+ }
+
+ ofstream f(argv[Path]);
+ if(!f.is_open()) {
+ cout << "packager: cannot open " << argv[Path] << endl;
+ return 2;
+ }
+
+ f << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n\n"
+ "<!--\n"
+ "This file is an example info.xml to be included in the dcext package. For more\n"
+ "information, read \"Plugin format (dcext).txt\" in the \"doc\" directory.\n\n"
+ "This file has been generated using the information filled in the src/version.h file.\n\n"
+ "Edit the <Plugin> tags to include your plugin files.\n"
+ "If you support Windows, include pe-x64 and pe-x86 platforms.\n"
+ "If you support Linux, include elf-x64 and elf-x86 platforms.\n\n"
+ "The <Files> tag is empty; should you want to distribute additional files, include them\n"
+ "in there within <File> tags (again, more information in the above doc file).\n\n"
+ "When you are done editing this file, rename it to \"info.xml\", move the relevant files\n"
+ "to this directory and zip them; rename that .zip to .dcext and you are done!\n"
+ "-->\n\n"
+ "<dcext>\n"
+ "\t<UUID>" << escape(PLUGIN_GUID).c_str() << "</UUID>\n"
+ "\t<Name>" << escape(PLUGIN_NAME).c_str() << "</Name>\n"
+ "\t<Version>" << PLUGIN_VERSION << "</Version>\n"
+ "\t<ApiVersion>" << DCAPI_CORE_VER << "</ApiVersion>\n"
+ "\t<Author>" << escape(PLUGIN_AUTHOR).c_str() << "</Author>\n"
+ "\t<Description>" << escape(PLUGIN_DESC).c_str() << "</Description>\n"
+ "\t<Website>" << escape(PLUGIN_WEB).c_str() << "</Website>\n"
+ "\t<Plugin Platform=\"elf-x64\">MyPlugin-x64.so</Plugin>\n"
+ "\t<Plugin Platform=\"elf-x86\">MyPlugin-x86.so</Plugin>\n"
+ "\t<Plugin Platform=\"pe-x64\">MyPlugin-x64.dll</Plugin>\n"
+ "\t<Plugin Platform=\"pe-x86\">MyPlugin-x86.dll</Plugin>\n"
+ "\t<Files>\n"
+ "\t</Files>\n"
+ "</dcext>\n";
+
+ return 0;
+}
=== modified file 'projects/make/Makefile'
--- projects/make/Makefile 2013-04-28 21:07:59 +0000
+++ projects/make/Makefile 2013-05-22 19:25:44 +0000
@@ -25,8 +25,10 @@
COMPILER_SPEC = $(shell $(CC) -dumpmachine)
ifeq ($(findstring mingw, $(COMPILER_SPEC)),)
+ BINEXT =
LIBEXT = .so
else
+ BINEXT = .exe
CPPFLAGS += -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 \
-DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN \
-DWIN32 -D_WIN32 -DUNICODE -D_UNICODE
@@ -58,11 +60,20 @@
TARGET := $(OUTPUT_DIR)/$(TARGET)$(LIBEXT)
OBJS := $(addprefix $(OUTPUT_DIR)/, $(OBJS))
-all: $(TARGET)
+PACKAGER = $(OUTPUT_DIR)/packaging/packager$(BINEXT)
+PACK_INFO = ../../packaging/info_generated.xml
+
+all: $(TARGET) $(PACK_INFO)
$(TARGET): $(OBJS)
$(CC) $^ $(LINKFLAGS) $(OUTPUT_OPTION)
+$(PACKAGER): $(OUTPUT_DIR)/packaging/packager/packager.o
+ $(CXX) $^ $(subst -shared,,$(LINKFLAGS) $(LINKXXFLAGS)) $(OUTPUT_OPTION)
+
+$(PACK_INFO): $(PACKAGER)
+ $(PACKAGER) $(PACK_INFO)
+
$(OUTPUT_DIR)/%.o: %.c
$(COMPILE.c) $< $(OUTPUT_OPTION)
@@ -74,7 +85,10 @@
$(OBJS): | $(OUTPUT_DIR)
+$(PACKAGER): | $(OUTPUT_DIR)
+
$(OUTPUT_DIR):
+ $(call MKDIR,$(OUTPUT_DIR)/packaging/packager)
$(call MKDIR,$(OUTPUT_DIR)/pluginsdk)
$(call MKDIR,$(OUTPUT_DIR)/src)