1
- { lib , stdenv , fetchurl , pkg-config , postgresql , msgpack-c , mecab , callPackage } :
2
- let
3
- supabase-groonga = callPackage ../supabase-groonga.nix { } ;
4
- in
5
- stdenv . mkDerivation rec {
6
- pname = "pgroonga" ;
7
- version = "3.0.7" ;
1
+ # { lib, stdenv, fetchurl, pkg-config, postgresql, msgpack-c, mecab, callPackage
2
+ # , patchelf }:
3
+ # let
4
+ # supabase-groonga = callPackage ../supabase-groonga.nix { };
5
+ # mecab-naist-jdic = callPackage ./mecab-naist-jdic { };
6
+ # in stdenv.mkDerivation rec {
7
+ # pname = "pgroonga";
8
+ # version = "3.0.7";
9
+ # src = fetchurl {
10
+ # url =
11
+ # "https://packages.groonga.org/source/${pname}/${pname}-${version}.tar.gz";
12
+ # sha256 = "sha256-iF/zh4zDDpAw5fxW1WG8i2bfPt4VYsnYArwOoE/lwgM=";
13
+ # };
14
+ # nativeBuildInputs = [ pkg-config patchelf ];
15
+ # buildInputs =
16
+ # [ postgresql msgpack-c supabase-groonga mecab mecab-naist-jdic ];
8
17
9
- src = fetchurl {
10
- url = "https://packages.groonga.org/source/${ pname } /${ pname } -${ version } .tar.gz" ;
11
- sha256 = "sha256-iF/zh4zDDpAw5fxW1WG8i2bfPt4VYsnYArwOoE/lwgM=" ;
12
- } ;
18
+ # configureFlags = [
19
+ # "--with-mecab=${mecab}"
20
+ # "--enable-mecab"
21
+ # "--enable-groonga-tokenizer-mecab"
22
+ # "--with-mecab-dict=${mecab-naist-jdic}/lib/mecab/dic/naist-jdic"
23
+ # "--with-groonga=${supabase-groonga}"
24
+ # "--with-groonga-token-mecab-dir=${supabase-groonga}/lib/groonga/plugins/tokenizers"
25
+ # "--with-groonga-tokenizer-mecab=${supabase-groonga}/lib/groonga/plugins/tokenizers/mecab.so"
26
+ # "--with-groonga-plugin-dir=${supabase-groonga}/lib/groonga/plugins"
27
+ # "--with-pgconfigdir=${postgresql}/bin"
28
+ # "--with-mecab-config=${mecab}/bin/mecab-config"
29
+ # ];
13
30
14
- nativeBuildInputs = [ pkg-config ] ;
31
+ # makeFlags =
32
+ # [ "HAVE_MSGPACK=1" "MSGPACK_PACKAGE_NAME=msgpack-c" "HAVE_MECAB=1" ];
15
33
16
- buildInputs = [ postgresql msgpack-c supabase-groonga mecab ] ;
34
+ # buildPhase = ''
35
+ # runHook preBuild
36
+ # make
37
+ # echo "Checking for MeCab-related files:"
38
+ # find . -name "*mecab*"
39
+ # runHook postBuild
40
+ # '';
17
41
18
- runtimeDependencies = [ mecab ] ;
42
+ # installPhase = ''
43
+ # runHook preInstall
19
44
20
- preConfigure = ''
21
- export MECAB_CONFIG=${ mecab } /bin/mecab-config
22
- export MECAB_DICDIR=${ mecab } /lib/mecab/dic/ipadic
23
- export GRN_PLUGINS_DIR=$out/lib/groonga/plugins
24
- export GROONGA_TOKENIZER_MECAB_DIR=${ supabase-groonga } /lib/groonga/plugins/tokenizers
25
- export GROONGA_TOKENIZER_MECAB=$out/lib/groonga/plugins/tokenizer_mecab.so
26
- '' ;
45
+ # install -D pgroonga${postgresql.dlSuffix} -t $out/lib/
46
+ # install -D pgroonga.control -t $out/share/postgresql/extension/
47
+ # install -D data/pgroonga-*.sql -t $out/share/postgresql/extension/
48
+ # install -D pgroonga_database${postgresql.dlSuffix} -t $out/lib/
49
+ # install -D pgroonga_database.control -t $out/share/postgresql/extension/
50
+ # install -D data/pgroonga_database-*.sql -t $out/share/postgresql/extension/
27
51
28
- configureFlags = [
29
- "--with-mecab=${ mecab } "
30
- "--enable-tokenizer-mecab"
31
- "--with-groonga=${ supabase-groonga } "
32
- "--with-groonga-token-mecab-dir=${ supabase-groonga } /lib/groonga/plugins/tokenizers"
33
- "--with-groonga-tokenizer-mecab=${ supabase-groonga } /lib/groonga/plugins/tokenizers/mecab.so"
34
- "--with-groonga-plugin-dir=${ supabase-groonga } /lib/groonga/plugins"
35
- ] ;
52
+ # # Ensure MeCab tokenizer is available
53
+ # if [ -f ${supabase-groonga}/lib/groonga/plugins/tokenizers/mecab.so ]; then
54
+ # mkdir -p $out/lib/postgresql/plugins/
55
+ # cp ${supabase-groonga}/lib/groonga/plugins/tokenizers/mecab.so $out/lib/postgresql/plugins/
56
+ # else
57
+ # echo "MeCab tokenizer plugin not found in Groonga installation"
58
+ # exit 1
59
+ # fi
60
+
61
+ # runHook postInstall
62
+ # '';
63
+
64
+ # postInstall = ''
65
+ # echo "Checking installed files:"
66
+ # find $out -type f
67
+
68
+ # echo "Checking for MeCab-related files in the output:"
69
+ # find $out -name "*mecab*"
70
+ # '';
71
+
72
+ # postFixup = ''
73
+ # patchelf --set-rpath "${
74
+ # lib.makeLibraryPath [
75
+ # mecab
76
+ # mecab-naist-jdic
77
+ # supabase-groonga
78
+ # postgresql
79
+ # stdenv.cc.cc.lib
80
+ # msgpack-c
81
+ # ]
82
+ # }" $out/lib/pgroonga${postgresql.dlSuffix}
83
+ # patchelf --set-rpath "${
84
+ # lib.makeLibraryPath [
85
+ # mecab
86
+ # mecab-naist-jdic
87
+ # supabase-groonga
88
+ # postgresql
89
+ # stdenv.cc.cc.lib
90
+ # msgpack-c
91
+ # ]
92
+ # }" $out/lib/pgroonga_database${postgresql.dlSuffix}
93
+ # '';
94
+
95
+ # meta = with lib; {
96
+ # description = "A PostgreSQL extension to use Groonga as the index";
97
+ # longDescription = ''
98
+ # PGroonga is a PostgreSQL extension to use Groonga as the index.
99
+ # PostgreSQL supports full text search against languages that use only alphabet and digit.
100
+ # It means that PostgreSQL doesn't support full text search against Japanese, Chinese and so on.
101
+ # You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL.
102
+ # '';
103
+ # homepage = "https://pgroonga.github.io/";
104
+ # changelog = "https://github.com/pgroonga/pgroonga/releases/tag/${version}";
105
+ # license = licenses.postgresql;
106
+ # platforms = postgresql.meta.platforms;
107
+ # maintainers = with maintainers; [ samrose ];
108
+ # };
109
+ # }
110
+
111
+ # { lib, stdenv, fetchurl, pkg-config, postgresql, cmake, msgpack-c, mecab, callPackage }:
112
+ # let
113
+ # supabase-groonga = callPackage ../supabase-groonga.nix { };
114
+ # mecab-naist-jdic = callPackage ./mecab-naist-jdic { };
115
+ # in
116
+ # stdenv.mkDerivation rec {
117
+ # pname = "pgroonga";
118
+ # version = "3.0.7";
119
+
120
+ # src = fetchurl {
121
+ # url = "https://packages.groonga.org/source/${pname}/${pname}-${version}.tar.gz";
122
+ # sha256 = "sha256-iF/zh4zDDpAw5fxW1WG8i2bfPt4VYsnYArwOoE/lwgM=";
123
+ # };
124
+
125
+ # nativeBuildInputs = [ cmake pkg-config ];
126
+ # buildInputs = [ postgresql msgpack-c supabase-groonga mecab mecab-naist-jdic ];
127
+
128
+ # makeFlags = [
129
+ # "HAVE_MSGPACK=1"
130
+ # "MSGPACK_PACKAGE_NAME=msgpack-c"
131
+ # ];
132
+
133
+ # installPhase = ''
134
+ # install -D pgroonga${postgresql.dlSuffix} -t $out/lib/
135
+ # install -D pgroonga.control -t $out/share/postgresql/extension
136
+ # install -D data/pgroonga-*.sql -t $out/share/postgresql/extension
137
+
138
+ # install -D pgroonga_database${postgresql.dlSuffix} -t $out/lib/
139
+ # install -D pgroonga_database.control -t $out/share/postgresql/extension
140
+ # install -D data/pgroonga_database-*.sql -t $out/share/postgresql/extension
141
+ # '';
36
142
143
+ # meta = with lib; {
144
+ # description = "A PostgreSQL extension to use Groonga as the index";
145
+ # longDescription = ''
146
+ # PGroonga is a PostgreSQL extension to use Groonga as the index.
147
+ # PostgreSQL supports full text search against languages that use only alphabet and digit.
148
+ # It means that PostgreSQL doesn't support full text search against Japanese, Chinese and so on.
149
+ # You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL.
150
+ # '';
151
+ # homepage = "https://pgroonga.github.io/";
152
+ # changelog = "https://github.com/pgroonga/pgroonga/releases/tag/${version}";
153
+ # license = licenses.postgresql;
154
+ # platforms = postgresql.meta.platforms;
155
+ # maintainers = with maintainers; [ samrose ];
156
+ # };
157
+ # }
158
+
159
+ # { lib, stdenv, fetchurl, pkg-config, postgresql, msgpack-c, callPackage, cmake, mecab }:
160
+ # let
161
+ # supabase-groonga = callPackage ../supabase-groonga.nix { };
162
+ # mecab-naist-jdic = callPackage ./mecab-naist-jdic { };
163
+ # in
164
+ # stdenv.mkDerivation rec {
165
+ # pname = "pgroonga";
166
+ # version = "3.0.7";
167
+ # src = fetchurl {
168
+ # url = "https://packages.groonga.org/source/${pname}/${pname}-${version}.tar.gz";
169
+ # sha256 = "sha256-iF/zh4zDDpAw5fxW1WG8i2bfPt4VYsnYArwOoE/lwgM=";
170
+ # };
171
+ # patches = [ ./use-system-groonga.patch ];
172
+ # nativeBuildInputs = [ pkg-config cmake ];
173
+ # buildInputs = [ postgresql msgpack-c supabase-groonga mecab mecab-naist-jdic ];
174
+ # cmakeFlags = [
175
+ # "-DCMAKE_PREFIX_PATH=${supabase-groonga}"
176
+ # "-DMECAB_CONFIG=${mecab}/bin/mecab-config"
177
+ # "-DMECAB_DICT_INDEX=${mecab}/libexec/mecab/mecab-dict-index"
178
+ # "-DMECAB_DIC_DIR=${mecab-naist-jdic}/lib/mecab/dic/naist-jdic"
179
+ # "-DCMAKE_BUILD_TYPE=Release"
180
+ # "-DBUILD_TESTING=OFF"
181
+ # ];
182
+ # preConfigure = ''
183
+ # export CFLAGS="-I${supabase-groonga}/include -I${postgresql}/include/server -I${supabase-groonga}/include/groonga"
184
+ # export CPPFLAGS="$CFLAGS"
185
+ # export LDFLAGS="-L${supabase-groonga}/lib -L${postgresql}/lib"
186
+
187
+ # # Remove the problematic /EHsc flag
188
+ # export CFLAGS="$(echo $CFLAGS | sed 's/-EHsc//g')"
189
+ # export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-EHsc//g')"
190
+
191
+ # # Ensure CMake doesn't add it back
192
+ # substituteInPlace CMakeLists.txt --replace "-EHsc" ""
193
+ # '';
194
+
195
+ # installPhase = ''
196
+ # install -D pgroonga${postgresql.dlSuffix} -t $out/lib/
197
+ # install -D pgroonga.control -t $out/share/postgresql/extension
198
+ # install -D data/pgroonga-*.sql -t $out/share/postgresql/extension
199
+ # install -D pgroonga_database${postgresql.dlSuffix} -t $out/lib/
200
+ # install -D pgroonga_database.control -t $out/share/postgresql/extension
201
+ # install -D data/pgroonga_database-*.sql -t $out/share/postgresql/extension
202
+ # '';
203
+ # meta = with lib; {
204
+ # description = "A PostgreSQL extension to use Groonga as the index";
205
+ # longDescription = ''
206
+ # PGroonga is a PostgreSQL extension to use Groonga as the index.
207
+ # PostgreSQL supports full text search against languages that use only alphabet and digit.
208
+ # It means that PostgreSQL doesn't support full text search against Japanese, Chinese and so on.
209
+ # You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL.
210
+ # '';
211
+ # homepage = "https://pgroonga.github.io/";
212
+ # changelog = "https://github.com/pgroonga/pgroonga/releases/tag/${version}";
213
+ # license = licenses.postgresql;
214
+ # platforms = postgresql.meta.platforms;
215
+ # maintainers = with maintainers; [ samrose ];
216
+ # };
217
+ # }
218
+
219
+ { lib , stdenv , fetchurl , pkg-config , postgresql , msgpack-c , callPackage
220
+ , makeWrapper , mecab } :
221
+
222
+ let
223
+ supabase-groonga = callPackage ../supabase-groonga.nix { } ;
224
+ mecab-naist-jdic = callPackage ./mecab-naist-jdic { } ;
225
+ in stdenv . mkDerivation rec {
226
+ pname = "pgroonga" ;
227
+ version = "3.0.7" ;
228
+ src = fetchurl {
229
+ url =
230
+ "https://packages.groonga.org/source/${ pname } /${ pname } -${ version } .tar.gz" ;
231
+ sha256 = "sha256-iF/zh4zDDpAw5fxW1WG8i2bfPt4VYsnYArwOoE/lwgM=" ;
232
+ } ;
233
+ nativeBuildInputs = [ pkg-config makeWrapper ] ;
234
+ buildInputs = [ postgresql msgpack-c supabase-groonga mecab mecab-naist-jdic ] ;
37
235
makeFlags = [
236
+ "USE_PGXS=1"
38
237
"HAVE_MSGPACK=1"
39
238
"MSGPACK_PACKAGE_NAME=msgpack-c"
40
239
"HAVE_MECAB=1"
240
+ "POSTGRES_INCLUDEDIR=${ postgresql } /include"
241
+ "POSTGRES_LIBDIR=${ postgresql . lib } /lib"
242
+ "PG_CONFIG=${ postgresql } /bin/pg_config"
243
+ "MECAB_CONFIG=${ mecab } /bin/mecab-config"
41
244
] ;
245
+
246
+ preConfigure = ''
247
+ export MECAB_DICDIR=${ mecab-naist-jdic } /lib/mecab/dic/naist-jdic
248
+ export GROONGA_INCLUDE_PATH=${ supabase-groonga } /include
249
+ export GROONGA_LIB_PATH=${ supabase-groonga } /lib
250
+ export MECAB_INCLUDE_PATH=${ mecab } /include
251
+ export MECAB_LIB_PATH=${ mecab } /lib
252
+ '' ;
253
+
254
+ buildPhase = ''
255
+ runHook preBuild
256
+ make $makeFlags
257
+ runHook postBuild
258
+ '' ;
42
259
43
260
installPhase = ''
261
+ runHook preInstall
262
+ make $makeFlags install DESTDIR=$out
44
263
install -D pgroonga${ postgresql . dlSuffix } -t $out/lib/
45
264
install -D pgroonga.control -t $out/share/postgresql/extension
46
265
install -D data/pgroonga-*.sql -t $out/share/postgresql/extension
47
-
48
266
install -D pgroonga_database${ postgresql . dlSuffix } -t $out/lib/
49
267
install -D pgroonga_database.control -t $out/share/postgresql/extension
50
268
install -D data/pgroonga_database-*.sql -t $out/share/postgresql/extension
51
269
270
+ for component in pgroonga_check pgroonga_wal_applier pgroonga_crash_safer pgroonga_standby_maintainer; do
271
+ if [ -f "$component${ postgresql . dlSuffix } " ]; then
272
+ install -D "$component${ postgresql . dlSuffix } " -t $out/lib/
273
+ fi
274
+ done
275
+ runHook postInstall
276
+ '' ;
277
+
278
+ postFixup = ''
279
+ for f in $out/lib/*.so; do
280
+ patchelf --set-rpath "${ lib . makeLibraryPath buildInputs } :$out/lib" $f
281
+ done
52
282
'' ;
53
283
54
284
meta = with lib ; {
@@ -65,4 +295,4 @@ stdenv.mkDerivation rec {
65
295
platforms = postgresql . meta . platforms ;
66
296
maintainers = with maintainers ; [ samrose ] ;
67
297
} ;
68
- }
298
+ }
0 commit comments