⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pkgcreate.ch

📁 图片显示,电脑光于望技术湖连望键往,网络
💻 CH
📖 第 1 页 / 共 2 页
字号:
#!/bin/ch#include <unistd.h>   // for access()#include <dlfcn.h>    // for dlopen()#include <chshell.h>  // for chinfo()int addChdlHeader(char *headerfile, char *macro, char *chdlheader);int removeFuncProto(char *filename, char *funcname, int keepNum);int correctRetval();string_t pkgname="chlibxml2";       // define package namechinfo_t info;                  // for Ch version numberstring_t cwd = _cwd;            // the current working directorystring_t lib_header_dir;        // library header files directorystring_t debugFile;             // compilation debug information in Windowsstring_t debug;string_t makecmd;string_t list;char *token;#if defined(_WIN32_)    debug=">nul 2>nul";         // surpress messages during cleaning  in Windows    debugFile =">logfile 2>&1"; // compilation debug information in 'logfile'    makecmd = "nmake -f Makefile.win";#else    makecmd = "make -f Makefile";#endif//make sure pgkcreate.ch is run from the current working directoryif(access("pkgcreate.ch", R_OK)) {    echo Run ./pkgcreate.ch in the current directory.    exit(-1);}// run this script in proper Ch versionchinfo(&info);if ((info.vermajor*100+ info.verminor*10 +  info.vermicro) < 501) {   echo "To run this script, you need to install Ch version 5.0.1.12201 or higher"   echo "You can download the latest version from http://www.softintegration.com/download"   exit(-1);}/* for Windows, manually update header files in dir ./include first */#if defined(_WIN32_)     lib_header_dir = "include";#else/*  we assume the library header files are either    in /usr/local/include or /usr/include*/if (access("/usr/local/include/libxml2/libxml/parser.h", R_OK ) == 0){        //echo "we assume xml header files are located in /usr/local/include";        lib_header_dir="/usr/local/include/libxml2";}else if  (access("/usr/include/libxml2/libxml/parser.h", R_OK ) == 0){        //echo "we assume xml header files are located in /usr/include";        lib_header_dir = "/usr/include/libxml2";}else{        echo "Error: unable to find xml header files.";        echo "Please download xml source code and install it first.";        exit(-1);}#endifecho Cleaning up existing directories and create new ones ...if (!access(pkgname, F_OK))  rm -rf $pkgname/* create directories */echo create $pkgname directories ...mkdir $pkgnamemkdir $pkgname/dl $pkgname/lib $pkgname/include $pkgname/demos $pkgname/binecho Copying header files ...cp -r $lib_header_dir/libxml     $pkgname/include// if the original package doesn't have the modiciation for Chif(`grep LOAD_CHDL $pkgname/include/libxml/parser.h` == NULL){  echo Adding LOAD_CHDL into parser.h ...  char *macro ="#define __XML_PARSER_H__";  char *chdlheader =   "\n\n"   "#ifdef _CH_\n"   "#pragma package <chiconv> \n"   "#pragma package <chzlib> \n"   "#pragma package <chlibxml2> \n"   "#include <chdl.h> \n"   "LOAD_CHDL(xml2); \n"   "#pragma importf <Ch_LibXML2.chf>\n"   "#endif \n";  addChdlHeader(stradd(pkgname, "/include/libxml/parser.h"), macro, chdlheader);}echo Copying demo programs ...cp -fr demos/*   $pkgname/demoschmod 755 $pkgname/demos/*.c*//echo copying DLLs ...#if defined(_WIN32_)    //if there is dynamical library pkgname     cp -f bin/*.dll $pkgname/bin/ >nul 2>&1#endifecho Extracting function prototypes ...echo Creating a header file containing all functions to export ...cd $pkgname/include/libxmllist = `grep -l "XMLPUBFUN.*XMLCALL" *.h`;cd ../../../rm -rf chfcreate/*.hforeach(token; list){   sed -f xml1.sed $pkgname/include/libxml/$token > chfcreate/$token}echo Remove special function prototypes .../* Internal functions that should not be used */removeFuncProto("chfcreate/tree.h", "xmlBufferWriteCHAR", 0);removeFuncProto("chfcreate/tree.h", "xmlBufferWriteChar", 0);removeFuncProto("chfcreate/tree.h", "xmlBufferWriteQuotedString", 0);removeFuncProto("chfcreate/tree.h", "xmlBufferWriteQuotedString", 0);removeFuncProto("chfcreate/tree.h", "xmlAttrSerializeTxtContent", 0);removeFuncProto("chfcreate/xmlerror.h", "__xmlRaiseError", 0);removeFuncProto("chfcreate/xmlerror.h", "__xmlSimpleError", 0);/* Special handmade functions */removeFuncProto("chfcreate/encoding.h", "xmlRegisterCharEncodingHandler", 0);removeFuncProto("chfcreate/encoding.h", "xmlGetCharEncodingHandler", 0);removeFuncProto("chfcreate/encoding.h", "xmlFindCharEncodingHandler", 0);removeFuncProto("chfcreate/encoding.h", "xmlNewCharEncodingHandler", 0);removeFuncProto("chfcreate/globals.h", "xmlInitializeGlobalState", 0);removeFuncProto("chfcreate/globals.h", "xmlRealloc", 0);removeFuncProto("chfcreate/globals.h", "xmlThrDefSetGenericErrorFunc", 0);removeFuncProto("chfcreate/globals.h", "xmlThrDefSetStructuredErrorFunc", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseDoc", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXUserParseFile", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXUserParseMemory", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseMemory", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseMemoryWithData", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseFile", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseFileWithData", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseEntity", 0);removeFuncProto("chfcreate/parser.h", "xmlSAXParseDTD", 0);removeFuncProto("chfcreate/parser.h", "xmlIOParseDTD", 0);removeFuncProto("chfcreate/parser.h", "xmlParseBalancedChunkMemory", 0);removeFuncProto("chfcreate/parser.h", "xmlParseBalancedChunkMemoryRecover", 0);removeFuncProto("chfcreate/parser.h", "xmlParseExternalEntity", 0);removeFuncProto("chfcreate/parser.h", "xmlCreatePushParserCtxt", 0);removeFuncProto("chfcreate/parser.h", "xmlCreateIOParserCtxt", 0);removeFuncProto("chfcreate/parser.h", "xmlSetExternalEntityLoader", 0);removeFuncProto("chfcreate/parser.h", "xmlGetExternalEntityLoader", 0);removeFuncProto("chfcreate/parserInternals.h", "xmlParserError", 0);removeFuncProto("chfcreate/relaxng.h",                 "xmlRelaxNGSetParserErrors", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteFormatDTDAttlist", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteVFormatDTDElement", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteFormatDTDElement", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteVFormatDTDInternalEntity", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteFormatDTDInternalEntity", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatDTD", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatDTD", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteVFormatElementNS", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteFormatElementNS", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatElement", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatElement", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatPI", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatPI", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatRaw", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatRaw", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatString", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatString", 0);removeFuncProto("chfcreate/SAX2.h", "xmlSAX2SetDocumentLocator", 0);removeFuncProto("chfcreate/xmlerror.h", "xmlSetGenericErrorFunc", 0);removeFuncProto("chfcreate/xmlerror.h", "initGenericErrorDefaultFunc", 0);removeFuncProto("chfcreate/xmlerror.h", "xmlSetStructuredErrorFunc", 0);removeFuncProto("chfcreate/xmlerror.h", "xmlParserError", 0);removeFuncProto("chfcreate/xmlerror.h", "xmlParserWarning", 0);removeFuncProto("chfcreate/xmlerror.h", "xmlParserValidityError", 0);removeFuncProto("chfcreate/xmlerror.h", "xmlParserValidityWarning", 0);removeFuncProto("chfcreate/xmlerror.h", "__xmlRaiseError", 0);removeFuncProto("chfcreate/xmlIO.h", "xmlOutputBufferCreateIO", 0);removeFuncProto("chfcreate/xmlIO.h", "xmlParserInputBufferCreateIO", 0);removeFuncProto("chfcreate/xmlIO.h", "xmlRegisterInputCallbacks", 0);removeFuncProto("chfcreate/xmlIO.h", "xmlRegisterOutputCallbacks", 0);removeFuncProto("chfcreate/xmlmemory.h", "xmlRealloc", 0);removeFuncProto("chfcreate/xmlschemas.h", "xmlSchemaSetParserErrors", 0);removeFuncProto("chfcreate/xmlschemas.h", "xmlSchemaSetValidErrors", 0);removeFuncProto("chfcreate/xmlstring.h", "xmlStrPrintf", 0);removeFuncProto("chfcreate/xmlstring.h", "xmlStrVPrintf", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteVFormatAttributeNS", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteFormatAttributeNS", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteVFormatAttribute", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteFormatAttribute", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatCDATA", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatCDATA", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteVFormatComment", 0);removeFuncProto("chfcreate/xmlwriter.h", "xmlTextWriterWriteFormatComment", 0);removeFuncProto("chfcreate/xmlwriter.h",                 "xmlTextWriterWriteVFormatDTDAttlist", 0);/* Not in the library */removeFuncProto("chfcreate/SAX2.h", "xmlSAX2GlobalNamespace", 0);removeFuncProto("chfcreate/SAX2.h", "xmlSAX2SetNamespace", 0);removeFuncProto("chfcreate/SAX2.h", "xmlSAX2GetNamespace", 0);removeFuncProto("chfcreate/SAX2.h", "xmlSAX2CheckNamespace", 0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -