### Install Library with Autotools Source: https://github.com/gnome/libxml2/blob/master/README.md Command to install the built libxml2 library after successful compilation and testing. ```bash make install ``` -------------------------------- ### Install Library with Meson Source: https://github.com/gnome/libxml2/blob/master/README.md Command to install the built library using Meson and Ninja after successful build and testing. ```bash ninja -C builddir install ``` -------------------------------- ### Install Library with CMake Source: https://github.com/gnome/libxml2/blob/master/README.md Command to install the built library using CMake after successful build and testing. ```bash cmake --install builddir ``` -------------------------------- ### Enable Optimizations with Autotools Source: https://github.com/gnome/libxml2/blob/master/README.md Example of how to enable compiler optimizations and specific flags during the configure step with Autotools. ```bash CFLAGS='-O2 -fno-semantic-interposition' ./configure ``` -------------------------------- ### Generate Python Bindings Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Sets up a custom command to generate C header and source files for Python bindings using a generator script. It also defines a Python library target and configures its properties and installation. ```cmake add_custom_command( OUTPUT libxml2-py.c libxml2-py.h libxml2.py COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py ${CMAKE_CURRENT_BINARY_DIR} DEPENDS python/generator.py Doxygen ) Python3_add_library( LibXml2Mod MODULE WITH_SOABI libxml2-py.c libxml2-py.h python/libxml.c python/libxml_wrap.h python/types.c ) target_include_directories( LibXml2Mod PRIVATE $ ) target_link_libraries(LibXml2Mod PRIVATE LibXml2) set_target_properties( LibXml2Mod PROPERTIES IMPORT_PREFIX lib OUTPUT_NAME xml2mod PREFIX lib ) install( TARGETS LibXml2Mod ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development LIBRARY DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime NAMELINK_COMPONENT development RUNTIME DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime ) if(MSVC AND BUILD_SHARED_LIBS) install(FILES $ DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) ``` -------------------------------- ### Configure and Build with Meson Source: https://github.com/gnome/libxml2/blob/master/README.md Basic Meson commands to set up the build directory and compile the library using Ninja. ```bash meson setup [options] builddir ninja -C builddir ``` -------------------------------- ### Configure and Build with Autotools Source: https://github.com/gnome/libxml2/blob/master/README.md Standard commands to configure and build the libxml2 library after extracting a source tarball. ```bash ./configure [configuration options] make ``` -------------------------------- ### Configure and Build with CMake Source: https://github.com/gnome/libxml2/blob/master/README.md Basic CMake commands to configure the build in a separate directory and then build the library. ```bash cmake -S libxml2-xxx -B builddir [options] cmake --build builddir ``` -------------------------------- ### Run Meson Test Suite Source: https://github.com/gnome/libxml2/blob/master/README.md Command to execute the test suite using Meson after building the library. ```bash meson test -C builddir ``` -------------------------------- ### Update CI Docker Image Source: https://github.com/gnome/libxml2/blob/master/MAINTAINERS.md Login to the GitLab registry, build the CI Docker image, and push it. Ensure you have a GitLab access token with appropriate permissions. ```bash docker login -u -p \ registry.gitlab.gnome.org docker build -t registry.gitlab.gnome.org/gnome/libxml2 - \ < .gitlab-ci/Dockerfile docker push registry.gitlab.gnome.org/gnome/libxml2 ``` -------------------------------- ### Run Autotools Test Suite Source: https://github.com/gnome/libxml2/blob/master/README.md Command to execute the test suite after configuring and building the library with Autotools. ```bash make check ``` -------------------------------- ### Tag and Push Release Source: https://github.com/gnome/libxml2/blob/master/MAINTAINERS.md Create an annotated git tag for a release and push it to the origin. Replace `[version]` with the actual release version. ```bash git tag -a [version] -m 'Release [version]' git push origin [version] ``` -------------------------------- ### Build libxml2 with Instrumentation Source: https://github.com/gnome/libxml2/blob/master/fuzz/README.md Configure and build libxml2. The --without-python flag is used to disable Python bindings, and 'make' compiles the library with the previously set CFLAGS. ```bash ./configure --without-python make ``` -------------------------------- ### Run CMake Test Suite Source: https://github.com/gnome/libxml2/blob/master/README.md Command to run the test suite using CMake after building the library. ```bash ctest --test-dir builddir ``` -------------------------------- ### Check Include Files Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Verifies the presence of standard header files, such as `stdint.h`, which are necessary for certain C language features. ```cmake check_include_files(stdint.h HAVE_STDINT_H) ``` -------------------------------- ### Generate Git Log for Release Notes Source: https://github.com/gnome/libxml2/blob/master/MAINTAINERS.md Generate a formatted git log to help update the NEWS file for a new release. Replace `[previous-release-tag]` with the actual tag. ```bash git log --format='- %s (%an)' [previous-release-tag].. ``` -------------------------------- ### Generate Autotools Configuration Source: https://github.com/gnome/libxml2/blob/master/README.md Run this command in a Git tree to generate configuration files before configuring and building the library. ```bash ./autogen.sh [configuration options] ``` -------------------------------- ### Add Doxygen Documentation Target Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Configures a custom command to generate Doxygen documentation. It sets environment variables for source and build roots and depends on the Doxyfile and library sources. ```cmake set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile) add_custom_command( OUTPUT doc/html doc/xml COMMAND ${CMAKE_COMMAND} -E env SOURCE_ROOT=${CMAKE_CURRENT_SOURCE_DIR}/ BUILD_ROOT=${CMAKE_CURRENT_BINARY_DIR}/ doxygen -q ${DOXYFILE} MAIN_DEPENDENCY ${DOXYFILE} DEPENDS ${LIBXML2_HDRS} ${LIBXML2_SRCS} ) add_custom_target(Doxygen ALL DEPENDS doc/html doc/xml) ``` -------------------------------- ### Set Compiler and Options for Fuzzing Source: https://github.com/gnome/libxml2/blob/master/fuzz/README.md Configure the compiler (CC) and CFLAGS for fuzzing. Ensure optimizations are enabled and include sanitizers for debugging. The FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION flag is used for safety. ```bash export CC=clang export CFLAGS=" \ -O1 -gline-tables-only \ -fsanitize=fuzzer-no-link,address,undefined \ -fno-sanitize-recover=all \ -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" ``` -------------------------------- ### Run libFuzzer for libxml2 Source: https://github.com/gnome/libxml2/blob/master/fuzz/README.md Execute the libFuzzer target for libxml2. The 'fuzz-xml' target is invoked from the 'fuzz' directory. Additional options can be passed via the XML_FUZZ_OPTIONS environment variable. ```bash make -C fuzz fuzz-xml ``` -------------------------------- ### Configure Apache 1.3.4 for FrontPage Server Extensions Source: https://github.com/gnome/libxml2/blob/master/test/HTML/fp40.htm Add these lines to http.conf to prevent FrontPage Server Extensions from using secondary configuration files like access.conf and srm.conf. Ensure the web server is restarted after changes. ```apache ResourceConfig /dev/null AccessConfig /dev/null ``` -------------------------------- ### Configure ASAN Symbolizer Path Source: https://github.com/gnome/libxml2/blob/master/fuzz/README.md Set the ASAN_SYMBOLIZER_PATH environment variable to point to a wrapper script for llvm-symbolizer. This prevents the symbolizer from using an instrumented version of libxml2. ```bash export ASAN_SYMBOLIZER_PATH="$(pwd)/.gitlab-ci/llvm-symbolizer" ``` -------------------------------- ### Check Library Existence Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Tests if a specific library, like `readline` or `history`, is available on the system. This is important for enabling optional features that depend on external libraries. ```cmake check_library_exists(readline readline "" HAVE_LIBREADLINE) ``` ```cmake check_library_exists(history append_history "" HAVE_LIBHISTORY) ``` -------------------------------- ### Add Test Suite Function Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Defines a function to add test suites by processing script files. It handles input file resolution and sets up test commands for execution and comparison. ```cmake function(ADD_SUITE test_dir program) file(GLOB_RECURSE files_to_process CONFIGURE_DEPENDS "./test/${test_dir}/*.script") foreach(file_path ${files_to_process}) file(RELATIVE_PATH file_relative "${CMAKE_CURRENT_SOURCE_DIR}" "${file_path}") get_filename_component(dir_path ${file_relative} DIRECTORY) get_filename_component(base_name ${file_relative} NAME_WE) get_filename_component(extension ${file_relative} EXT) set(actual_stdout "${CMAKE_CURRENT_BINARY_DIR}/result/${test_dir}/${base_name}") set(actual_stderr "${CMAKE_CURRENT_BINARY_DIR}/result/${test_dir}/${base_name}.err") set(expected_stdout "${CMAKE_CURRENT_SOURCE_DIR}/result/${test_dir}/${base_name}") set(expected_stderr "${CMAKE_CURRENT_SOURCE_DIR}/result/${test_dir}/${base_name}.err") set(xml_path "${CMAKE_CURRENT_SOURCE_DIR}/${dir_path}/${base_name}.xml") set(sgml_path "${CMAKE_CURRENT_SOURCE_DIR}/${dir_path}/${base_name}.sgml") if(EXISTS "${xml_path}") set(input_file "./${dir_path}/${base_name}.xml") elseif(EXISTS "${sgml_path}") set(input_file "./${dir_path}/${base_name}.sgml") else() message(FATAL_ERROR "Neither XML nor SGML exists for: ${dir_path}/${base_name}") endif() add_test( NAME ${test_dir}_${base_name} COMMAND ${CMAKE_COMMAND} -DPROG=$ -DSTDIN=./${dir_path}/${base_name}.script -DXML=${input_file} -DSTDOUT=${actual_stdout} -DSTDERR=${actual_stderr} -DEXPECTED_STDOUT=${expected_stdout} -DEXPECTED_STDERR=${expected_stderr} -DWORKDIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/run_and_diff.cmake ) endforeach() endfunction() ``` -------------------------------- ### Check C11 Thread-Local Storage Support Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Detects support for C11 `_Thread_local` keyword by compiling a test program. If not supported, it falls back to checking for `__thread` and `__declspec(thread)`. ```cmake check_c_source_compiles( "_Thread_local int v; int main(){return 0;}" XML_THREAD_LOCAL_C11 ) ``` ```cmake check_c_source_compiles( "__thread int v; int main(){return 0;}" XML_THREAD_LOCAL_THREAD ) ``` ```cmake check_c_source_compiles( "__declspec(thread) int v; int main(){return 0;}" XML_THREAD_LOCAL_DECLSPEC ) ``` -------------------------------- ### Update Test Results with runtest Source: https://github.com/gnome/libxml2/blob/master/MAINTAINERS.md Use `runtest -u` to update test results after adding new test cases. Inspect changes with `git diff result` and restore with `git restore result`. ```bash runtest -u ``` ```bash git diff result ``` ```bash git restore result ``` ```bash git clean -xd result ``` -------------------------------- ### Extract Source Tarball with CMake Source: https://github.com/gnome/libxml2/blob/master/README.md Command to extract a source tarball when using CMake for building. ```bash cmake -E tar xf libxml2-xxx.tar.xz ``` -------------------------------- ### CSS for navigation links Source: https://github.com/gnome/libxml2/blob/master/result/HTML/doc3.htm This CSS defines the styling for navigation links, including color and text decoration. It also specifies how the links should appear when hovered over. ```css A.nav { COLOR: #003399; TEXT-DECORATION: none } A.nav:hover { COLOR: #3366cc; TEXT-DECORATION: underline } ``` -------------------------------- ### Check C Source Compilation Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Verifies if the C compiler supports specific features by attempting to compile a small source code snippet. Used for detecting compiler attributes like `destructor`. ```cmake check_c_source_compiles( "\n void __attribute__((destructor))\n f(void) {}\n int main(void) { return 0; }\n" HAVE_FUNC_ATTRIBUTE_DESTRUCTOR) ``` -------------------------------- ### Disable Executable Uploads in FrontPage 2000 Source: https://github.com/gnome/libxml2/blob/master/test/HTML/fp40.htm To allow FrontPage authors to upload executable files into executable folders, set the NoExecutableCgiUpload configuration variable to zero (0). This is a security measure to prevent accidental uploads of malicious code. ```ini NoExecutableCgiUpload 0 ``` -------------------------------- ### JavaScript function to open a new window Source: https://github.com/gnome/libxml2/blob/master/result/HTML/doc3.htm This JavaScript function 'popUp' is designed to open a new browser window with specified dimensions. It uses a dynamic ID based on the current time to ensure unique window names. ```javascript function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=145, height=250');"); } ``` -------------------------------- ### Check Symbol Existence Source: https://github.com/gnome/libxml2/blob/master/CMakeLists.txt Determines if a specific symbol is available in a given header file. This is crucial for checking the availability of standard library functions like `getentropy`. ```cmake check_symbol_exists(getentropy "sys/random.h" HAVE_DECL_GETENTROPY) ``` ```cmake check_symbol_exists(glob "glob.h" HAVE_DECL_GLOB) ``` ```cmake check_symbol_exists(mmap "sys/mman.h" HAVE_DECL_MMAP) ``` -------------------------------- ### Override window.open for pop-up blocking Source: https://github.com/gnome/libxml2/blob/master/result/HTML/doc3.htm This JavaScript code overrides the default window.open function to prevent pop-up windows. It's useful for blocking unwanted advertisements or new windows. ```javascript NS_ActualOpen=window.open; function NS_NullWindow(){this.window;} function NS_NewOpen(url,nam,atr){return(new NS_NullWindow());} window.open=NS_NewOpen; ``` -------------------------------- ### Override window.open for pop-up blocking Source: https://github.com/gnome/libxml2/blob/master/test/HTML/doc3.htm This JavaScript code overrides the default window.open function to prevent pop-up windows. It's useful for blocking unwanted advertisements or new windows. ```javascript NS_ActualOpen=window.open; function NS_NullWindow(){this.window;} function NS_NewOpen(url,nam,atr){return(new NS_NullWindow());} window.open=NS_NewOpen; ``` -------------------------------- ### Enable Malloc Failure Abort in Fuzzer Source: https://github.com/gnome/libxml2/blob/master/fuzz/README.md Modify the fuzz target C file to define XML_FUZZ_MALLOC_ABORT. This macro causes the fuzzer to abort at the exact malloc invocation that would fail, aiding in debugging malloc failure injection. ```c #define XML_FUZZ_MALLOC_ABORT ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.