-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: rebasing * feat: supabase-groonga and mod pgroonga * feat: resolving conflicts * feat: merge conflicts * feat: TokenMecab now working with pgroonga * chore: rm comment * chore: no postFixup needed * test: smoke test of pgroonga with mecab * fix: additional fixes to the build/install process in ami groonga plugins dir must be set as env var for TokenMecab to work * fix: need to tmp refer to this branch for testing * chore: bump version for actual release + rm wrapper not needed * pgroonga mecab test (#1156) * add mecab test * add mecab test --------- Co-authored-by: Sam Rose <[email protected]> Co-authored-by: Oliver Rice <[email protected]>
- Loading branch information
1 parent
6e17f0b
commit 5961293
Showing
12 changed files
with
386 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Do not use vendored libraries | ||
|
||
--- a/vendor/CMakeLists.txt | ||
+++ b/vendor/CMakeLists.txt | ||
@@ -14,10 +14,7 @@ | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
add_subdirectory(onigmo) | ||
-add_subdirectory(mruby) | ||
-add_subdirectory(mecab) | ||
-add_subdirectory(message_pack) | ||
if(GRN_WITH_MRUBY) | ||
add_subdirectory(groonga-log) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ lib, stdenv, fetchurl, mecab }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "mecab-naist-jdic"; | ||
version = "0.6.3b-20111013"; | ||
|
||
src = fetchurl { | ||
url = "https://github.com/supabase/mecab-naist-jdic/raw/main/mecab-naist-jdic-${version}.tar.gz"; | ||
sha256 = "sha256-yzdwDcmne5U/K/OxW0nP7NZ4SFMKLPirywm1lMpWKMw="; | ||
}; | ||
|
||
buildInputs = [ mecab ]; | ||
|
||
configureFlags = [ | ||
"--with-charset=utf8" | ||
]; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
make | ||
${mecab}/libexec/mecab/mecab-dict-index -d . -o . -f UTF-8 -t utf-8 | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/lib/mecab/dic/naist-jdic | ||
cp *.dic *.bin *.def $out/lib/mecab/dic/naist-jdic/ | ||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Naist Japanese Dictionary for MeCab"; | ||
homepage = "https://taku910.github.io/mecab/"; | ||
license = licenses.gpl2; | ||
platforms = platforms.unix; | ||
maintainers = with maintainers; [ samrose ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 33b34477..f4ffefe5 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -12,7 +12,6 @@ if(MSVC_VERSION LESS 1800) | ||
message(FATAL_ERROR "PGroonga supports only MSVC 2013 or later") | ||
endif() | ||
|
||
-add_subdirectory(vendor/groonga) | ||
|
||
set(PGRN_POSTGRESQL_DIR "${CMAKE_INSTALL_PREFIX}" | ||
CACHE PATH "PostgreSQL binary directory") | ||
@@ -52,8 +51,6 @@ string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" | ||
string(REGEX REPLACE ".*comment = '([^']+)'.*" "\\1" | ||
PGRN_DESCRIPTION "${PGRN_CONTROL}") | ||
|
||
-file(READ "${CMAKE_CURRENT_SOURCE_DIR}/vendor/groonga/bundled_message_pack_version" | ||
- PGRN_BUNDLED_MESSAGE_PACK_VERSION) | ||
string(STRIP | ||
"${PGRN_BUNDLED_MESSAGE_PACK_VERSION}" | ||
PGRN_BUNDLED_MESSAGE_PACK_VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Fix CMake install path | ||
|
||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -1141,11 +1141,11 @@ | ||
|
||
set(prefix "${CMAKE_INSTALL_PREFIX}") | ||
set(exec_prefix "\${prefix}") | ||
-set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") | ||
-set(sbindir "\${exec_prefix}/${CMAKE_INSTALL_SBINDIR}") | ||
-set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}") | ||
-set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") | ||
-set(datarootdir "\${prefix}/${CMAKE_INSTALL_DATAROOTDIR}") | ||
+set(bindir "${CMAKE_INSTALL_FULL_BINDIR}") | ||
+set(sbindir "${CMAKE_INSTALL_FULL_SBINDIR}") | ||
+set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") | ||
+set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") | ||
+set(datarootdir "${CMAKE_INSTALL_FULL_DATAROOTDIR}") | ||
set(datadir "\${datarootdir}") | ||
set(expanded_pluginsdir "${GRN_PLUGINS_DIR}") | ||
set(GRN_EXPANDED_DEFAULT_DOCUMENT_ROOT "${GRN_DEFAULT_DOCUMENT_ROOT}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ lib, stdenv, cmake, fetchurl, kytea, msgpack-c, mecab, pkg-config, rapidjson | ||
, testers, xxHash, zstd, postgresqlPackages, makeWrapper, suggestSupport ? false | ||
, zeromq, libevent, openssl, lz4Support ? false, lz4, zlibSupport ? true, zlib | ||
, writeShellScriptBin, callPackage }: | ||
let mecab-naist-jdic = callPackage ./ext/mecab-naist-jdic { }; | ||
in stdenv.mkDerivation (finalAttrs: { | ||
pname = "supabase-groonga"; | ||
version = "14.0.5"; | ||
src = fetchurl { | ||
url = | ||
"https://packages.groonga.org/source/groonga/groonga-${finalAttrs.version}.tar.gz"; | ||
hash = "sha256-y4UGnv8kK0z+br8wXpPf57NMXkdEJHcLCuTvYiubnIc="; | ||
}; | ||
patches = | ||
[ ./fix-cmake-install-path.patch ./do-not-use-vendored-libraries.patch ]; | ||
nativeBuildInputs = [ cmake pkg-config makeWrapper ]; | ||
buildInputs = [ rapidjson xxHash zstd mecab kytea msgpack-c ] | ||
++ lib.optionals lz4Support [ lz4 ] ++ lib.optional zlibSupport [ zlib ] | ||
++ lib.optionals suggestSupport [ zeromq libevent ]; | ||
cmakeFlags = [ | ||
"-DWITH_MECAB=ON" | ||
"-DMECAB_DICDIR=${mecab-naist-jdic}/lib/mecab/dic/naist-jdic" | ||
"-DMECAB_CONFIG=${mecab}/bin/mecab-config" | ||
"-DENABLE_MECAB_TOKENIZER=ON" | ||
"-DMECAB_INCLUDE_DIR=${mecab}/include" | ||
"-DMECAB_LIBRARY=${mecab}/lib/libmecab.so" | ||
"-DGROONGA_ENABLE_TOKENIZER_MECAB=YES" | ||
"-DGRN_WITH_MECAB=YES" | ||
]; | ||
preConfigure = '' | ||
export MECAB_DICDIR=${mecab-naist-jdic}/lib/mecab/dic/naist-jdic | ||
echo "MeCab dictionary directory is: $MECAB_DICDIR" | ||
''; | ||
buildPhase = '' | ||
cmake --build . -- VERBOSE=1 | ||
grep -i mecab CMakeCache.txt || (echo "MeCab not detected in CMake cache" && exit 1) | ||
echo "CMake cache contents related to MeCab:" | ||
grep -i mecab CMakeCache.txt | ||
''; | ||
|
||
# installPhase = '' | ||
# mkdir -p $out/bin $out/lib/groonga/plugins | ||
# cp -r lib/groonga/plugins/* $out/lib/groonga/plugins | ||
# cp -r bin/* $out/bin | ||
# echo "Installed Groonga plugins:" | ||
# ls -l $out/lib/groonga/plugins | ||
# ''; | ||
|
||
postInstall = '' | ||
echo "Searching for MeCab-related files:" | ||
find $out -name "*mecab*" | ||
echo "Checking Groonga plugins directory:" | ||
ls -l $out/lib/groonga/plugins | ||
echo "Wrapping Groonga binary:" | ||
wrapProgram $out/bin/groonga \ | ||
--set GRN_PLUGINS_DIR $out/lib/groonga/plugins | ||
''; | ||
env.NIX_CFLAGS_COMPILE = | ||
lib.optionalString zlibSupport "-I${zlib.dev}/include"; | ||
|
||
meta = with lib; { | ||
homepage = "https://groonga.org/"; | ||
description = "Open-source fulltext search engine and column store"; | ||
license = licenses.lgpl21; | ||
maintainers = [ maintainers.samrose ]; | ||
platforms = platforms.all; | ||
longDescription = '' | ||
Groonga is an open-source fulltext search engine and column store. | ||
It lets you write high-performance applications that requires fulltext search. | ||
''; | ||
}; | ||
}) |
Oops, something went wrong.