diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb8ff3f4..680d22bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,27 +20,31 @@ jobs: run: | pacman -Syu --needed --noconfirm \ git unzip ghc cabal-install haskell-shake haskell-aeson-pretty \ - cmake extra-cmake-modules ninja fmt fcitx5 boost python opencc jdk17-openjdk check + cmake extra-cmake-modules ninja fmt fcitx5 boost python opencc jre-openjdk gperf - name: Fetch source code uses: actions/checkout@v4 with: - submodules: recursive + # this only sync submodules specified in .gitmodules, + # because we don't want recursive submodules in glog, librime, etc. + submodules: true - - name: Setup Android SDK - uses: android-actions/setup-android@v2 - - - name: Install NDK and CMake + - name: Fetch submodules run: | - sdkmanager --install "ndk;${{ env.NDK_VERSION }}" - sdkmanager --install "cmake;${{ env.CMAKE_VERSION }}" + # it appears to be a bug when building in containers: https://github.com/actions/checkout/issues/915 + git config --global --add safe.directory '*' + # fetch libime submodule kenlm since it's not in .gitmodules + git submodule update --init --recursive libime + + - name: Setup Android NDK + uses: android-actions/setup-android@v3 + with: + packages: "ndk;${{ env.NDK_VERSION }} cmake;${{ env.CMAKE_VERSION }}" - name: Build everything env: - LANG: "C.UTF-8" ANDROID_NDK_ROOT: ${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION }} run: | - git config --global --add safe.directory '*' # use archlinux's dynamic only ghc cabal configure --disable-library-vanilla --enable-shared --enable-executable-dynamic --ghc-options=-dynamic ./build-cabal -j everything @@ -58,7 +62,7 @@ jobs: - name: Upload prebuilt to artifact if: github.event_name == 'pull_request' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: build/prebuilt.tar.zst @@ -75,14 +79,14 @@ jobs: if: github.event_name == 'push' && github.ref == 'refs/heads/master' working-directory: prebuilt run: | + rm -r ./* for TARGET in $(<../build/artifacts.txt) do - rm -r "./$TARGET" cp -a "../build/$TARGET" ./ done git remote set-url origin "https://${{ secrets.BOT_TOKEN }}@github.com/fcitx5-android/prebuilt.git" git config user.name "Fcitx5 Android Bot" - git config user.email "102923727+android-fcitx5@users.noreply.github.com" + git config user.email "102923727+fcitx5-android-bot@users.noreply.github.com" git add . git diff-index --quiet HEAD || git commit -m "Auto update" git push --set-upstream origin "HEAD:master" --follow-tags --atomic diff --git a/.gitmodules b/.gitmodules index eb741b11..25500b88 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,23 +1,19 @@ [submodule "fmt"] path = fmt url = https://github.com/fmtlib/fmt - ignore = untracked [submodule "libuv"] path = libuv url = https://github.com/libuv/libuv - ignore = untracked [submodule "libintl-lite"] path = libintl-lite url = https://github.com/j-jorge/libintl-lite - ignore = untracked [submodule "Lua"] path = Lua url = https://github.com/walterschell/Lua - ignore = untracked [submodule "OpenCC"] path = OpenCC url = https://github.com/BYVoid/OpenCC - ignore = untracked + fetchRecurseSubmodules = false [submodule "anthy-unicode"] path = anthy-unicode url = https://github.com/fujiwarat/anthy-unicode @@ -27,15 +23,18 @@ [submodule "yaml-cpp"] path = yaml-cpp url = https://github.com/jbeder/yaml-cpp + fetchRecurseSubmodules = false [submodule "leveldb"] path = leveldb url = https://github.com/google/leveldb + fetchRecurseSubmodules = false [submodule "marisa-trie"] path = marisa-trie url = https://github.com/rime/marisa-trie [submodule "librime"] path = librime url = https://github.com/rime/librime + fetchRecurseSubmodules = false [submodule "librime-lua"] path = librime-lua url = https://github.com/hchunhui/librime-lua @@ -54,6 +53,16 @@ [submodule "libime"] path = libime url = https://github.com/fcitx/libime + fetchRecurseSubmodules = true [submodule "libime-jyutping"] path = libime-jyutping url = https://github.com/fcitx/libime-jyutping +[submodule "librime-predict"] + path = librime-predict + url = https://github.com/rime/librime-predict +[submodule "libthai"] + path = libthai + url = https://github.com/tlwg/libthai +[submodule "libiconv"] + path = libiconv + url = https://git.savannah.gnu.org/git/libiconv diff --git a/Lua b/Lua index 88246d62..52674cd1 160000 --- a/Lua +++ b/Lua @@ -1 +1 @@ -Subproject commit 88246d621abf7b6fba9332f49229d507f020e450 +Subproject commit 52674cd192943015b99f51225f8cf8a116aa7293 diff --git a/OpenCC b/OpenCC index e5d6c5f1..556ed224 160000 --- a/OpenCC +++ b/OpenCC @@ -1 +1 @@ -Subproject commit e5d6c5f1b78e28a5797e7ad3ede3513314e544b7 +Subproject commit 556ed22496d650bd0b13b6c163be9814637970ae diff --git a/README.md b/README.md index c2b497d4..76a51ce7 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,5 @@ Cabal is required to build this project. * librime-octagram: [rime/librime-octagram](https://github.com/lotem/librime-octagram) * libhangul: [libhangul/libhangul](https://github.com/libhangul/libhangul) * libchewing: [chewing/libchewing](https://github.com/chewing/libchewing) +* libthai: [tlwg/libthai](https://github.com/tlwg/libthai) +* libiconv: [GNU/libiconv](https://savannah.gnu.org/projects/libiconv) diff --git a/anthy-unicode b/anthy-unicode index 360c112c..e63d1d67 160000 --- a/anthy-unicode +++ b/anthy-unicode @@ -1 +1 @@ -Subproject commit 360c112cff27fe82fff07bb255a48e40ab7a0849 +Subproject commit e63d1d67caa95886076ac1f6033469e03b36c990 diff --git a/build.cfg b/build.cfg index b7295aa9..732b3303 100644 --- a/build.cfg +++ b/build.cfg @@ -1,24 +1,27 @@ +## https://github.com/fcitx/fcitx5/blob/master/src/modules/spell/CMakeLists.txt#L31 # en dict en_dict = en_dict-20121020.tar.gz en_dict_sha256 = c44a5d7847925eea9e4d2d04748d442cd28dd9299a0b572ef7d91eac4f5a6ceb +## https://github.com/fcitx/libime/blob/master/data/CMakeLists.txt # lm -lm_sc = lm_sc.arpa-20230712.tar.xz -lm_sc_sha256 = badd62c16c6373787a0fda8f09cd452d12f60d5868856f651ceecf1a07baba32 +lm_sc = lm_sc.arpa-20250113.tar.zst +lm_sc_sha256 = ee83ecf20d52e8bccdba4cf6cd57183d53c257713a5eb77ee3a63d50fc3796dd # pinyin dict -pinyin_dict = dict-20220810.tar.xz -pinyin_dict_sha256 = 971752f413188007e8d19158c11b85c955e25d7b321ec2275c4b3af6d8a85d26 +pinyin_dict = dict-20241001.tar.zst +pinyin_dict_sha256 = d3313b88a68620a23bc8d5f9564cf1b678848dc7af541c4f5f02198e5a3686bf # table dict -table = table.tar.gz -table_sha256 = 6196053c724125e3ae3d8bd6b2f9172d0c83b65b0d410d3cde63b7a8d6ab87b7 +table = table-20240108.tar.gz +table_sha256 = 729c596d86907de727c74d0fc3fd241c406c5debd2b4cb74eefe022387ee9dae +## https://github.com/fcitx/fcitx5-chinese-addons/blob/master/im/pinyin/chaizi.txt # extra pinyin dict chinese_addon_repo = https://raw.githubusercontent.com/fcitx/fcitx5-chinese-addons/5.1.2/im/pinyin/ chaizi_sha256 = cd659605360120f7390fda1a278eea12c4df6d763a95c8099068ab09cfafd058 -emoji_sha256 = c2bf27f4b49df5fda87076cdb3e8091da25ec4536910e062aa70a832fda685d3 +## https://github.com/fcitx/fcitx5-chinese-addons/blob/master/modules/pinyinhelper/CMakeLists.txt # py stroke py_stroke = py_stroke-20121124.tar.gz py_stroke_sha256 = 8eb128a9bfa43952e67cf2fcee1fd134c6f4cfd317bc2f6c38a615f5eb64e248 @@ -27,10 +30,12 @@ py_stroke_sha256 = 8eb128a9bfa43952e67cf2fcee1fd134c6f4cfd317bc2f6c38a615f5eb64e py_table = py_table-20121124.tar.gz py_table_sha256 = 42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c04 +## https://github.com/boostorg/boost/releases # boost -boost_version = 1.83.0 -boost_sha256 = c5a0688e1f0c05f354bbd0b32244d36085d9ffc9f932e8a18983a9908096f614 +boost_version = 1.86.0 +boost_sha256 = 2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 +## https://github.com/fcitx/libime-jyutping/blob/master/data/CMakeLists.txt # jyutping dict jyutping_dict = jyutping-dict-20180104.tar.xz jyutping_dict_sha256 = e3a5b13edb8efa2f764245a3232f99ba7e7670e22b8cbe666a4fffa84b35f35b diff --git a/flake.lock b/flake.lock index 0eab96b0..77a896ba 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1697646894, - "narHash": "sha256-SgVch48GVIF/+qhtyPmVknDHCaCPiCT1eBL+yDf3Zj4=", + "lastModified": 1728271164, + "narHash": "sha256-Zl7VpQpJzapwC5PK6NSmZ2ISVT9v/WPJnbzwZ8OcpWQ=", "owner": "fcitx5-android", "repo": "fcitx5-android", - "rev": "99258b4d22991676cd5a75919e887f37de18666a", + "rev": "56638444321aa9d405b09bea038461803cb09c39", "type": "github" }, "original": { @@ -57,11 +57,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -72,11 +72,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697059129, - "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", + "lastModified": 1728018373, + "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", + "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", "type": "github" }, "original": { diff --git a/fmt b/fmt index a3370119..0c9fce2f 160000 --- a/fmt +++ b/fmt @@ -1 +1 @@ -Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50 +Subproject commit 0c9fce2ffefecfdce794e1859584e25877b7b592 diff --git a/glog b/glog index b33e3bad..7b134a5c 160000 --- a/glog +++ b/glog @@ -1 +1 @@ -Subproject commit b33e3bad4c46c8a6345525fd822af355e5ef9446 +Subproject commit 7b134a5c82c0c0b5698bb6bf7a835b230c5638e4 diff --git a/libchewing b/libchewing index 547dcbd4..9be48513 160000 --- a/libchewing +++ b/libchewing @@ -1 +1 @@ -Subproject commit 547dcbd4962b6da319bbf98506e9dc86ef248a05 +Subproject commit 9be48513bc46bafa134eef4b2bfde6a533470d33 diff --git a/libiconv b/libiconv new file mode 160000 index 00000000..4b9c27be --- /dev/null +++ b/libiconv @@ -0,0 +1 @@ +Subproject commit 4b9c27bec873392533dd3ef309cd62962a644e18 diff --git a/libime b/libime index efbb49c3..d5a28230 160000 --- a/libime +++ b/libime @@ -1 +1 @@ -Subproject commit efbb49c3a9216ab3607e5ab356a1c9144c8f7c70 +Subproject commit d5a28230c4794426437f31a5b774006a41a443e1 diff --git a/libime-jyutping b/libime-jyutping index 3cbd2fc2..25231d82 160000 --- a/libime-jyutping +++ b/libime-jyutping @@ -1 +1 @@ -Subproject commit 3cbd2fc2d43bee266f85c44a739b06f1e3010493 +Subproject commit 25231d82c658753209f7b675273f2918d6be4f82 diff --git a/libintl-lite b/libintl-lite index fd4bfa82..ba151460 160000 --- a/libintl-lite +++ b/libintl-lite @@ -1 +1 @@ -Subproject commit fd4bfa82df1d67c4c657cbe4595772fad894d039 +Subproject commit ba1514607d02ce3711d828e784a7e9e2bb25aa84 diff --git a/librime b/librime index af3d4a7a..6f6f5401 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit af3d4a7a16df894647be3cdfb3357346ee04d3e3 +Subproject commit 6f6f5401b0178b789a0ea6a5c49dbf1358be6f5c diff --git a/librime-lua b/librime-lua index 7c297e4d..e3912a4b 160000 --- a/librime-lua +++ b/librime-lua @@ -1 +1 @@ -Subproject commit 7c297e4d2e08fcdd3e9b2dcae2a42317b9a217ff +Subproject commit e3912a4b3ac2c202d89face3fef3d41eb1d7fcd6 diff --git a/librime-octagram b/librime-octagram index a6ced5a1..dfcc1511 160000 --- a/librime-octagram +++ b/librime-octagram @@ -1 +1 @@ -Subproject commit a6ced5a1d623afed17284fbaa395dd3a8b019a14 +Subproject commit dfcc15115788c828d9dd7b4bff68067d3ce2ffb8 diff --git a/librime-predict b/librime-predict new file mode 160000 index 00000000..920bd41e --- /dev/null +++ b/librime-predict @@ -0,0 +1 @@ +Subproject commit 920bd41ebf6f9bf6855d14fbe80212e54e749791 diff --git a/libthai b/libthai new file mode 160000 index 00000000..618e442c --- /dev/null +++ b/libthai @@ -0,0 +1 @@ +Subproject commit 618e442c340cff089f29743d35392a6aba21a9fb diff --git a/libuv b/libuv index be6b81a3..e1095c7a 160000 --- a/libuv +++ b/libuv @@ -1 +1 @@ -Subproject commit be6b81a352d17513c95be153afcb3148f1a451cd +Subproject commit e1095c7a4373ce00cd8874d8e820de5afb25776e diff --git a/marisa-trie b/marisa-trie index 0d4e8ab5..773766d6 160000 --- a/marisa-trie +++ b/marisa-trie @@ -1 +1 @@ -Subproject commit 0d4e8ab58eec355facf8f65ff11ef811b330e373 +Subproject commit 773766d670a16ee2166f1087f8b67fa0235ea8d1 diff --git a/patches/glog.patch b/patches/glog.patch new file mode 100644 index 00000000..5e54c9bb --- /dev/null +++ b/patches/glog.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b787631..1fc8cf4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -402,6 +402,7 @@ add_custom_command ( + COMMAND ${CMAKE_COMMAND} -E touch ${_glog_EMPTY_SOURCE} + ) + ++target_compile_options(glog_internal PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") + add_library (glog + $ + ${_glog_EMPTY_SOURCE} diff --git a/patches/libchewing.patch b/patches/libchewing.patch index 4685afd5..cb719ae0 100644 --- a/patches/libchewing.patch +++ b/patches/libchewing.patch @@ -1,102 +1,50 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 07112b0..4ae4ab7 100644 +index ae1d14b7..5d03df35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -168,25 +168,6 @@ set(ALL_INC - ${INC_DIR}/mod_aux.h - ) - --# info page --find_program(MAKEINFO makeinfo) --if (MAKEINFO) -- add_custom_command( -- OUTPUT -- ${INFO_BIN} -- COMMAND ${MAKEINFO} ${INFO_SRC} -o ${INFO_BIN} -I ${PROJECT_BINARY_DIR}/doc -- DEPENDS -- ${INFO_SRC} -- ) -- add_custom_target(INFO ALL DEPENDS ${INFO_BIN}) -- add_dependencies(check INFO) -- -- find_program(INSTALL_INFO NAMES ginstall-info install-info) -- if (INSTALL_INFO) -- install(FILES ${INFO_BIN} DESTINATION ${CMAKE_INSTALL_INFODIR}) -- install(CODE "execute_process(COMMAND ${INSTALL_INFO} --info-dir=${CMAKE_INSTALL_INFODIR} ${INFO_BIN})") -- endif() --endif() - - - # We need to copy static data to binary tree when using out of tree build. -@@ -229,16 +210,6 @@ set_target_properties(${ALL_TOOLS} PROPERTIES - ) - - # tools command --add_custom_command( -- OUTPUT -- ${ALL_DATA} -- COMMAND ${CMAKE_COMMAND} -E make_directory ${DATA_BIN_DIR} -- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_BIN_DIR} ${TOOLS_BIN_DIR}/init_database ${DATA_SRC_DIR}/phone.cin ${DATA_SRC_DIR}/tsi.src -- DEPENDS -- ${ALL_TOOLS} -- ${DATA_SRC_DIR}/phone.cin -- ${DATA_SRC_DIR}/tsi.src --) - - # test - set(ALL_TESTCASES -@@ -325,7 +296,6 @@ if (${CURSES_FOUND}) +@@ -1,2 +1,2 @@ +-cmake_minimum_required(VERSION 3.24.0) ++cmake_minimum_required(VERSION 3.22.1) + project(libchewing LANGUAGES C) +@@ -216,8 +216,6 @@ if(WITH_RUST) + list(APPEND ALL_INC ${INC_DIR}/chewing_rs.h) endif() - # data --add_custom_target(data ALL DEPENDS ${ALL_DATA}) +-add_subdirectory(doc) +-add_subdirectory(data) + if(BUILD_TESTING) + add_subdirectory(tests) + endif() +@@ -228,14 +226,20 @@ add_library(common OBJECT - # library - add_library(chewing OBJECT -@@ -361,8 +331,9 @@ add_library(chewing OBJECT - ${SRC_DIR}/userphrase.c - ${SRC_DIR}/bopomofo.c + src/porting_layer/src/asprintf.c ) -+target_compile_options(chewing PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") - set_target_properties(chewing PROPERTIES -- COMPILE_DEFINITIONS "CHEWING_DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}/libchewing\"" -+ COMPILE_DEFINITIONS "CHEWING_DATADIR=\"./libchewing\"" ++target_compile_options(common PRIVATE ++ "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=." ++) + target_compile_definitions(common PRIVATE +- CHEWING_DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}/libchewing\" ++ CHEWING_DATADIR=\"./libchewing\" ) - if (WITH_SQLITE3) -@@ -397,24 +368,19 @@ if (WITH_SQLITE3) - target_link_libraries(testhelper ${SQLITE3_LIBRARY}) - endif() - else() -- add_library(userphrase STATIC -+ add_library(userphrase OBJECT - ${INC_DIR}/internal/hash-private.h - - ${SRC_DIR}/hash.c - ${SRC_DIR}/userphrase-hash.c - ) -+target_compile_options(userphrase PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") - endif() - - if (BUILD_DLL OR NOT MSVC) - if (MSVC) - add_definitions(-DCHEWINGDLL_EXPORTS) + add_library(libchewing ${ALL_INC} src/chewing.c) + set_target_properties(libchewing PROPERTIES LINKER_LANGUAGE C) ++target_compile_options(libchewing PRIVATE ++ "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=." ++) + target_compile_definitions(libchewing PRIVATE +- CHEWING_DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}/libchewing\" ++ CHEWING_DATADIR=\"./libchewing\" + ) + if(NOT WITH_RUST) + target_sources(common PRIVATE +@@ -288,6 +292,9 @@ if(NOT WITH_RUST) + ${SRC_DIR}/userphrase-hash.c + ) endif() -- add_library(chewing_shared SHARED -- $ -- $ -- ) -- list(APPEND LIBS chewing_shared) -- add_dependencies(check chewing_shared) - endif() - - if (NOT BUILD_DLL) -@@ -452,8 +418,6 @@ add_library(common OBJECT - - - # install --install(FILES ${ALL_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/libchewing) --install(FILES ${ALL_STATIC_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/libchewing) - install(FILES ${ALL_INC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chewing) - install(FILES ${PROJECT_BINARY_DIR}/chewing.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ target_compile_options(userphrase PRIVATE ++ "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=." ++ ) + target_link_libraries(libchewing + PRIVATE common + PRIVATE userphrase) diff --git a/patches/libhangul.patch b/patches/libhangul.patch new file mode 100644 index 00000000..37945e0b --- /dev/null +++ b/patches/libhangul.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8aafe38..edc76dd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,7 +50,6 @@ set(LIBHANGUL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}") + add_subdirectory(hangul) + add_subdirectory(data/hanja) + add_subdirectory(data/keyboards) +-add_subdirectory(tools) + add_subdirectory(po) + + if(BUILD_TESTING) +diff --git a/hangul/CMakeLists.txt b/hangul/CMakeLists.txt +index 14fde95..399beb6 100644 +--- a/hangul/CMakeLists.txt ++++ b/hangul/CMakeLists.txt +@@ -45,9 +45,9 @@ add_library(hangul + + target_compile_definitions(hangul + PRIVATE -DHAVE_CONFIG_H +- PRIVATE -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" +- PRIVATE -DLIBHANGUL_DEFAULT_HANJA_DIC=\"${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}/hanja/hanja.txt\" +- PRIVATE -DLIBHANGUL_DATA_DIR=\"${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}\" ++ PRIVATE -DLOCALEDIR=\"${CMAKE_INSTALL_LOCALEDIR}\" ++ PRIVATE -DLIBHANGUL_DEFAULT_HANJA_DIC=\"${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/hanja/hanja.txt\" ++ PRIVATE -DLIBHANGUL_DATA_DIR=\"${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}\" + PRIVATE -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\" + ) + diff --git a/patches/libiconv/CMakeLists.txt b/patches/libiconv/CMakeLists.txt new file mode 100644 index 00000000..4ae69d36 --- /dev/null +++ b/patches/libiconv/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.22.1) +project(libiconv) + +set(LIBICONV_HEADER + "include/iconv.h" +) +set(LIBICONV_SOURCE + lib/iconv.c + libcharset/lib/localcharset.c +) + +add_library(iconv STATIC ${LIBICONV_SOURCE}) +target_include_directories(iconv PRIVATE include libcharset/include) +install(TARGETS iconv) +install(FILES ${LIBICONV_HEADER} DESTINATION include) diff --git a/patches/libiconv/config.h b/patches/libiconv/config.h new file mode 100644 index 00000000..6812b088 --- /dev/null +++ b/patches/libiconv/config.h @@ -0,0 +1,1804 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Witness that has been included. */ +#define _GL_CONFIG_H_INCLUDED 1 + + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to the number of bits in type 'ptrdiff_t'. */ +/* #undef BITSIZEOF_PTRDIFF_T */ + +/* Define to the number of bits in type 'sig_atomic_t'. */ +/* #undef BITSIZEOF_SIG_ATOMIC_T */ + +/* Define to the number of bits in type 'size_t'. */ +/* #undef BITSIZEOF_SIZE_T */ + +/* Define to the number of bits in type 'wchar_t'. */ +/* #undef BITSIZEOF_WCHAR_T */ + +/* Define to the number of bits in type 'wint_t'. */ +/* #undef BITSIZEOF_WINT_T */ + +/* Define to 1 if using 'alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if // is a file system root distinct from /. */ +/* #undef DOUBLE_SLASH_IS_DISTINCT_ROOT */ + +/* Define as good substitute value for EILSEQ. */ +/* #undef EILSEQ */ + +/* Define to 1 to enable a few rarely used encodings. */ +/* #undef ENABLE_EXTRA */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#define ENABLE_NLS 1 + +/* Define to 1 if the package shall run at any location in the file system. */ +/* #undef ENABLE_RELOCATABLE */ + +/* Define this to 1 if F_DUPFD behavior does not match POSIX */ +/* #undef FCNTL_DUPFD_BUGGY */ + +/* Define to 1 if realpath() can malloc memory, always gives an absolute path, + and handles a trailing slash correctly. */ +/* #undef FUNC_REALPATH_NEARLY_WORKS */ + +/* Define to 1 if realpath() can malloc memory, always gives an absolute path, + and handles leading slashes and a trailing slash correctly. */ +#define FUNC_REALPATH_WORKS 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module canonicalize-lgpl shall be considered present. */ +#define GNULIB_CANONICALIZE_LGPL 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module fscanf shall be considered present. */ +#define GNULIB_FSCANF 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module msvc-nothrow shall be considered present. */ +#define GNULIB_MSVC_NOTHROW 1 + +/* Define to 1 if printf and friends should be labeled with attribute + "__gnu_printf__" instead of "__printf__" */ +/* #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU */ + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module scanf shall be considered present. */ +#define GNULIB_SCANF 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module sigpipe shall be considered present. */ +#define GNULIB_SIGPIPE 1 + +/* Define to 1 if you want the FILE stream functions getc, putc, etc. to use + unlocked I/O if available, throughout the package. Unlocked I/O can improve + performance, sometimes dramatically. But unlocked I/O is safe only in + single-threaded programs, as well as in multithreaded programs for which + you can guarantee that every FILE stream, including stdin, stdout, stderr, + is used only in a single thread. */ +#define GNULIB_STDIO_SINGLE_THREAD 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module strerror shall be considered present. */ +#define GNULIB_STRERROR 1 + +/* Define to 1 when the gnulib module canonicalize_file_name should be tested. + */ +#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1 + +/* Define to 1 when the gnulib module cloexec should be tested. */ +#define GNULIB_TEST_CLOEXEC 1 + +/* Define to 1 when the gnulib module close should be tested. */ +#define GNULIB_TEST_CLOSE 1 + +/* Define to 1 when the gnulib module dup2 should be tested. */ +#define GNULIB_TEST_DUP2 1 + +/* Define to 1 when the gnulib module environ should be tested. */ +#define GNULIB_TEST_ENVIRON 1 + +/* Define to 1 when the gnulib module fcntl should be tested. */ +#define GNULIB_TEST_FCNTL 1 + +/* Define to 1 when the gnulib module fgetc should be tested. */ +#define GNULIB_TEST_FGETC 1 + +/* Define to 1 when the gnulib module fgets should be tested. */ +#define GNULIB_TEST_FGETS 1 + +/* Define to 1 when the gnulib module fprintf should be tested. */ +#define GNULIB_TEST_FPRINTF 1 + +/* Define to 1 when the gnulib module fputc should be tested. */ +#define GNULIB_TEST_FPUTC 1 + +/* Define to 1 when the gnulib module fputs should be tested. */ +#define GNULIB_TEST_FPUTS 1 + +/* Define to 1 when the gnulib module fread should be tested. */ +#define GNULIB_TEST_FREAD 1 + +/* Define to 1 when the gnulib module free-posix should be tested. */ +#define GNULIB_TEST_FREE_POSIX 1 + +/* Define to 1 when the gnulib module fscanf should be tested. */ +#define GNULIB_TEST_FSCANF 1 + +/* Define to 1 when the gnulib module fstat should be tested. */ +#define GNULIB_TEST_FSTAT 1 + +/* Define to 1 when the gnulib module fwrite should be tested. */ +#define GNULIB_TEST_FWRITE 1 + +/* Define to 1 when the gnulib module getc should be tested. */ +#define GNULIB_TEST_GETC 1 + +/* Define to 1 when the gnulib module getchar should be tested. */ +#define GNULIB_TEST_GETCHAR 1 + +/* Define to 1 when the gnulib module getdtablesize should be tested. */ +#define GNULIB_TEST_GETDTABLESIZE 1 + +/* Define to 1 when the gnulib module getprogname should be tested. */ +#define GNULIB_TEST_GETPROGNAME 1 + +/* Define to 1 when the gnulib module malloc-posix should be tested. */ +#define GNULIB_TEST_MALLOC_POSIX 1 + +/* Define to 1 when the gnulib module mempcpy should be tested. */ +#define GNULIB_TEST_MEMPCPY 1 + +/* Define to 1 when the gnulib module open should be tested. */ +#define GNULIB_TEST_OPEN 1 + +/* Define to 1 when the gnulib module printf should be tested. */ +#define GNULIB_TEST_PRINTF 1 + +/* Define to 1 when the gnulib module putc should be tested. */ +#define GNULIB_TEST_PUTC 1 + +/* Define to 1 when the gnulib module putchar should be tested. */ +#define GNULIB_TEST_PUTCHAR 1 + +/* Define to 1 when the gnulib module puts should be tested. */ +#define GNULIB_TEST_PUTS 1 + +/* Define to 1 when the gnulib module raise should be tested. */ +#define GNULIB_TEST_RAISE 1 + +/* Define to 1 when the gnulib module rawmemchr should be tested. */ +#define GNULIB_TEST_RAWMEMCHR 1 + +/* Define to 1 when the gnulib module read should be tested. */ +#define GNULIB_TEST_READ 1 + +/* Define to 1 when the gnulib module readlink should be tested. */ +#define GNULIB_TEST_READLINK 1 + +/* Define to 1 when the gnulib module realloc-posix should be tested. */ +#define GNULIB_TEST_REALLOC_POSIX 1 + +/* Define to 1 when the gnulib module realpath should be tested. */ +#define GNULIB_TEST_REALPATH 1 + +/* Define to 1 when the gnulib module scanf should be tested. */ +#define GNULIB_TEST_SCANF 1 + +/* Define to 1 when the gnulib module sigprocmask should be tested. */ +#define GNULIB_TEST_SIGPROCMASK 1 + +/* Define to 1 when the gnulib module stat should be tested. */ +#define GNULIB_TEST_STAT 1 + +/* Define to 1 when the gnulib module strerror should be tested. */ +#define GNULIB_TEST_STRERROR 1 + +/* Define to 1 when the gnulib module vfprintf should be tested. */ +#define GNULIB_TEST_VFPRINTF 1 + +/* Define to 1 when the gnulib module vprintf should be tested. */ +#define GNULIB_TEST_VPRINTF 1 + +/* Define to 1 if you have 'alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if works. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the `canonicalize_file_name' function. */ +#define HAVE_CANONICALIZE_FILE_NAME 1 + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* Define to 1 if you have the `copy_file_range' function. */ +/* #undef HAVE_COPY_FILE_RANGE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRTDEFS_H */ + +/* Define to 1 if the alignas and alignof keywords work. */ +/* #undef HAVE_C_ALIGNASOF */ + +/* Define to 1 if bool, true and false work as per C2023. */ +/* #undef HAVE_C_BOOL */ + +/* Define to 1 if the static_assert keyword works. */ +/* #undef HAVE_C_STATIC_ASSERT */ + +/* Define to 1 if C supports variable-length arrays. */ +#define HAVE_C_VARARRAYS 1 + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#define HAVE_DCGETTEXT 1 + +/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_CLEARERR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `ecvt', and to 0 if you don't. + */ +#define HAVE_DECL_ECVT 1 + +/* Define to 1 if you have the declaration of `execvpe', and to 0 if you + don't. */ +#define HAVE_DECL_EXECVPE 1 + +/* Define to 1 if you have the declaration of `fcloseall', and to 0 if you + don't. */ +#define HAVE_DECL_FCLOSEALL 1 + +/* Define to 1 if you have the declaration of `fcvt', and to 0 if you don't. + */ +#define HAVE_DECL_FCVT 1 + +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_FEOF_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FERROR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FFLUSH_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FGETS_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FPUTC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FPUTS_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FREAD_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FWRITE_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `gcvt', and to 0 if you don't. + */ +#define HAVE_DECL_GCVT 1 + +/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_GETCHAR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_GETC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you + don't. */ +#define HAVE_DECL_GETDTABLESIZE 1 + +/* Define to 1 if you have the declaration of `getw', and to 0 if you don't. + */ +#define HAVE_DECL_GETW 1 + +/* Define to 1 if you have the declaration of `program_invocation_name', and + to 0 if you don't. */ +#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 + +/* Define to 1 if you have the declaration of `program_invocation_short_name', + and to 0 if you don't. */ +#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 + +/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_PUTCHAR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_PUTC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `putw', and to 0 if you don't. + */ +#define HAVE_DECL_PUTW 1 + +/* Define to 1 if you have the declaration of `setenv', and to 0 if you don't. + */ +#define HAVE_DECL_SETENV 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the declaration of `wcsdup', and to 0 if you don't. + */ +#define HAVE_DECL_WCSDUP 1 + +/* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. + */ +#define HAVE_DECL___ARGV 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if you have the declaration of environ. */ +#define HAVE_ENVIRON_DECL 1 + +/* Define to 1 if you have the `error' function. */ +#define HAVE_ERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERROR_H 1 + +/* Define to 1 if you have the `faccessat' function. */ +#define HAVE_FACCESSAT 1 + +/* Define to 1 if you have the `fcntl' function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FEATURES_H 1 + +/* Define if the 'free' function is guaranteed to preserve errno. */ +#define HAVE_FREE_POSIX 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getc_unlocked' function. */ +#define HAVE_GETC_UNLOCKED 1 + +/* Define to 1 if you have the `getdtablesize' function. */ +#define HAVE_GETDTABLESIZE 1 + +/* Define to 1 if you have the `getexecname' function. */ +/* #undef HAVE_GETEXECNAME */ + +/* Define to 1 if you have the `getprogname' function. */ +/* #undef HAVE_GETPROGNAME */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have and nl_langinfo(CODESET). */ +#define HAVE_LANGINFO_CODESET 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if the system has the type 'long long int'. */ +#define HAVE_LONG_LONG_INT 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACH_O_DYLD_H */ + +/* Define if malloc, realloc, and calloc set errno on allocation failure. */ +#define HAVE_MALLOC_POSIX 1 + +/* Define to 1 if you have the `mbrtowc' function. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the `mbsinit' function. */ +#define HAVE_MBSINIT 1 + +/* Define to 1 if declares mbstate_t. */ +#define HAVE_MBSTATE_T 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the `mempcpy' function. */ +#define HAVE_MEMPCPY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MINIX_CONFIG_H */ + +/* Define to 1 if defines the MIN and MAX macros. */ +/* #undef HAVE_MINMAX_IN_LIMITS_H */ + +/* Define to 1 if defines the MIN and MAX macros. */ +#define HAVE_MINMAX_IN_SYS_PARAM_H 1 + +/* Define to 1 on MSVC platforms that have the "invalid parameter handler" + concept. */ +/* #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER */ + +/* Define to 1 if you have the `raise' function. */ +#define HAVE_RAISE 1 + +/* Define to 1 if you have the `rawmemchr' function. */ +#define HAVE_RAWMEMCHR 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `readlinkat' function. */ +#define HAVE_READLINKAT 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SDKDDKVER_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SEARCH_H 1 + +/* Define to 1 if you have the `setdtablesize' function. */ +/* #undef HAVE_SETDTABLESIZE */ + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_SIG_ATOMIC_T */ + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WCHAR_T */ + +/* Define to 1 if 'wint_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WINT_T */ + +/* Define to 1 if the system has the type `sigset_t'. */ +#define HAVE_SIGSET_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDCKDINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have `strerror_r'. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */ + +/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */ + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1 + +/* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC */ + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC */ + +/* Define to 1 if you have the `symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INTTYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `tsearch' function. */ +#define HAVE_TSEARCH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTRING_WOE32DLL_H */ + +/* Define to 1 if the system has the type 'unsigned long long int'. */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 + +/* Define if you have a global __progname variable */ +/* #undef HAVE_VAR___PROGNAME */ + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#define HAVE_VISIBILITY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the 'wchar_t' type. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcrtomb' function. */ +#define HAVE_WCRTOMB 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define if you have the 'wint_t' type. */ +#define HAVE_WINT_T 1 + +/* Define to 1 if O_NOATIME works. */ +#define HAVE_WORKING_O_NOATIME 1 + +/* Define to 1 if O_NOFOLLOW works. */ +#define HAVE_WORKING_O_NOFOLLOW 1 + +/* Define to 1 if you have the `_NSGetExecutablePath' function. */ +/* #undef HAVE__NSGETEXECUTABLEPATH */ + +/* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ +/* #undef HAVE__SET_INVALID_PARAMETER_HANDLER */ + +/* Define to 1 if the compiler supports __builtin_expect, + and to 2 if does. */ +#define HAVE___BUILTIN_EXPECT 1 +#ifndef HAVE___BUILTIN_EXPECT +# define __builtin_expect(e, c) (e) +#elif HAVE___BUILTIN_EXPECT == 2 +# include +#endif + + +/* Define to 1 if ctype.h defines __header_inline. */ +/* #undef HAVE___HEADER_INLINE */ + +/* Please see the Gnulib manual for how to use these macros. + + Suppress extern inline with HP-UX cc, as it appears to be broken; see + . + + Suppress extern inline with Sun C in standards-conformance mode, as it + mishandles inline functions that call each other. E.g., for 'inline void f + (void) { } inline void g (void) { f (); }', c99 incorrectly complains + 'reference to static identifier "f" in extern inline function'. + This bug was observed with Oracle Developer Studio 12.6 + (Sun C 5.15 SunOS_sparc 2017/05/30). + + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like . For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions (ISO C 99 section 6.7.4.(3). + This bug is known to occur on: + + OS X 10.8 and earlier; see: + https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log + + FreeBSD; see: + https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html + + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see . + Assume DragonFly and FreeBSD will be similar. + + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. It defines a macro + __GNUC_STDC_INLINE__ to indicate this situation or a macro + __GNUC_GNU_INLINE__ to indicate the opposite situation. + GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline + semantics but warns, unless -fgnu89-inline is used: + warning: C99 inline functions are not supported; using GNU89 + warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute + It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. + */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined HAVE___HEADER_INLINE \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) +# define _GL_EXTERN_INLINE_STDHEADER_BUG +#endif +#if ((__GNUC__ \ + ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + && !defined __PCC__) \ + : (199901L <= __STDC_VERSION__ \ + && !defined __HP_cc \ + && !defined __PGI \ + && !(defined __SUNPRO_C && __STDC__))) \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# define _GL_INLINE inline +# define _GL_EXTERN_INLINE extern inline +# define _GL_EXTERN_INLINE_IN_USE +#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ + && !defined __PCC__ \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline +# endif +# define _GL_EXTERN_INLINE extern +# define _GL_EXTERN_INLINE_IN_USE +#else +# define _GL_INLINE _GL_UNUSED static +# define _GL_EXTERN_INLINE _GL_UNUSED static +#endif + +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + and + . */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ +# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +#endif + +/* Define to 1 if the compiler supports the keyword '__inline'. */ +#define HAVE___INLINE 1 + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Define to the value of ${prefix}, as a string. */ +#define INSTALLPREFIX "/mnt/storage/github/libiconv/dist" + +/* Define to 1 if 'lstat' dereferences a symlink specified with a trailing + slash. */ +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ +#define MALLOC_0_IS_NONNULL 1 + +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 1 +#endif + + +/* Define to 1 on musl libc. */ +/* #undef MUSL_LIBC */ + +/* Define to 1 if open() fails to recognize a trailing slash. */ +/* #undef OPEN_TRAILING_SLASH_BUG */ + +/* Name of package */ +#define PACKAGE "libiconv" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libiconv" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libiconv 1.17" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libiconv" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.17" + +/* Define to the type that is the result of default argument promotions of + type mode_t. */ +#define PROMOTED_MODE_T mode_t + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +/* #undef PTRDIFF_T_SUFFIX */ + +/* Define to 1 if readlink fails to recognize a trailing slash. */ +/* #undef READLINK_TRAILING_SLASH_BUG */ + +/* Define to 1 if readlink sets errno instead of truncating a too-long link. + */ +/* #undef READLINK_TRUNCATE_BUG */ + +/* Define to 1 if stat needs help when passed a file name with a trailing + slash */ +/* #undef REPLACE_FUNC_STAT_FILE */ + +/* Define to 1 if strerror(0) does not return a message implying success. */ +/* #undef REPLACE_STRERROR_0 */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +/* #undef SIG_ATOMIC_T_SUFFIX */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +/* #undef SIZE_T_SUFFIX */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +#define STRERROR_R_CHAR_P 1 + +/* Define to 1 if the type of the st_atim member of a struct stat is struct + timespec. */ +#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1 + +/* Define to the prefix of C symbols at the assembler and linker level, either + an underscore or empty. */ +#define USER_LABEL_PREFIX + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# define _DARWIN_C_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# define _HPUX_ALT_XOPEN_SOCKET_API 1 +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +/* # undef _MINIX */ +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# define _NETBSD_SOURCE 1 +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# define _OPENBSD_SOURCE 1 +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +/* # undef _POSIX_SOURCE */ +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +/* # undef _POSIX_1_SOURCE */ +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by C23 Annex F. */ +#ifndef __STDC_WANT_IEC_60559_EXT__ +# define __STDC_WANT_IEC_60559_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +/* # undef _XOPEN_SOURCE */ +#endif + + +/* An alias of GNULIB_STDIO_SINGLE_THREAD. */ +#define USE_UNLOCKED_IO GNULIB_STDIO_SINGLE_THREAD + +/* Version number of package */ +#define VERSION "1.17" + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +/* #undef WCHAR_T_SUFFIX */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +/* #undef WINT_T_SUFFIX */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define if the machine's byte ordering is little endian. */ +#define WORDS_LITTLEENDIAN 1 + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#else +# define _GL_GNUC_PREREQ(major, minor) 0 +#endif + + +/* Define to enable the declarations of ISO C 11 types and functions. */ +/* #undef _ISOC11_SOURCE */ + +/* Define to 1 on platforms where this makes off_t a 64-bit type. */ +/* #undef _LARGE_FILES */ + +/* The _Noreturn keyword of C11. */ +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif (defined __clang__ && __clang_major__ < 16 \ + && defined _GL_WORK_AROUND_LLVM_BUG_59792) + /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around + that rare LLVM bug, though you may get many false-alarm warnings. */ +# define _Noreturn +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (_GL_GNUC_PREREQ (4, 7) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) + /* _Noreturn works as-is. */ +# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif + + +/* Number of bits in time_t, on hosts where this is settable. */ +/* #undef _TIME_BITS */ + +/* For standard stat data types on VMS. */ +#define _USE_STD_STAT 1 + +/* Define to 1 on platforms where this makes time_t a 64-bit type. */ +/* #undef __MINGW_USE_VC2005_COMPAT */ + +/* Define to 1 if the system predates C++11. */ +/* #undef __STDC_CONSTANT_MACROS */ + +/* Define to 1 if the system predates C++11. */ +/* #undef __STDC_LIMIT_MACROS */ + +/* Define to 1 if C does not support variable-length arrays, and if the + compiler does not already define this. */ +/* #undef __STDC_NO_VLA__ */ + +/* The _GL_ASYNC_SAFE marker should be attached to functions that are + signal handlers (for signals other than SIGABRT, SIGPIPE) or can be + invoked from such signal handlers. Such functions have some restrictions: + * All functions that it calls should be marked _GL_ASYNC_SAFE as well, + or should be listed as async-signal-safe in POSIX + + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in + particular, are NOT async-signal-safe. + * All memory locations (variables and struct fields) that these functions + access must be marked 'volatile'. This holds for both read and write + accesses. Otherwise the compiler might optimize away stores to and + reads from such locations that occur in the program, depending on its + data flow analysis. For example, when the program contains a loop + that is intended to inspect a variable set from within a signal handler + while (!signal_occurred) + ; + the compiler is allowed to transform this into an endless loop if the + variable 'signal_occurred' is not declared 'volatile'. + Additionally, recall that: + * A signal handler should not modify errno (except if it is a handler + for a fatal signal and ends by raising the same signal again, thus + provoking the termination of the process). If it invokes a function + that may clobber errno, it needs to save and restore the value of + errno. */ +#define _GL_ASYNC_SAFE + + +/* Attributes. */ +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 5 <= __clang_major__))) +# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) +#else +# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) +# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) +# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_diagnose_if 0 +# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) +# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) +# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) +# ifdef _ICC +# define _GL_ATTR_may_alias 0 +# else +# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# endif +# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) +# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) +# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) +#endif + +/* Use __has_c_attribute if available. However, do not use with + pre-C23 GCC, which can issue false positives if -Wpedantic. */ +#if (defined __has_c_attribute \ + && ! (_GL_GNUC_PREREQ (4, 6) \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710)) +# define _GL_HAVE___HAS_C_ATTRIBUTE 1 +#else +# define _GL_HAVE___HAS_C_ATTRIBUTE 0 +#endif + +/* Define if, in a function declaration, the attributes in bracket syntax + [[...]] must come before the attributes in __attribute__((...)) syntax. + If this is defined, it is best to avoid the bracket syntax, so that the + various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any + order. */ +#ifdef __cplusplus +# if defined __clang__ +# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 +# endif +#else +# if defined __GNUC__ && !defined __clang__ +# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 +# endif +#endif + +/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function + is the size of the returned memory block. + _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied + by the Nth argument of the function is the size of the returned memory block. + */ +/* Applies to: function, pointer to function, function types. */ +#ifndef _GL_ATTRIBUTE_ALLOC_SIZE +# if _GL_HAS_ATTRIBUTE (alloc_size) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +# else +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) +# endif +#endif + +/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the + function and report an error if it cannot do so. */ +/* Applies to: function. */ +#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE +# if _GL_HAS_ATTRIBUTE (always_inline) +# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# else +# define _GL_ATTRIBUTE_ALWAYS_INLINE +# endif +#endif + +/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show + in stack traces when debugging. The compiler should omit the function from + stack traces. */ +/* Applies to: function. */ +#ifndef _GL_ATTRIBUTE_ARTIFICIAL +# if _GL_HAS_ATTRIBUTE (artificial) +# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) +# else +# define _GL_ATTRIBUTE_ARTIFICIAL +# endif +#endif + +/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */ +/* Applies to: functions. */ +/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at + . + Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ +#ifndef _GL_ATTRIBUTE_COLD +# if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ +# ifndef __SUNPRO_C +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# endif +# else +# define _GL_ATTRIBUTE_COLD +# endif +#endif + +/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate + calls to the function with the same arguments. + This attribute is safe for a function that neither depends on nor affects + observable state, and always returns exactly once - e.g., does not loop + forever, and does not call longjmp. + (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_CONST +# if _GL_HAS_ATTRIBUTE (const) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +# else +# define _GL_ATTRIBUTE_CONST +# endif +#endif + +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. + _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that + can be freed via 'free'; it can be used only after declaring 'free'. */ +/* Applies to: functions. Cannot be used on inline functions. */ +#ifndef _GL_ATTRIBUTE_DEALLOC +# if _GL_GNUC_PREREQ (11, 0) +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif +#endif +/* If gnulib's or has already defined this macro, continue + to use this earlier definition, since may not have been included + yet. */ +#ifndef _GL_ATTRIBUTE_DEALLOC_FREE +# if defined __cplusplus && defined __GNUC__ && !defined __clang__ +/* Work around GCC bug */ +# define _GL_ATTRIBUTE_DEALLOC_FREE \ + _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) +# else +# define _GL_ATTRIBUTE_DEALLOC_FREE \ + _GL_ATTRIBUTE_DEALLOC (free, 1) +# endif +#endif + +/* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated. + The compiler may warn if the entity is used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: namespace, class, template specialization. */ +#ifndef _GL_ATTRIBUTE_DEPRECATED +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__deprecated__) +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +# endif +# endif +# endif +# if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +# endif +# ifndef _GL_ATTRIBUTE_DEPRECATED +# define _GL_ATTRIBUTE_DEPRECATED +# endif +#endif + +/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and + the function call is not optimized away. + _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and + the function call is not optimized away. */ +/* Applies to: functions. */ +#if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING) +# if _GL_HAS_ATTRIBUTE (error) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) +# elif _GL_HAS_ATTRIBUTE (diagnose_if) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +# else +# define _GL_ATTRIBUTE_ERROR(msg) +# define _GL_ATTRIBUTE_WARNING(msg) +# endif +#endif + +/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain + visible to debuggers etc., even with '-fwhole-program'. */ +/* Applies to: functions, variables. */ +#ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +# if _GL_HAS_ATTRIBUTE (externally_visible) +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) +# else +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +# endif +#endif + +/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if + the control flow falls through to the immediately following 'case' or + 'default' label. The compiler should not warn in this case. */ +/* Applies to: Empty statement (;), inside a 'switch' statement. */ +/* Always expands to something. */ +#ifndef _GL_ATTRIBUTE_FALLTHROUGH +# if _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__fallthrough__) +# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] +# endif +# endif +# if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +# ifndef _GL_ATTRIBUTE_FALLTHROUGH +# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +# endif +#endif + +/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) + declares that the STRING-INDEXth function argument is a format string of + style ARCHETYPE, which is one of: + printf, gnu_printf + scanf, gnu_scanf, + strftime, gnu_strftime, + strfmon, + or the same thing prefixed and suffixed with '__'. + If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK + are suitable for the format string. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_FORMAT +# if _GL_HAS_ATTRIBUTE (format) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) +# endif +#endif + +/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other + compilation unit, it executes code from that unit only by return or by + exception handling. This declaration lets the compiler optimize that unit + more aggressively. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_LEAF +# if _GL_HAS_ATTRIBUTE (leaf) +# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) +# else +# define _GL_ATTRIBUTE_LEAF +# endif +#endif + +/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly + allocated memory. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_MALLOC +# if _GL_HAS_ATTRIBUTE (malloc) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define _GL_ATTRIBUTE_MALLOC +# endif +#endif + +/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the + same storage as pointers to other types. Thus this declaration disables + strict aliasing optimization. */ +/* Applies to: types. */ +/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ +#ifndef _GL_ATTRIBUTE_MAY_ALIAS +# if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C +# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) +# else +# define _GL_ATTRIBUTE_MAY_ALIAS +# endif +#endif + +/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if + the entity is not used. The compiler should not warn if the entity is not + used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: class. */ +/* In C++ and C23, this is spelled [[__maybe_unused__]]. + GCC's syntax is __attribute__ ((__unused__)). + clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode, + __has_c_attribute (__maybe_unused__) yields true but the use of + [[__maybe_unused__]] nevertheless produces a warning. */ +#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if defined __clang__ && defined __cplusplus +# if !defined __apple_build_version__ && __clang_major__ >= 10 +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# endif +# elif _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__maybe_unused__) +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# endif +# endif +# endif +# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED +# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED +# endif +#endif +/* Alternative spelling of this macro, for convenience and for + compatibility with glibc/include/libc-symbols.h. */ +#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +/* Earlier spellings of this macro. */ +#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED + +/* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not + discard the return value. The compiler may warn if the caller does not use + the return value, unless the caller uses something like ignore_value. */ +/* Applies to: function, enumeration, class. */ +#ifndef _GL_ATTRIBUTE_NODISCARD +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if defined __clang__ && defined __cplusplus + /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces + a warning. + The 1000 below means a yet unknown threshold. When clang++ version X + starts supporting [[__nodiscard__]] without warning about it, you can + replace the 1000 with X. */ +# if __clang_major__ >= 1000 +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# endif +# elif _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__nodiscard__) +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# endif +# endif +# endif +# if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) +# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) +# endif +# ifndef _GL_ATTRIBUTE_NODISCARD +# define _GL_ATTRIBUTE_NODISCARD +# endif +#endif + +/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the + function. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NOINLINE +# if _GL_HAS_ATTRIBUTE (noinline) +# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) +# else +# define _GL_ATTRIBUTE_NOINLINE +# endif +#endif + +/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,... + must not be NULL. + _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be + null. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL +# if _GL_HAS_ATTRIBUTE (nonnull) +# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) +# else +# define _GL_ATTRIBUTE_NONNULL(args) +# endif +#endif + +/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is + not meant to be NUL-terminated. */ +/* Applies to: struct/union members and variables that are arrays of element + type '[[un]signed] char'. */ +#ifndef _GL_ATTRIBUTE_NONSTRING +# if _GL_HAS_ATTRIBUTE (nonstring) +# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) +# else +# define _GL_ATTRIBUTE_NONSTRING +# endif +#endif + +/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ + +/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. + */ +/* Applies to: functions. */ +/* After a function's parameter list, this attribute must come first, before + other attributes. */ +#ifndef _GL_ATTRIBUTE_NOTHROW +# if defined __cplusplus +# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 +# if __cplusplus >= 201103L +# define _GL_ATTRIBUTE_NOTHROW noexcept (true) +# else +# define _GL_ATTRIBUTE_NOTHROW throw () +# endif +# else +# define _GL_ATTRIBUTE_NOTHROW +# endif +# else +# if _GL_HAS_ATTRIBUTE (nothrow) +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +# else +# define _GL_ATTRIBUTE_NOTHROW +# endif +# endif +#endif + +/* _GL_ATTRIBUTE_PACKED declares: + For struct members: The member has the smallest possible alignment. + For struct, union, class: All members have the smallest possible alignment, + minimizing the memory required. */ +/* Applies to: struct members, struct, union, + in C++ also: class. */ +#ifndef _GL_ATTRIBUTE_PACKED +# if _GL_HAS_ATTRIBUTE (packed) +# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +# else +# define _GL_ATTRIBUTE_PACKED +# endif +#endif + +/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate + calls to the function with the same arguments if observable state is not + changed between calls. + This attribute is safe for a function that does not affect + observable state, and always returns exactly once. + (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_PURE +# if _GL_HAS_ATTRIBUTE (pure) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE +# endif +#endif + +/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is + a non-NULL pointer. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_RETURNS_NONNULL +# if _GL_HAS_ATTRIBUTE (returns_nonnull) +# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +# else +# define _GL_ATTRIBUTE_RETURNS_NONNULL +# endif +#endif + +/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a + trailing NULL argument. + _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). + _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_SENTINEL +# if _GL_HAS_ATTRIBUTE (sentinel) +# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) +# else +# define _GL_ATTRIBUTE_SENTINEL(pos) +# endif +#endif + +/* A helper macro. Don't use it directly. */ +#ifndef _GL_ATTRIBUTE_UNUSED +# if _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define _GL_ATTRIBUTE_UNUSED +# endif +#endif + + +/* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the + immediately preceding label is not used. The compiler should not warn + if the label is not used. */ +/* Applies to: label (both in C and C++). */ +/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;' + syntax. But clang does. */ +#ifndef _GL_UNUSED_LABEL +# if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__ +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED +# else +# define _GL_UNUSED_LABEL +# endif +#endif + + +/* In C++, there is the concept of "language linkage", that encompasses + name mangling and function calling conventions. + The following macros start and end a block of "C" linkage. */ +#ifdef __cplusplus +# define _GL_BEGIN_C_LINKAGE extern "C" { +# define _GL_END_C_LINKAGE } +#else +# define _GL_BEGIN_C_LINKAGE +# define _GL_END_C_LINKAGE +#endif + + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for Mac OS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif + +/* Define to a type if does not define. */ +/* #undef mbstate_t */ + +/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where + n1 and n2 are expressions without side effects, that evaluate to real + numbers (excluding NaN). + It returns + 1 if n1 > n2 + 0 if n1 == n2 + -1 if n1 < n2 + The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional + jump with nearly all GCC versions up to GCC 10. + This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many + GCC versions up to GCC 9. + The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 + avoids conditional jumps in all GCC versions >= 3.4. */ +#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) + + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to the type of st_nlink in struct stat, or a supertype. */ +/* #undef nlink_t */ + +/* Define as a signed integer type capable of holding a process identifier. */ +/* #undef pid_t */ + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported only directly. */ +#define restrict __restrict__ +/* Work around a bug in older versions of Sun C++, which did not + #define __restrict__ or support _Restrict or __restrict__ + even though the corresponding Sun C compiler ended up with + "#define restrict _Restrict" or "#define restrict __restrict__" + in the previous line. This workaround can be removed once + we assume Oracle Developer Studio 12.5 (2016) or later. */ +#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ +# define _Restrict +# define __restrict__ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define as a signed type of the same size as size_t. */ +/* #undef ssize_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + + + /* This definition is a duplicate of the one in unitypes.h. + It is here so that we can cope with an older version of unitypes.h + that does not contain this definition and that is pre-installed among + the public header files. */ + # if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 + # define _UC_RESTRICT __restrict + # elif 199901L <= __STDC_VERSION__ || defined restrict + # define _UC_RESTRICT restrict + # else + # define _UC_RESTRICT + # endif + + +#if !defined HAVE_C_ALIGNASOF \ + && !(defined __cplusplus && 201103 <= __cplusplus) \ + && !defined alignof +# if defined HAVE_STDALIGN_H +# include +# endif + +/* ISO C23 alignas and alignof for platforms that lack it. + + References: + ISO C23 (latest free draft + ) + sections 6.5.3.4, 6.7.5, 7.15. + C++11 (latest free draft + ) + section 18.10. */ + +/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment + requirement of a structure member (i.e., slot or field) that is of + type TYPE, as an integer constant expression. + + This differs from GCC's and clang's __alignof__ operator, which can + yield a better-performing alignment for an object of that type. For + example, on x86 with GCC and on Linux/x86 with clang, + __alignof__ (double) and __alignof__ (long long) are 8, whereas + alignof (double) and alignof (long long) are 4 unless the option + '-malign-double' is used. + + The result cannot be used as a value for an 'enum' constant, if you + want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ + +/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 + . + clang versions < 8.0.0 have the same bug. */ +# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ + || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ + && !defined __clang__) \ + || (defined __clang__ && __clang_major__ < 8)) +# undef/**/_Alignof +# ifdef __cplusplus +# if (201103 <= __cplusplus || defined _MSC_VER) +# define _Alignof(type) alignof (type) +# else + template struct __alignof_helper { char __a; __t __b; }; +# if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ +# define _Alignof(type) __builtin_offsetof (__alignof_helper, __b) +# else +# define _Alignof(type) offsetof (__alignof_helper, __b) +# endif +# define _GL_STDALIGN_NEEDS_STDDEF 1 +# endif +# else +# if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ +# define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) +# else +# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +# define _GL_STDALIGN_NEEDS_STDDEF 1 +# endif +# endif +# endif +# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) +# undef/**/alignof +# define alignof _Alignof +# endif + +/* alignas (A), also known as _Alignas (A), aligns a variable or type + to the alignment A, where A is an integer constant expression. For + example: + + int alignas (8) foo; + struct s { int a; int alignas (8) bar; }; + + aligns the address of FOO and the offset of BAR to be multiples of 8. + + A should be a power of two that is at least the type's alignment + and at most the implementation's alignment limit. This limit is + 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable + to MSVC through at least version 10.0, A should be an integer + constant, as MSVC does not support expressions such as 1 << 3. + To be portable to Sun C 5.11, do not align auto variables to + anything stricter than their default alignment. + + The following C23 requirements are not supported here: + + - If A is zero, alignas has no effect. + - alignas can be used multiple times; the strictest one wins. + - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). + + */ +# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 +# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) +# define _Alignas(a) alignas (a) +# elif (!defined __attribute__ \ + && ((defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__ && !defined __ibmxl__) \ + || (4 <= __clang_major__) \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +# elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +# endif +# endif +# if !defined HAVE_STDALIGN_H +# if ((defined _Alignas \ + && !(defined __cplusplus \ + && (201103 <= __cplusplus || defined _MSC_VER))) \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# define alignas _Alignas +# endif +# endif + +# if defined _GL_STDALIGN_NEEDS_STDDEF +# include +# endif +#endif + +#ifndef HAVE_C_BOOL +# if !defined __cplusplus && !defined __bool_true_false_are_defined +# if HAVE_STDBOOL_H +# include +# else +# if defined __SUNPRO_C +# error " is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC." +# else +# error " does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'." +# endif +# endif +# endif +# if !true +# define true (!false) +# endif +#endif + +#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ + && (!defined __cplusplus \ + || (__cpp_static_assert < 201411 \ + && __GNUG__ < 6 && __clang_major__ < 6))) + #include + #undef/**/assert + #ifdef __sgi + #undef/**/__ASSERT_H__ + #endif + /* Solaris 11.4 defines static_assert as a macro with 2 arguments. + We need it also to be invocable with a single argument. */ + #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus + #undef/**/static_assert + #define static_assert _Static_assert + #endif +#endif + + +/* On Windows, variables that may be in a DLL must be marked specially. */ +#if defined _MSC_VER && defined _DLL +# define DLL_VARIABLE __declspec (dllimport) +#else +# define DLL_VARIABLE +#endif + diff --git a/patches/libiconv/libiconv.patch b/patches/libiconv/libiconv.patch new file mode 100644 index 00000000..70609114 --- /dev/null +++ b/patches/libiconv/libiconv.patch @@ -0,0 +1,58 @@ +--- a/include/iconv.h ++++ b/include/iconv.h +@@ -21,7 +21,7 @@ + #define _LIBICONV_H + + #define _LIBICONV_VERSION 0x0111 /* version number: (major<<8) + minor */ +-extern @DLL_VARIABLE@ int _libiconv_version; /* Likewise */ ++extern int _libiconv_version; /* Likewise */ + + /* We would like to #include any system header file which could define + iconv_t, 1. in order to eliminate the risk that the user gets compilation +@@ -55,7 +55,7 @@ + have EILSEQ in a different header. On these systems, define EILSEQ + ourselves. */ + #ifndef EILSEQ +-#define EILSEQ @EILSEQ@ ++#define EILSEQ + #endif + + +@@ -79,7 +79,7 @@ + #ifndef LIBICONV_PLUG + #define iconv libiconv + #endif +-extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); ++extern size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); + + /* Frees resources allocated for conversion descriptor ‘cd’. */ + #ifndef LIBICONV_PLUG +@@ -97,8 +97,8 @@ + + /* Nonstandard extensions. */ + +-#if @USE_MBSTATE_T@ +-#if @BROKEN_WCHAR_H@ ++#if 1 ++#if 0 + /* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be +@@ -118,7 +118,7 @@ + A pointer to such an object can be used as an iconv_t. */ + typedef struct { + void* dummy1[28]; +-#if @USE_MBSTATE_T@ ++#if 1 + mbstate_t dummy2; + #endif + } iconv_allocation_t; +@@ -165,7 +165,7 @@ + void* callback_arg), + void* callback_arg, + void* data); +-#if @HAVE_WCHAR_T@ ++#if 1 + /* Fallback function. Invoked when a number of bytes could not be converted to + a wide character. This function should process all bytes from inbuf and may + produce replacement wide characters by calling the write_replacement diff --git a/patches/librime-lua.patch b/patches/librime-lua.patch new file mode 100644 index 00000000..5eb8c099 --- /dev/null +++ b/patches/librime-lua.patch @@ -0,0 +1,64 @@ +From 1a7a8972bb06060bf61c44e06fda3d3bf928abf5 Mon Sep 17 00:00:00 2001 +From: Rocka +Date: Tue, 12 Nov 2024 22:47:19 +0800 +Subject: [PATCH 1/2] set file-prefix-map to relative path + +--- + CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 42f2ebb..4f068d0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,6 +40,7 @@ aux_source_directory(src RIME_LUA_SRC) + aux_source_directory(src/lib RIME_LUA_LIB_SRC) + + add_library(rime-lua-objs OBJECT ${RIME_LUA_SRC} ${RIME_LUA_LIB_SRC} ${LUA_SRC}) ++target_compile_options(rime-lua-objs PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") + if(BUILD_SHARED_LIBS) + set_target_properties(rime-lua-objs PROPERTIES POSITION_INDEPENDENT_CODE ON) + endif() +-- +2.47.0 + +From 2a3f9504f25320b598022ded2f8e97522390a507 Mon Sep 17 00:00:00 2001 +From: Rocka +Date: Tue, 12 Nov 2024 22:47:28 +0800 +Subject: [PATCH 2/2] find lua with find_package + +--- + CMakeLists.txt | 18 +++--------------- + 1 file changed, 3 insertions(+), 15 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4f068d0..187b24a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,20 +1,8 @@ + set(LUA_VERSION "lua" CACHE STRING "lua version") + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lua5.4/lua.h") +- find_package(PkgConfig) +- if(PkgConfig_FOUND) +- foreach(pkg ${LUA_VERSION} lua54 lua53 lua52 luajit lua51) +- pkg_check_modules(LUA IMPORTED_TARGET GLOBAL ${pkg}) +- if(LUA_FOUND) +- break() +- endif() +- endforeach() +- endif() +- if(LUA_FOUND) +- set(LUA_TARGET PkgConfig::LUA) +- include_directories(${LUA_INCLUDE_DIRS}) +- else() +- message(FATAL_ERROR "Lua not found, consider using `bash action-install.sh` to download.") +- endif() ++ find_package(Lua CONFIG) ++ set(LUA_TARGET ${LUA_LIBRARY}) ++ include_directories(${LUA_INCLUDE_DIR}) + else() + message(STATUS "Using in-tree lua source") + include_directories(thirdparty/lua5.4) +-- +2.47.0 + diff --git a/patches/librime-octagram.patch b/patches/librime-octagram.patch new file mode 100644 index 00000000..3ac4201b --- /dev/null +++ b/patches/librime-octagram.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4115fa7..162ffb5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.10) + aux_source_directory(src octagram_src) + + add_library(rime-octagram-objs OBJECT ${octagram_src}) ++target_compile_options(rime-octagram-objs PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") + if(BUILD_SHARED_LIBS) + set_target_properties(rime-octagram-objs + PROPERTIES diff --git a/patches/librime-predict.patch b/patches/librime-predict.patch new file mode 100644 index 00000000..229b0e3f --- /dev/null +++ b/patches/librime-predict.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 07703bf..5ab6d3b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.10) + aux_source_directory(src predict_src) + + add_library(rime-predict-objs OBJECT ${predict_src}) ++target_compile_options(rime-predict-objs PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") + if(BUILD_SHARED_LIBS) + set_target_properties(rime-predict-objs + PROPERTIES diff --git a/patches/librime.patch b/patches/librime.patch new file mode 100644 index 00000000..dc503ce1 --- /dev/null +++ b/patches/librime.patch @@ -0,0 +1,120 @@ +From 15a8b479e66ac597a0fca4bede8012f5bb9df151 Mon Sep 17 00:00:00 2001 +From: Rocka +Date: Tue, 12 Nov 2024 22:16:16 +0800 +Subject: [PATCH 1/2] set file-prefix-map to relative path + +--- + src/CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 16082869..c4a5b5ca 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -166,6 +166,8 @@ if(BUILD_SHARED_LIBS) + else() + add_library(rime-static STATIC ${rime_src}) + target_link_libraries(rime-static ${rime_deps}) ++ target_compile_options(rime-static PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.") ++ target_compile_definitions(rime-static PRIVATE BOOST_DISABLE_CURRENT_LOCATION) + set_target_properties(rime-static PROPERTIES + OUTPUT_NAME "rime" PREFIX "lib" + ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +-- +2.47.0 + + +From 25608d1ea7a246b3ac4e7ccc02b1b6dfbb468869 Mon Sep 17 00:00:00 2001 +From: Rocka +Date: Tue, 12 Nov 2024 22:20:33 +0800 +Subject: [PATCH 2/2] Persist options to user.yaml in RimeSetOption + +--- + src/rime/engine.cc | 1 - + src/rime/engine.h | 2 ++ + src/rime/service.h | 8 ++++---- + src/rime_api_impl.h | 9 +++++++++ + 4 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/src/rime/engine.cc b/src/rime/engine.cc +index 07aa6b7d..7360e0b5 100644 +--- a/src/rime/engine.cc ++++ b/src/rime/engine.cc +@@ -52,7 +52,6 @@ class ConcreteEngine : public Engine { + vector> filters_; + vector> formatters_; + vector> post_processors_; +- an switcher_; + }; + + // implementations +diff --git a/src/rime/engine.h b/src/rime/engine.h +index 2e1c8b81..94a6b500 100644 +--- a/src/rime/engine.h ++++ b/src/rime/engine.h +@@ -16,6 +16,7 @@ namespace rime { + class KeyEvent; + class Schema; + class Context; ++class Switcher; + + class Engine : public Messenger { + public: +@@ -35,6 +36,7 @@ class Engine : public Messenger { + void set_active_engine(Engine* engine = nullptr) { active_engine_ = engine; } + + RIME_DLL static Engine* Create(); ++ an switcher_; + + protected: + Engine(); +diff --git a/src/rime/service.h b/src/rime/service.h +index 2b3111af..95ca87dc 100644 +--- a/src/rime/service.h ++++ b/src/rime/service.h +@@ -44,11 +44,11 @@ class Session { + Schema* schema() const; + time_t last_active_time() const { return last_active_time_; } + const string& commit_text() const { return commit_text_; } +- +- private: +- void OnCommit(const string& commit_text); +- + the engine_; ++ ++ private: ++ void OnCommit(const string& commit_text); ++ + time_t last_active_time_ = 0; + string commit_text_; + }; +diff --git a/src/rime_api_impl.h b/src/rime_api_impl.h +index 7749ce98..b0200a67 100644 +--- a/src/rime_api_impl.h ++++ b/src/rime_api_impl.h +@@ -17,6 +17,8 @@ + #include + #include + #include ++#include ++#include + + using namespace rime; + +@@ -426,6 +428,13 @@ RIME_DEPRECATED void RimeSetOption(RimeSessionId session_id, + if (!ctx) + return; + ctx->set_option(option, !!value); ++ auto engine = session->engine_.get(); ++ auto switcher = engine->switcher_; ++ if (switcher->IsAutoSave(option)) { ++ if (Config* user_config = switcher->user_config()) { ++ user_config->SetBool("var/option/" + std::string(option), value); ++ } ++ } + } + + RIME_DEPRECATED Bool RimeGetOption(RimeSessionId session_id, +-- +2.47.0 + diff --git a/patches/libthai/CMakeLists.txt b/patches/libthai/CMakeLists.txt new file mode 100644 index 00000000..c7156808 --- /dev/null +++ b/patches/libthai/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.22.1) +project(libthai) + +set(LIBTHAI_HEADER + "include/thai/thailib.h" + "include/thai/thcell.h" + "include/thai/thinp.h" +) +set(LIBTHAI_SOURCE + src/thcell/thcell.c + src/thctype/thctype.c + src/thctype/wtt.c + src/thinp/thinp.c +) + +add_library(thai STATIC ${LIBTHAI_SOURCE}) +target_include_directories(thai PRIVATE include) +install(TARGETS thai) +install(FILES ${LIBTHAI_HEADER} DESTINATION include/thai) diff --git a/patches/libuv.patch b/patches/libuv.patch index c945a05a..ad755281 100644 --- a/patches/libuv.patch +++ b/patches/libuv.patch @@ -1,25 +1,24 @@ -From f141a24f570e12f26677e99faf4b3ed53c678bb8 Mon Sep 17 00:00:00 2001 +From 0b34eef8cec4571aa9c92288ecfc544fbcb74463 Mon Sep 17 00:00:00 2001 From: Rocka -Date: Sun, 31 Dec 2023 15:37:22 +0800 +Date: Tue, 12 Nov 2024 23:01:06 +0800 Subject: [PATCH] android: revive support for api level 21 -reverts c8cbdbd and rebased to v1.47.0 +reverts c8cbdbd and rebased to v1.49.2 --- CMakeLists.txt | 4 + Makefile.am | 2 + include/uv/android-ifaddrs.h | 54 +++ src/unix/android-ifaddrs.c | 713 +++++++++++++++++++++++++++++++++++ - src/unix/fs.c | 3 +- - src/unix/linux.c | 10 +- - 6 files changed, 780 insertions(+), 6 deletions(-) + src/unix/linux.c | 6 +- + 5 files changed, 778 insertions(+), 1 deletion(-) create mode 100644 include/uv/android-ifaddrs.h create mode 100644 src/unix/android-ifaddrs.c diff --git a/CMakeLists.txt b/CMakeLists.txt -index 72377851b..659414105 100644 +index 28c6df256..3ec932e54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -268,6 +268,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android") +@@ -277,6 +277,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android") src/unix/random-getentropy.c src/unix/random-getrandom.c src/unix/random-sysctl-linux.c) @@ -31,10 +30,10 @@ index 72377851b..659414105 100644 if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux") diff --git a/Makefile.am b/Makefile.am -index 1dca3dd1f..8f7d806d0 100644 +index f85a41316..31d4d040b 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -396,7 +396,9 @@ libuv_la_SOURCES += src/unix/aix-common.c \ +@@ -406,7 +406,9 @@ libuv_la_SOURCES += src/unix/aix-common.c \ endif if ANDROID @@ -823,48 +822,23 @@ index 000000000..4765cc06b + uv__free(l_cur); + } +} -diff --git a/src/unix/fs.c b/src/unix/fs.c -index 891306dae..59e3d1cbc 100644 ---- a/src/unix/fs.c -+++ b/src/unix/fs.c -@@ -84,7 +84,8 @@ - - #if defined(__CYGWIN__) || \ - (defined(__HAIKU__) && B_HAIKU_VERSION < B_HAIKU_VERSION_1_PRE_BETA_5) || \ -- (defined(__sun) && !defined(__illumos__)) -+ (defined(__sun) && !defined(__illumos__)) || \ -+ (defined(__ANDROID__) && __ANDROID_API__ < __ANDROID_API_N__) - #define preadv(fd, bufs, nbufs, off) \ - pread(fd, (bufs)->iov_base, (bufs)->iov_len, off) - #define pwritev(fd, bufs, nbufs, off) \ diff --git a/src/unix/linux.c b/src/unix/linux.c -index 8eeb352e6..84cf7ead9 100644 +index 857a4ef8a..9deec0ef5 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c -@@ -122,10 +122,6 @@ - - #define HAVE_IFADDRS_H 1 - --# if defined(__ANDROID_API__) && __ANDROID_API__ < 24 --# undef HAVE_IFADDRS_H --#endif -- - #ifdef __UCLIBC__ - # if __UCLIBC_MAJOR__ < 0 && __UCLIBC_MINOR__ < 9 && __UCLIBC_SUBLEVEL__ < 32 - # undef HAVE_IFADDRS_H -@@ -133,7 +129,11 @@ - #endif +@@ -37,7 +37,11 @@ + #include - #ifdef HAVE_IFADDRS_H --# include + #include +-#include +# if defined(__ANDROID__) && __ANDROID_API__ < __ANDROID_API_N__ +# include "uv/android-ifaddrs.h" +# else +# include +# endif - # include - # include - # include + #include + #include + #include -- -2.43.0 +2.47.0 diff --git a/patches/marisa-tire.patch b/patches/marisa-tire.patch new file mode 100644 index 00000000..d7309734 --- /dev/null +++ b/patches/marisa-tire.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d89d928..6ba6a32 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,6 +49,7 @@ add_library(marisa + ${MARISA_SRC} + ) + ++target_compile_options(marisa PRIVATE "-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.") + install(TARGETS marisa + EXPORT marisa-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/patches/opencc.patch b/patches/opencc.patch new file mode 100644 index 00000000..bfba681a --- /dev/null +++ b/patches/opencc.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1acb75a9..05198910 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -210,7 +210,8 @@ if(NOT USE_SYSTEM_MARISA) + message(STATUS "Use bundled marisa library.") + add_subdirectory(deps/marisa-0.2.6) + else() +- find_library(LIBMARISA NAMES marisa) ++ find_package(marisa) ++ set(LIBMARISA marisa) + if (LIBMARISA) + message(STATUS "libmarisa found: ${LIBMARISA}") + else() diff --git a/patches/zstd.patch b/patches/zstd.patch new file mode 100644 index 00000000..a64037bd --- /dev/null +++ b/patches/zstd.patch @@ -0,0 +1,13 @@ +diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt +index 30349586b..0e0646dbd 100644 +--- a/build/cmake/lib/CMakeLists.txt ++++ b/build/cmake/lib/CMakeLists.txt +@@ -134,7 +134,8 @@ if (ZSTD_BUILD_SHARED) + endif () + + if (ZSTD_BUILD_STATIC) ++ target_compile_options(libzstd_static PRIVATE "-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.") + set_target_properties( + libzstd_static + PROPERTIES + POSITION_INDEPENDENT_CODE On diff --git a/prebuilder.cabal b/prebuilder.cabal index e1973243..77e672df 100644 --- a/prebuilder.cabal +++ b/prebuilder.cabal @@ -33,8 +33,10 @@ executable prebuilder Rules.LibHangul Rules.LibIME Rules.LibIMEJyutping + Rules.LibIconv Rules.LibIntlLite Rules.LibRime + Rules.LibThai Rules.Lua Rules.Marisa Rules.OpenCC diff --git a/src/Base.hs b/src/Base.hs index ddbe8e7c..4b6d4cbb 100644 --- a/src/Base.hs +++ b/src/Base.hs @@ -119,7 +119,7 @@ getSdkCMake :: AndroidEnv -> FilePath getSdkCMake AndroidEnv {..} = sdkRoot "cmake" sdkCMakeVersion "bin" "cmake" getSdkNinja :: AndroidEnv -> FilePath -getSdkNinja AndroidEnv {..} = sdkRoot "cmake" sdkCMakeVersion "bin" "ninja" +getSdkNinja AndroidEnv {..} = sdkRoot "cmake" sdkCMakeVersion "bin" getABIList :: AndroidEnv -> [String] getABIList AndroidEnv {..} = split (== ',') abi diff --git a/src/CMakeBuilder.hs b/src/CMakeBuilder.hs index 2dff4c35..c6a31f62 100644 --- a/src/CMakeBuilder.hs +++ b/src/CMakeBuilder.hs @@ -109,13 +109,13 @@ useCMake CmakeBuilder {..} = addOracle $ \(WithAndroidEnv q env) -> do unBuildActionABI preBuildEachABI q bEnv cmd_ (Cwd src) + (AddPath [] [ ninja ]) cmake "-B" buildEnvBuildDir "-GNinja" ( [ "-DCMAKE_TOOLCHAIN_FILE=" <> toolchain, "-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF", - "-DCMAKE_MAKE_PROGRAM=" <> ninja, "-DANDROID_ABI=" <> a, "-DANDROID_PLATFORM=" <> show (platform env), "-DANDROID_STL=c++_shared", diff --git a/src/Main.hs b/src/Main.hs index b3142c00..20451147 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -21,11 +21,13 @@ import Rules.GLog import Rules.LevelDB import Rules.LibChewing import Rules.LibUV +import Rules.LibIconv import Rules.LibHangul import Rules.LibIME import Rules.LibIMEJyutping import Rules.LibIntlLite import Rules.LibRime +import Rules.LibThai import Rules.Lua import Rules.Marisa import Rules.OpenCC @@ -66,6 +68,8 @@ main = do librimeRule libhangulRule libchewingRule + libthaiRule + libiconvRule anthyDictRule isInGitHubActionRule getOutputDirRule @@ -90,6 +94,8 @@ main = do "libhangul", "chewing-dict", "libchewing", + "libthai", + "libiconv", "anthy-dict" ] need artifacts diff --git a/src/Rules/Boost.hs b/src/Rules/Boost.hs index 2a9077fd..32e27c07 100644 --- a/src/Rules/Boost.hs +++ b/src/Rules/Boost.hs @@ -24,7 +24,7 @@ boostRule = do boostVersion <- getConfig' "boost_version" sha256 <- getConfig' "boost_sha256" let boostTag = "boost-" <> boostVersion - boostTar = boostTag <.> "tar" <.> "xz" + boostTar = boostTag <> "-cmake" <.> "tar" <.> "xz" boostUrl = "https://github.com/boostorg/boost/releases/download" boostTag <> "/" _ <- download boostUrl boostTar sha256 cmd_ (Cwd out) "tar" "xf" boostTar @@ -35,17 +35,22 @@ boostRule = do "-DBOOST_EXCLUDE_LIBRARIES=" <> intercalate ";" - [ "chrono", + [ "atomic", + "charconv", + "chrono", "context", "contract", "coroutine", + "date_time", "fiber", + "filesystem", "graph", "json", "locale", "log", "math", "nowide", + "process", "program_options", "serialization", "stacktrace", @@ -57,6 +62,10 @@ boostRule = do "wave", "wserialization" ], + "-DBOOST_IOSTREAMS_ENABLE_BZIP2=OFF", + "-DBOOST_IOSTREAMS_ENABLE_ZLIB=OFF", + "-DBOOST_IOSTREAMS_ENABLE_LZMA=OFF", + "-DBOOST_IOSTREAMS_ENABLE_ZSTD=OFF", "-DBOOST_INSTALL_LAYOUT=system" ] } diff --git a/src/Rules/GLog.hs b/src/Rules/GLog.hs index cc46d0ec..dba92d61 100644 --- a/src/Rules/GLog.hs +++ b/src/Rules/GLog.hs @@ -20,7 +20,9 @@ glogRule = do useCMake $ (cmakeBuilder "glog") { cmakeFlags = const ["-DBUILD_SHARED_LIBS=OFF", "-DWITH_GFLAGS=OFF", "-DWITH_UNWIND=OFF", "-DBUILD_TESTING=OFF"], - -- remove absolute path by __FILE__ macro - preBuild = BuildAction $ \_ src -> cmd_ (Cwd src) Shell "sed -i '618s|\\(^add_library (glog.*\\)|target_compile_options\\(glogbase PRIVATE \"-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.\"\\)\\n\\1|' CMakeLists.txt" + -- disable logging to cwd; remove absolute path by __FILE__ macro + preBuild = BuildAction $ \_ src -> do + cmd_ (Cwd src) "git checkout ." + cmd_ (Cwd src) "git apply ../patches/glog.patch" } "glog" ~> buildWithAndroidEnv buildGlog GLog diff --git a/src/Rules/LibChewing.hs b/src/Rules/LibChewing.hs index e6c0a7bb..53216704 100644 --- a/src/Rules/LibChewing.hs +++ b/src/Rules/LibChewing.hs @@ -18,29 +18,51 @@ libchewingRule :: Rules () libchewingRule = do let libchewingSrc = "libchewing" dictOutputDir = outputDir "chewing-dict" - dictSrcDir = libchewingSrc "data" buildLibchewing <- useCMake $ (cmakeBuilder "libchewing") - { cmakeFlags = const ["-DWITH_SQLITE3=OFF"], - preBuild = BuildAction $ \_ src -> do + { preBuild = BuildAction $ \_ src -> do -- CMakeLists is changed in last build - cmd_ (Cwd src) Shell "git checkout -- CMakeLists.txt" + cmd_ (Cwd src) Shell "git checkout ." -- skip data and shared lib -- merge libuserphrase.a into libchewing.a -- remove absolute path by CHEWING_DATADIR macro -- remove absolute path by __FILE__ macro - cmd_ (Cwd src) "git apply ../patches/libchewing.patch" + cmd_ (Cwd src) "git apply ../patches/libchewing.patch", + cmakeFlags = + const + [ "-DBUILD_SHARED_LIBS=OFF", + "-DBUILD_TESTING=OFF", + "-DWITH_SQLITE3=OFF", + "-DWITH_RUST=OFF" + ] } - phony "generateDict" $ do - cmd_ (Cwd libchewingSrc) "./autogen.sh" - cmd_ (Cwd libchewingSrc) "./configure --with-sqlite3=no" - cmd_ (Cwd libchewingSrc) "make" - - libchewingSrc "data/*" %> \_ -> need ["generateDict"] "chewing-dict" ~> do + let libchewingBuildHost = outputDir "libchewing-build-host" + dictSrcDir = libchewingBuildHost "data" + cmd_ (Cwd libchewingSrc) Shell "git checkout ." + cmd_ + "cmake" + "-B" + libchewingBuildHost + "-G" + "Ninja" + [ "-DBUILD_SHARED_LIBS=OFF", + "-DBUILD_TESTING=OFF", + "-DWITH_SQLITE3=OFF", + "-DWITH_RUST=OFF" + ] + libchewingSrc + cmd_ + "cmake" + "--build" + libchewingBuildHost + "--target" + [ "data", + "all_static_data" + ] copyFile' (dictSrcDir "dictionary.dat") (dictOutputDir "dictionary.dat") copyFile' (dictSrcDir "index_tree.dat") (dictOutputDir "index_tree.dat") copyFile' (dictSrcDir "pinyin.tab") (dictOutputDir "pinyin.tab") diff --git a/src/Rules/LibHangul.hs b/src/Rules/LibHangul.hs index 1b9cdb21..6b9b1ef5 100644 --- a/src/Rules/LibHangul.hs +++ b/src/Rules/LibHangul.hs @@ -20,11 +20,14 @@ libhangulRule = do useCMake $ (cmakeBuilder "libhangul") { preBuild = BuildAction $ \_ src -> do - -- disable executable - cmd_ (Cwd src) Shell "sed -i '53s|add_subdirectory(tools)||' CMakeLists.txt" - cmd_ (Cwd src) Shell "sed -i '48s|FULL_LOCALEDIR|LOCALEDIR|' hangul/CMakeLists.txt" - cmd_ (Cwd src) Shell "sed -i '49,50s|FULL_DATADIR|DATADIR|' hangul/CMakeLists.txt", - cmakeFlags = const ["-DBUILD_SHARED_LIBS=OFF", "-DENABLE_EXTERNAL_KEYBOARDS=OFF"] + cmd_ (Cwd src) "git checkout ." + cmd_ (Cwd src) "git apply ../patches/libhangul.patch", + cmakeFlags = + const + [ "-DBUILD_SHARED_LIBS=OFF", + "-DENABLE_EXTERNAL_KEYBOARDS=OFF", + "-DENABLE_UNIT_TEST=OFF" + ] } "libhangul" ~> do env <- getAndroidEnv diff --git a/src/Rules/LibIME.hs b/src/Rules/LibIME.hs index 362cb6a2..1c37cea5 100644 --- a/src/Rules/LibIME.hs +++ b/src/Rules/LibIME.hs @@ -11,7 +11,7 @@ dictNames :: [String] dictNames = ["sc", "extb"] tableDictNames :: [String] -tableDictNames = ["db", "erbi", "qxm", "wanfeng", "wbpy", "wbx", "zrm", "cj"] +tableDictNames = ["db", "wbpy", "wbx", "zrm"] libIMERule :: Rules () libIMERule = do @@ -123,7 +123,6 @@ chineseAddonsRule = do pinyinStrokeRule pinyinTableRule "chinese-addons-data" ~> do - copyFile' (outputDir "emoji.dict") $ outputDir "chinese-addons-data" "pinyin" "emoji.dict" copyFile' (outputDir "chaizi.dict") $ outputDir "chinese-addons-data" "pinyin" "chaizi.dict" copyFile' (outputDir "py_table.mb") $ outputDir "chinese-addons-data" "pinyinhelper" "py_table.mb" copyFile' (outputDir "py_stroke.mb") $ outputDir "chinese-addons-data" "pinyinhelper" "py_stroke.mb" @@ -139,7 +138,6 @@ pinyinExtraDictRule = do txt <- download chineseAddonsRepoDataUrl src sha256 execute "libime_pinyindict" txt out dict "chaizi" - dict "emoji" pinyinStrokeRule :: Rules () pinyinStrokeRule = do diff --git a/src/Rules/LibIconv.hs b/src/Rules/LibIconv.hs new file mode 100644 index 00000000..787fcf71 --- /dev/null +++ b/src/Rules/LibIconv.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE TypeFamilies #-} + +module Rules.LibIconv (libiconvRule) where + +import Base +import CMakeBuilder + +data LibIconv = LibIconv + deriving stock (Eq, Show, Typeable, Generic) + deriving anyclass (Hashable, Binary, NFData) + +type instance RuleResult LibIconv = () + +libiconvRule :: Rules () +libiconvRule = do + buildLibIconv <- + useCMake $ + (cmakeBuilder "libiconv") + { preBuild = BuildAction $ \_ src -> do + copyFile' "patches/libiconv/config.h" (src "include/config.h") + copyFile' "patches/libiconv/CMakeLists.txt" (src "CMakeLists.txt") + copyFile' (src "libcharset/include/localcharset.h.in") (src "libcharset/include/localcharset.h") + cmd_ (Cwd src) "make -f Makefile.devel lib/aliases.h lib/flags.h lib/translit.h" + copyFile' (src "include/iconv.h.in") (src "include/iconv.h") + cmd_ (Cwd src) "git apply ../patches/libiconv/libiconv.patch" + } + "libiconv" ~> buildWithAndroidEnv buildLibIconv LibIconv diff --git a/src/Rules/LibRime.hs b/src/Rules/LibRime.hs index 333e6434..c1cf04cf 100644 --- a/src/Rules/LibRime.hs +++ b/src/Rules/LibRime.hs @@ -25,26 +25,32 @@ librimeRule = do -- canocialize for symlink librimeLuaSrc <- liftIO $ canonicalizePath "librime-lua" librimeOctagramSrc <- liftIO $ canonicalizePath "librime-octagram" + librimePredictSrc <- liftIO $ canonicalizePath "librime-predict" liftIO $ do removePathForcibly (src "plugins" "lua") createDirectoryLink librimeLuaSrc (src "plugins" "lua") removePathForcibly (src "plugins" "octagram") createDirectoryLink librimeOctagramSrc (src "plugins" "octagram") - -- use prebuilt lua - cmd_ (Cwd (src "plugins" "lua")) Shell "sed -i '11s|^\\s*if(LUA_FOUND)|set(LUA_FOUND 1)\\nset(LUA_INCLUDE_DIRS \"${CMAKE_CURRENT_SOURCE_DIR}/../build/lua/${ANDROID_ABI}/include\")\\n\\0|' CMakeLists.txt" + removePathForcibly (src "plugins" "predict") + createDirectoryLink librimePredictSrc (src "plugins" "predict") + -- find lua with find_package; remove absolute path by __FILE__ macro + cmd_ (Cwd librimeLuaSrc) "git checkout ." + cmd_ (Cwd librimeLuaSrc) "git apply ../patches/librime-lua.patch" + -- disable tools; remove absolute path by __FILE__ macro + cmd_ (Cwd librimeOctagramSrc) "git checkout ." + cmd_ (Cwd librimeOctagramSrc) "git apply ../patches/librime-octagram.patch" + -- disable tools; remove absolute path by __FILE__ macro + cmd_ (Cwd librimePredictSrc) "git checkout ." + cmd_ (Cwd librimePredictSrc) "git apply ../patches/librime-predict.patch" -- remove absolute path by __FILE__ macro - cmd_ (Cwd (src "plugins" "lua")) Shell "sed -i '47s|^set(plugin_name.*|target_compile_options(rime-lua-objs PRIVATE \"-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.\")\\n\\0|' CMakeLists.txt" - -- remove absolute path by __FILE__ macro - cmd_ (Cwd (src "plugins" "octagram")) Shell "sed -i '13s|^set(plugin_name.*|target_compile_options(rime-octagram-objs PRIVATE \"-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.\")\\n\\0|' CMakeLists.txt" - -- remove command line tools - cmd_ (Cwd (src "plugins" "octagram")) Shell "sed -i 19{/add_subdirectory\\(tools\\)/d} CMakeLists.txt" - -- remove absolute path by __FILE__ macro - cmd_ (Cwd src) Shell "sed -i '143s|target_link_libraries(rime-static.*|target_compile_options(rime-static PRIVATE \"-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.\")\\n\\0|' src/CMakeLists.txt", + cmd_ (Cwd src) "git checkout ." + cmd_ (Cwd src) "git apply ../patches/librime.patch", cmakeFlags = \BuildEnv {..} -> [ "-DBUILD_SHARED_LIBS=OFF", "-DBUILD_STATIC=ON", "-DBUILD_TEST=OFF", - "-DCMAKE_CXX_FLAGS=-DBOOST_DISABLE_CURRENT_LOCATION", + "-DBUILD_TOOLS=OFF", + "-DALSO_LOG_TO_STDERR=ON", "-DCMAKE_FIND_ROOT_PATH=" <> intercalate ";" @@ -55,7 +61,8 @@ librimeRule = do "yaml-cpp", "leveldb", "marisa", - "opencc" + "opencc", + "lua" ] <> ["."] ) diff --git a/src/Rules/LibThai.hs b/src/Rules/LibThai.hs new file mode 100644 index 00000000..0e768dbf --- /dev/null +++ b/src/Rules/LibThai.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE TypeFamilies #-} + +module Rules.LibThai (libthaiRule) where + +import Base +import CMakeBuilder + +data LibThai = LibThai + deriving stock (Eq, Show, Typeable, Generic) + deriving anyclass (Hashable, Binary, NFData) + +type instance RuleResult LibThai = () + +libthaiRule :: Rules () +libthaiRule = do + buildLibThai <- + useCMake $ + (cmakeBuilder "libthai") + { preBuild = BuildAction $ \_ src -> do + copyFile' "patches/libthai/CMakeLists.txt" (src "CMakeLists.txt") + } + "libthai" ~> buildWithAndroidEnv buildLibThai LibThai diff --git a/src/Rules/Marisa.hs b/src/Rules/Marisa.hs index 8c343aba..7b4988e2 100644 --- a/src/Rules/Marisa.hs +++ b/src/Rules/Marisa.hs @@ -20,7 +20,9 @@ marisaRule = do useCMake $ (cmakeBuilder "marisa") { source = const $ pure "marisa-trie", - preBuild = BuildAction $ \_ src -> cmd_ (Cwd src) Shell "sed -i '52s|install(TARGETS marisa.*|target_compile_options\\(marisa PRIVATE \"-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.\"\\)\\n\\0|' CMakeLists.txt", + preBuild = BuildAction $ \_ src -> do + cmd_ (Cwd src) "git checkout ." + cmd_ (Cwd src) "git apply ../patches/marisa-tire.patch", cmakeFlags = const ["-DBUILD_SHARED_LIBS=OFF"] } "marisa" ~> buildWithAndroidEnv buildMarisa MarisaTrie diff --git a/src/Rules/OpenCC.hs b/src/Rules/OpenCC.hs index c2c33b5f..0a39fadb 100644 --- a/src/Rules/OpenCC.hs +++ b/src/Rules/OpenCC.hs @@ -22,7 +22,9 @@ openccRule = do (cmakeBuilder "opencc") { source = const $ pure "OpenCC", -- use prebuilt marisa - preBuild = BuildAction $ \_ src -> cmd_ (Cwd src) Shell "sed -i '213s|find_library(LIBMARISA NAMES marisa)|find_package(marisa)\\nset(LIBMARISA marisa)|' CMakeLists.txt", + preBuild = BuildAction $ \_ src -> do + cmd_ (Cwd src) "git checkout ." + cmd_ (Cwd src) "git apply ../patches/opencc.patch", cmakeFlags = \BuildEnv {..} -> [ "-DSHARE_INSTALL_PREFIX=share", "-DINCLUDE_INSTALL_DIR=include", diff --git a/src/Rules/ZSTD.hs b/src/Rules/ZSTD.hs index fb80538a..760bce5c 100644 --- a/src/Rules/ZSTD.hs +++ b/src/Rules/ZSTD.hs @@ -24,7 +24,9 @@ zstdRule = do useCMake $ (cmakeBuilder "zstd") { cmakeFile = Just $ "build" "cmake", - preBuild = BuildAction $ \_ src -> cmd_ (Cwd src) Shell "sed -i '137s|set_target_properties(.*|target_compile_options(libzstd_static PRIVATE \"-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.\")\\n\\0|' build/cmake/lib/CMakeLists.txt", + preBuild = BuildAction $ \_ src -> do + cmd_ (Cwd src) "git checkout ." + cmd_ (Cwd src) "git apply ../patches/zstd.patch", cmakeFlags = const [ "-DZSTD_LEGACY_SUPPORT=OFF", diff --git a/zstd b/zstd index 63779c79..794ea1b0 160000 --- a/zstd +++ b/zstd @@ -1 +1 @@ -Subproject commit 63779c798237346c2b245c546c40b72a5a5913fe +Subproject commit 794ea1b0afca0f020f4e57b6732332231fb23c70