mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2025-10-26 19:32:55 +00:00
Update build scripts
Optimize codes.
This commit is contained in:
@@ -15,14 +15,14 @@ RUN apk add --no-cache --virtual .build-tools git g++ build-base linux-headers c
|
|||||||
cc -c -O3 -o duk_module_node.o -I. ../extras/module-node/duk_module_node.c && \
|
cc -c -O3 -o duk_module_node.o -I. ../extras/module-node/duk_module_node.c && \
|
||||||
ar cr libduktape.a duktape.o && \
|
ar cr libduktape.a duktape.o && \
|
||||||
ar cr libduktape_module.a duk_module_node.o && \
|
ar cr libduktape_module.a duk_module_node.o && \
|
||||||
install -m0644 *.a /usr/lib && \
|
install -m0644 ./*.a /usr/lib && \
|
||||||
install -m0644 duk*.h /usr/include && \
|
install -m0644 duk*.h /usr/include && \
|
||||||
install -m0644 ../extras/module-node/duk_module_node.h /usr/include && \
|
install -m0644 ../extras/module-node/duk_module_node.h /usr/include && \
|
||||||
cd ../../../.. && \
|
cd ../../../.. && \
|
||||||
rm -rf duktape /usr/lib/python2.7 && \
|
rm -rf duktape /usr/lib/python2.7 && \
|
||||||
git clone https://github.com/tindy2013/subconverter --depth=1 && \
|
git clone https://github.com/tindy2013/subconverter --depth=1 && \
|
||||||
cd subconverter && \
|
cd subconverter && \
|
||||||
cmake . && \
|
cmake -DCMAKE_BUILD_TYPE=Release . && \
|
||||||
make -j4 && \
|
make -j4 && \
|
||||||
mv subconverter base/ && \
|
mv subconverter base/ && \
|
||||||
mv base ../ && \
|
mv base ../ && \
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ install -m0644 ../extras/module-node/duk_module_node.h /usr/include
|
|||||||
cd ../../../..
|
cd ../../../..
|
||||||
|
|
||||||
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
|
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
|
||||||
cmake .
|
cmake -DCMAKE_BUILD_TYPE=Release .
|
||||||
make -j2
|
make -j2
|
||||||
rm subconverter
|
rm subconverter
|
||||||
g++ -o base/subconverter $(find CMakeFiles/subconverter.dir/src/ -name "*.o") -static -lpcre2-8 -levent -lyaml-cpp -L/usr/lib64 -lcurl -lmbedtls -lmbedcrypto -lmbedx509 -lz -lduktape -lduktape_module -O3 -s
|
g++ -o base/subconverter $(find CMakeFiles/subconverter.dir/src/ -name "*.o") -static -lpcre2-8 -levent -lyaml-cpp -L/usr/lib64 -lcurl -lmbedtls -lmbedcrypto -lmbedx509 -lz -lduktape -lduktape_module -O3 -s
|
||||||
|
|||||||
@@ -32,14 +32,11 @@ install -m0644 ./duk*.h /usr/local/include
|
|||||||
install -m0644 ../extras/module-node/duk_module_node.h /usr/local/include
|
install -m0644 ../extras/module-node/duk_module_node.h /usr/local/include
|
||||||
cd ../../../..
|
cd ../../../..
|
||||||
|
|
||||||
cp curl/lib/libcurl.a .
|
|
||||||
cp yaml-cpp/libyaml-cpp.a .
|
|
||||||
cp duktape/dist/source/src/*.a .
|
|
||||||
cp /usr/local/lib/libevent.a .
|
cp /usr/local/lib/libevent.a .
|
||||||
cp /usr/local/opt/zlib/lib/libz.a .
|
cp /usr/local/opt/zlib/lib/libz.a .
|
||||||
cp /usr/local/lib/libpcre2-8.a .
|
cp /usr/local/lib/libpcre2-8.a .
|
||||||
|
|
||||||
cmake .
|
cmake -DCMAKE_BUILD_TYPE=Release .
|
||||||
make -j8
|
make -j8
|
||||||
rm subconverter
|
rm subconverter
|
||||||
c++ -Xlinker -unexported_symbol -Xlinker "*" -o base/subconverter -framework CoreFoundation -framework Security $(find CMakeFiles/subconverter.dir/src/ -name "*.o") $(find . -name "*.a") -O3
|
c++ -Xlinker -unexported_symbol -Xlinker "*" -o base/subconverter -framework CoreFoundation -framework Security $(find CMakeFiles/subconverter.dir/src/ -name "*.o") $(find . -name "*.a") -O3
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ private:
|
|||||||
std::string current_section;
|
std::string current_section;
|
||||||
ini_data_struct ini_content;
|
ini_data_struct ini_content;
|
||||||
string_array exclude_sections, include_sections, direct_save_sections;
|
string_array exclude_sections, include_sections, direct_save_sections;
|
||||||
string_array read_sections, section_order;
|
string_array section_order;
|
||||||
|
|
||||||
std::string cached_section;
|
std::string cached_section;
|
||||||
ini_data_struct::iterator cached_section_content;
|
ini_data_struct::iterator cached_section_content;
|
||||||
@@ -113,7 +113,7 @@ public:
|
|||||||
bool allow_dup_section_titles = false;
|
bool allow_dup_section_titles = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Keep an empty section while parsing
|
* @brief Keep an empty section while parsing.
|
||||||
*/
|
*/
|
||||||
bool keep_empty_section = true;
|
bool keep_empty_section = true;
|
||||||
|
|
||||||
@@ -145,7 +145,6 @@ public:
|
|||||||
current_section = src.current_section;
|
current_section = src.current_section;
|
||||||
exclude_sections = src.exclude_sections;
|
exclude_sections = src.exclude_sections;
|
||||||
include_sections = src.include_sections;
|
include_sections = src.include_sections;
|
||||||
read_sections = src.read_sections;
|
|
||||||
section_order = src.section_order;
|
section_order = src.section_order;
|
||||||
isolated_items_section = src.isolated_items_section;
|
isolated_items_section = src.isolated_items_section;
|
||||||
//copy preferences
|
//copy preferences
|
||||||
@@ -153,6 +152,7 @@ public:
|
|||||||
store_any_line = src.store_any_line;
|
store_any_line = src.store_any_line;
|
||||||
store_isolated_line = src.store_isolated_line;
|
store_isolated_line = src.store_isolated_line;
|
||||||
allow_dup_section_titles = src.allow_dup_section_titles;
|
allow_dup_section_titles = src.allow_dup_section_titles;
|
||||||
|
keep_empty_section = src.keep_empty_section;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,6 +215,7 @@ public:
|
|||||||
bool inExcludedSection = false, inDirectSaveSection = false;
|
bool inExcludedSection = false, inDirectSaveSection = false;
|
||||||
std::string strLine, thisSection, curSection, itemName, itemVal;
|
std::string strLine, thisSection, curSection, itemName, itemVal;
|
||||||
string_multimap itemGroup, existItemGroup;
|
string_multimap itemGroup, existItemGroup;
|
||||||
|
string_array read_sections;
|
||||||
std::stringstream strStrm;
|
std::stringstream strStrm;
|
||||||
char delimiter = getLineBreak(content);
|
char delimiter = getLineBreak(content);
|
||||||
|
|
||||||
@@ -805,6 +806,9 @@ public:
|
|||||||
return current_section.size() ? SetArray(current_section, itemName, separator, Array) : -1;
|
return current_section.size() ? SetArray(current_section, itemName, separator, Array) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Rename an existing section.
|
||||||
|
*/
|
||||||
int RenameSection(const std::string &oldName, const std::string &newName)
|
int RenameSection(const std::string &oldName, const std::string &newName)
|
||||||
{
|
{
|
||||||
if(!SectionExist(oldName) || SectionExist(newName))
|
if(!SectionExist(oldName) || SectionExist(newName))
|
||||||
@@ -880,7 +884,6 @@ public:
|
|||||||
cached_section_content = ini_content.end();
|
cached_section_content = ini_content.end();
|
||||||
cached_section.erase();
|
cached_section.erase();
|
||||||
}
|
}
|
||||||
//section_order.erase(std::find(section_order.begin(), section_order.end(), section));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -892,6 +895,31 @@ public:
|
|||||||
EraseSection(current_section);
|
EraseSection(current_section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove a section from INI.
|
||||||
|
*/
|
||||||
|
void RemoveSection(const std::string §ion)
|
||||||
|
{
|
||||||
|
if(ini_content.find(section) == ini_content.end())
|
||||||
|
return;
|
||||||
|
ini_content.erase(section);
|
||||||
|
if(cached_section == section)
|
||||||
|
{
|
||||||
|
cached_section.clear();
|
||||||
|
cached_section_content = ini_content.end();
|
||||||
|
}
|
||||||
|
section_order.erase(std::find(section_order.begin(), section_order.end(), section));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove current section from INI.
|
||||||
|
*/
|
||||||
|
void RemoveSection()
|
||||||
|
{
|
||||||
|
if(current_section.size())
|
||||||
|
RemoveSection(current_section);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Export the whole INI data structure into a string.
|
* @brief Export the whole INI data structure into a string.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user