From ae1d5e9707d24605ea5fcac27dab0d4bd0dfb2dd Mon Sep 17 00:00:00 2001 From: Abe Tomoaki Date: Thu, 30 Jul 2026 12:57:51 +0900 Subject: [PATCH] install: Switch source build to Meson Related GitHub: https://github.com/pgroonga/pgroonga/issues/989 GitHub fixes GH-459 Reported by milliemole. Thanks!!! Reported by junK433. Thanks!!! --- _po/ja/install/source.po | 180 ++++++++++++++++++++------------------- install/source.md | 91 ++++++++++---------- ja/install/source.md | 91 ++++++++++---------- 3 files changed, 189 insertions(+), 173 deletions(-) diff --git a/_po/ja/install/source.po b/_po/ja/install/source.po index 8b535230..86516fb5 100644 --- a/_po/ja/install/source.po +++ b/_po/ja/install/source.po @@ -1,12 +1,15 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-07-30 00:50+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Japanese\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"PO-Revision-Date: 2024-07-08 12:04+0900\n" +"Plural-Forms: nplurals=; plural=;\n" msgid "" "---\n" @@ -65,10 +68,10 @@ msgstr "PGroongaのソースを展開します。" msgid "" "```console\n" -"% wget https://packages.groonga.org/source/pgroonga/pgroonga-{{ site." +"$ wget https://packages.groonga.org/source/pgroonga/pgroonga-{{ site." "pgroonga_version }}.tar.gz\n" -"% tar xvf pgroonga-{{ site.pgroonga_version }}.tar.gz\n" -"% cd pgroonga-{{ site.pgroonga_version }}\n" +"$ tar xvf pgroonga-{{ site.pgroonga_version }}.tar.gz\n" +"$ cd pgroonga-{{ site.pgroonga_version }}\n" "```" msgstr "" @@ -78,53 +81,54 @@ msgstr "参考:未リリースの最新版を使いたい場合は次のよう msgid "" "```console\n" -"% git clone --recursive https://github.com/pgroonga/pgroonga.git\n" -"% cd pgroonga\n" +"$ git clone --recursive https://github.com/pgroonga/pgroonga.git\n" +"$ cd pgroonga\n" "```" msgstr "" -msgid "Build PGroonga. There are some options:" -msgstr "PGroongaをビルドします。いくつかオプションがあります。" - msgid "" -" * `HAVE_MSGPACK=1`: It's required for WAL support. You need [msgpack-c]" -"(https://github.com/msgpack/msgpack-c) 1.4.1 or later. You can use " -"`libmsgpack-dev` package on Debian based platform and `msgpack-devel` " -"package in [EPEL](https://fedoraproject.org/wiki/EPEL) on CentOS 7." +"Build and install PGroonga with [Meson](https://mesonbuild.com/) and [Ninja]" +"(https://ninja-build.org/):" msgstr "" -" * `HAVE_MSGPACK=1`:WALサポート付きでビルドするときは必須です。[msgpack-c]" -"(https://github.com/msgpack/msgpack-c) 1.4.1以降が必要です。Debianベースのプ" -"ラットフォームでは`libmsgpack-dev`パッケージを使えます。CentOS 7では[EPEL]" -"(https://fedoraproject.org/wiki/EPEL/ja)にある`msgpack-devel`パッケージを使え" -"ます。" - -msgid "Use the following command line when you want to build with WAL support:" -msgstr "WALサポート付きでビルドしたい場合は次のコマンドラインを使います。" +"[Meson](https://mesonbuild.com/)と[Ninja](https://ninja-build.org/)を使って、" +"PGroongaをビルドしてインストールします。" msgid "" "```console\n" -"% make HAVE_MSGPACK=1\n" +"$ meson setup build\n" +"$ meson compile -C build\n" +"$ sudo meson install -C build\n" "```" msgstr "" -msgid "Use the following command line when you don't need WAL support:" -msgstr "WALサポートが必要ない場合は次のコマンドラインを使います。" +msgid "" +"If `pg_config` command doesn't exist in your `PATH`, specify it explicitly " +"with the `pg_config` option:" +msgstr "" +"`pg_config`コマンドが`PATH`環境変数に含まれていない場合は、`pg_config`オプ" +"ションで明示的に指定してください。" msgid "" "```console\n" -"% make\n" +"$ meson setup build -Dpg_config=/path/to/pg_config\n" "```" msgstr "" msgid "If you get any error, confirm the followings:" msgstr "エラーが発生した場合は次のことを確認してください。" +msgid " * `meson` and `ninja` commands are installed." +msgstr " * `meson`と`ninja`がインストール済であること。" + msgid "" -" * `pg_config` command exists at any path in `PATH` environment variable.\n" -" * `pkg-config --list-all` includes `groonga`." +" * `pg_config` command exists at any path in `PATH` environment variable, " +"or is specified with the `pg_config` option." msgstr "" -" * `PATH`環境変数内のパスに`pg_config`コマンドが存在していること。\n" -" * `pkg-config --list-all`に`groonga`が含まれていること。" +" * `PATH`環境変数内のパスに`pg_config`コマンドが存在しているか、`pg_config`" +"で正しいパスを指定していること。" + +msgid " * `pkg-config --list-all` includes `groonga`." +msgstr " * `pkg-config --list-all`に`groonga`が含まれていること。" msgid "" "If `pg_config` command doesn't exist, you may forget to install the " @@ -151,16 +155,7 @@ msgstr "" msgid "" "```console\n" -"% PKG_CONFIG_PATH=/usr/local/lib/pkgconfig make\n" -"```" -msgstr "" - -msgid "Install PGroonga:" -msgstr "PGroongaをインストールします。" - -msgid "" -"```console\n" -"% sudo make install\n" +"$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig meson setup build\n" "```" msgstr "" @@ -176,7 +171,7 @@ msgstr "" msgid "" "```console\n" -"% sudo dnf install policycoreutils checkpolicy\n" +"$ sudo dnf install policycoreutils checkpolicy\n" "```" msgstr "" @@ -194,7 +189,7 @@ msgstr "" msgid "" "```console\n" -"% cat > my-pgroonga.te << EOF\n" +"$ cat > my-pgroonga.te << EOF\n" "module my-pgroonga 1.0;" msgstr "" @@ -212,9 +207,9 @@ msgid "" msgstr "" msgid "" -"% checkmodule -M -m -o my-pgroonga.mod my-pgroonga.te\n" -"% semodule_package -o my-pgroonga.pp -m my-pgroonga.mod\n" -"% sudo semodule -i my-pgroonga.pp\n" +"$ checkmodule -M -m -o my-pgroonga.mod my-pgroonga.te\n" +"$ semodule_package -o my-pgroonga.pp -m my-pgroonga.mod\n" +"$ sudo semodule -i my-pgroonga.pp\n" "```" msgstr "" @@ -223,7 +218,7 @@ msgstr "データベースを作成します。" msgid "" "```console\n" -"% psql --command 'CREATE DATABASE pgroonga_test'\n" +"$ psql --command 'CREATE DATABASE pgroonga_test'\n" "```" msgstr "" @@ -243,7 +238,7 @@ msgstr "" msgid "" "```console\n" -"% psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;'\n" +"$ psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;'\n" "```" msgstr "" @@ -284,80 +279,92 @@ msgstr "" " * [zipバージョン](http://www.enterprisedb.com/products-services-training/" "pgbindownload)" -msgid "" -" * [Microsoft Visual Studio Express 2013 for Windows Desktop](https://www." -"visualstudio.com/downloads/#d-2013-express)" +msgid " * [Visual Studio](https://visualstudio.microsoft.com/downloads/)" msgstr "" msgid " * [CMake](http://www.cmake.org/)" msgstr "" -msgid "" -"Download PGroonga source archive for Windows from packages.groonga.org. " -"Source archive for Windows is zip file. Source archive for Windows bundles " -"Groonga." -msgstr "" -"packages.groonga.orgからWindows用のPGroongaソースアーカイブをダウンロードして" -"ください。Windows用のソースアーカイブはzipファイルです。Windows用のソースアー" -"カイブにはGroongaがバンドルされています。" +msgid " * Use for building Groonga" +msgstr " * Groongaのビルドに使います" msgid "" -" * [pgroonga-{{ site.pgroonga_version }}](https://packages.groonga.org/" -"source/pgroonga/pgroonga-{{ site.pgroonga_version }}.zip)" +" * [Meson](https://mesonbuild.com/) and [Ninja](https://ninja-build.org/)" msgstr "" -msgid "Extract the downloaded source archive and move to source folder:" +msgid " * Use for building PGroonga" +msgstr " * PGroongaのビルドに使います" + +msgid "" +"Download the Groonga source archive and PGroonga source archive from " +"packages.groonga.org and extract them:" msgstr "" -"ダウンロードしたソースアーカイブを展開し、ソースフォルダーに移動してくださ" -"い。" +"packages.groonga.orgからGroongaとPGroongaのソースアーカイブをダウンロードして" +"展開します。" msgid "" -"```text\n" -"> cd c:\\Users\\%USERNAME%\\Downloads\\pgroonga-{{ site.pgroonga_version }}\n" -"```" +" * [groonga-latest](https://packages.groonga.org/source/groonga/groonga-" +"latest.zip)" msgstr "" msgid "" -"Specify build option by `cmake`. The following command line is for building " -"PGroonga for 64bit version PostgreSQL. If you want to build for 32bit " -"version PostgreSQL, use `-G \"Visual Studio 12 2013\"` parameter instead:" +" * [pgroonga-{{ site.pgroonga_version }}](https://packages.groonga.org/" +"source/pgroonga/pgroonga-{{ site.pgroonga_version }}.zip)" msgstr "" -"`cmake`のビルドオプションを指定します。64bitバージョンのPostgreSQL用に" -"PGroongaをビルドするためのコマンドラインは次の通りです。もし、32bitバージョン" -"のPostgreSQL用にビルドしたい場合は、代わりに`-G \"Visual Studio 12 2013\"`パ" -"ラメーターを使ってください。" + +msgid "Variables used for the build:" +msgstr "ビルドで使う変数" + +msgid " * `%GROONGA_INSTALL_DIR%` is a folder to install Groonga" +msgstr " * `%GROONGA_INSTALL_DIR%`はGroongaをインストールするフォルダです。" msgid "" -"```text\n" -"pgroonga-{{ site.pgroonga_version }}> cmake . -G \"Visual Studio 12 2013 " -"Win64\" -DCMAKE_INSTALL_PREFIX=%POSTGRESQL_INSTALL_FOLDER% -" -"DGRN_WITH_BUNDLED_LZ4=yes -DGRN_WITH_BUNDLED_MECAB=yes -" -"DGRN_WITH_BUNDLED_MESSAGE_PACK=yes -DGRN_WITH_MRUBY=yes\n" -"```" +" * `%POSTGRESQL_INSTALL_FOLDER%` is a folder where PostgreSQL is installed" msgstr "" +" * `%POSTGRESQL_INSTALL_FOLDER%`はPostgreSQLをインストールしたフォルダです。" msgid "" -"If you installed PostgreSQL by installer, `%POSTGRESQL_INSTALL_FOLDER%` is " -"`C:\\Program Files\\PostgreSQL\\%POSTGRESQL_VERSION%`." +" * If you installed PostgreSQL by installer, " +"`%POSTGRESQL_INSTALL_FOLDER%` is `C:\\Program Files\\PostgreSQL\\" +"%POSTGRESQL_VERSION%`." msgstr "" -"インストーラーを使ってPostgreSQLをインストールした場合は" +" * インストーラーを使ってPostgreSQLをインストールした場合は" "`%POSTGRESQL_INSTALL_FOLDER%`は`C:\\Program Files\\PostgreSQL\\" "%POSTGRESQL_VERSION%`になります。" msgid "" -"If you installed PostgreSQL by zip, `%POSTGRESQL_INSTALL_FOLDER%` is " +" * If you installed PostgreSQL by zip, `%POSTGRESQL_INSTALL_FOLDER%` is " "`%POSTGRESQL_ZIP_EXTRACTED_FOLDER%\\pgsql`." msgstr "" -"zipバージョンのPostgreSQLをインストールした場合は" +" * zipバージョンのPostgreSQLをインストールした場合は" "`%POSTGRESQL_INSTALL_FOLDER%`は`%PostgreSQLのzipを展開したフォルダー%\\pgsql`" "になります。" +msgid "Build and install Groonga:" +msgstr "Groongaをビルドしてインストールします。" + +msgid "" +"```text\n" +"> cmake -B groonga.build -G Ninja -S groonga-latest -" +"DCMAKE_BUILD_TYPE=RelWithDebInfo -" +"DCMAKE_INSTALL_PREFIX=%GROONGA_INSTALL_DIR% -DGRN_WITH_MECAB=bundled -" +"DGRN_WITH_MESSAGE_PACK=bundled -DGRN_WITH_MRUBY=yes -" +"DGRN_WITH_RAPIDJSON=bundled -DGRN_WITH_XXHASH=bundled -" +"DGRN_WITH_ZSTD=bundled\n" +"> cmake --build groonga.build\n" +"> cmake --install groonga.build\n" +"```" +msgstr "" + msgid "Build PGroonga:" msgstr "PGroongaをビルドします。" msgid "" "```text\n" -"pgroonga-{{ site.pgroonga_version }}> cmake --build . --config Release\n" +"> meson setup pgroonga.build -S pgroonga-{{ site.pgroonga_version }} --" +"buildtype=release --cmake-prefix-path=%GROONGA_INSTALL_DIR% -" +"Dpg_config=%POSTGRESQL_INSTALL_FOLDER%\\bin\\pg_config.exe\n" +"> meson compile -C pgroonga.build\n" "```" msgstr "" @@ -372,8 +379,7 @@ msgstr "" msgid "" "```text\n" -"pgroonga-{{ site.pgroonga_version }}> cmake --build . --config Release --" -"target Install\n" +"> meson install -C pgroonga.build\n" "```" msgstr "" diff --git a/install/source.md b/install/source.md index d311988e..7788fa9d 100644 --- a/install/source.md +++ b/install/source.md @@ -24,37 +24,38 @@ Install PostgreSQL. Extract PGroonga source: ```console -% wget https://packages.groonga.org/source/pgroonga/pgroonga-{{ site.pgroonga_version }}.tar.gz -% tar xvf pgroonga-{{ site.pgroonga_version }}.tar.gz -% cd pgroonga-{{ site.pgroonga_version }} +$ wget https://packages.groonga.org/source/pgroonga/pgroonga-{{ site.pgroonga_version }}.tar.gz +$ tar xvf pgroonga-{{ site.pgroonga_version }}.tar.gz +$ cd pgroonga-{{ site.pgroonga_version }} ``` FYI: If you want to use the unreleased latest version, use the followings: ```console -% git clone --recursive https://github.com/pgroonga/pgroonga.git -% cd pgroonga +$ git clone --recursive https://github.com/pgroonga/pgroonga.git +$ cd pgroonga ``` -Build PGroonga. There are some options: - - * `HAVE_MSGPACK=1`: It's required for WAL support. You need [msgpack-c](https://github.com/msgpack/msgpack-c) 1.4.1 or later. You can use `libmsgpack-dev` package on Debian based platform and `msgpack-devel` package in [EPEL](https://fedoraproject.org/wiki/EPEL) on CentOS 7. - -Use the following command line when you want to build with WAL support: +Build and install PGroonga with [Meson](https://mesonbuild.com/) and [Ninja](https://ninja-build.org/): ```console -% make HAVE_MSGPACK=1 +$ meson setup build +$ meson compile -C build +$ sudo meson install -C build ``` -Use the following command line when you don't need WAL support: +If `pg_config` command doesn't exist in your `PATH`, specify it explicitly with the `pg_config` option: ```console -% make +$ meson setup build -Dpg_config=/path/to/pg_config ``` If you get any error, confirm the followings: - * `pg_config` command exists at any path in `PATH` environment variable. + * `meson` and `ninja` commands are installed. + + * `pg_config` command exists at any path in `PATH` environment variable, or is specified with the `pg_config` option. + * `pkg-config --list-all` includes `groonga`. If `pg_config` command doesn't exist, you may forget to install the development package of PostgreSQL. @@ -64,26 +65,19 @@ If `pkg-config --list-all` doesn't include `groonga`, you may forget to install Here is an example when you install Groonga with `--prefix=/usr/local`: ```console -% PKG_CONFIG_PATH=/usr/local/lib/pkgconfig make -``` - -Install PGroonga: - -```console -% sudo make install +$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig meson setup build ``` If you use SELinux, you must create a policy package(.pp) and install it. PGroonga makes PostgreSQL map `/pgrn*` files into memory, which is not allowed by default. First, install `policycoreutils` and `checkpolicy`. ```console -% sudo dnf install policycoreutils checkpolicy +$ sudo dnf install policycoreutils checkpolicy ``` Let's assume that PostgreSQL binaries are of type `postgresql_t` and PostgreSQL data files are of type `postgresql_db_t`. Allow `postgresql_t` type to memory map files of type `postgresql_db_t`. Then compile it (.mod), package it (.pp) and install the resulting policy package. - ```console -% cat > my-pgroonga.te << EOF +$ cat > my-pgroonga.te << EOF module my-pgroonga 1.0; require { @@ -95,15 +89,15 @@ require { allow postgresql_t postgresql_db_t:file map; EOF -% checkmodule -M -m -o my-pgroonga.mod my-pgroonga.te -% semodule_package -o my-pgroonga.pp -m my-pgroonga.mod -% sudo semodule -i my-pgroonga.pp +$ checkmodule -M -m -o my-pgroonga.mod my-pgroonga.te +$ semodule_package -o my-pgroonga.pp -m my-pgroonga.mod +$ sudo semodule -i my-pgroonga.pp ``` Create a database: ```console -% psql --command 'CREATE DATABASE pgroonga_test' +$ psql --command 'CREATE DATABASE pgroonga_test' ``` (Normally, you should create a user for `pgroonga_test` database and use the user. See [`GRANT USAGE ON SCHEMA pgroonga`](../reference/grant-usage-on-schema-pgroonga.html) for details.) @@ -111,7 +105,7 @@ Create a database: Connect to the created database and execute `CREATE EXTENSION pgroonga`: ```console -% psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;' +$ psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;' ``` That's all! @@ -128,40 +122,51 @@ Here is a list of required software to build and install PGroonga from source. I * [Zip version](http://www.enterprisedb.com/products-services-training/pgbindownload) - * [Microsoft Visual Studio Express 2013 for Windows Desktop](https://www.visualstudio.com/downloads/#d-2013-express) + * [Visual Studio](https://visualstudio.microsoft.com/downloads/) * [CMake](http://www.cmake.org/) -Download PGroonga source archive for Windows from packages.groonga.org. Source archive for Windows is zip file. Source archive for Windows bundles Groonga. + * Use for building Groonga + + * [Meson](https://mesonbuild.com/) and [Ninja](https://ninja-build.org/) + + * Use for building PGroonga + +Download the Groonga source archive and PGroonga source archive from packages.groonga.org and extract them: + + * [groonga-latest](https://packages.groonga.org/source/groonga/groonga-latest.zip) * [pgroonga-{{ site.pgroonga_version }}](https://packages.groonga.org/source/pgroonga/pgroonga-{{ site.pgroonga_version }}.zip) -Extract the downloaded source archive and move to source folder: +Variables used for the build: -```text -> cd c:\Users\%USERNAME%\Downloads\pgroonga-{{ site.pgroonga_version }} -``` + * `%GROONGA_INSTALL_DIR%` is a folder to install Groonga -Specify build option by `cmake`. The following command line is for building PGroonga for 64bit version PostgreSQL. If you want to build for 32bit version PostgreSQL, use `-G "Visual Studio 12 2013"` parameter instead: + * `%POSTGRESQL_INSTALL_FOLDER%` is a folder where PostgreSQL is installed -```text -pgroonga-{{ site.pgroonga_version }}> cmake . -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=%POSTGRESQL_INSTALL_FOLDER% -DGRN_WITH_BUNDLED_LZ4=yes -DGRN_WITH_BUNDLED_MECAB=yes -DGRN_WITH_BUNDLED_MESSAGE_PACK=yes -DGRN_WITH_MRUBY=yes -``` + * If you installed PostgreSQL by installer, `%POSTGRESQL_INSTALL_FOLDER%` is `C:\Program Files\PostgreSQL\%POSTGRESQL_VERSION%`. + + * If you installed PostgreSQL by zip, `%POSTGRESQL_INSTALL_FOLDER%` is `%POSTGRESQL_ZIP_EXTRACTED_FOLDER%\pgsql`. -If you installed PostgreSQL by installer, `%POSTGRESQL_INSTALL_FOLDER%` is `C:\Program Files\PostgreSQL\%POSTGRESQL_VERSION%`. +Build and install Groonga: -If you installed PostgreSQL by zip, `%POSTGRESQL_INSTALL_FOLDER%` is `%POSTGRESQL_ZIP_EXTRACTED_FOLDER%\pgsql`. +```text +> cmake -B groonga.build -G Ninja -S groonga-latest -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=%GROONGA_INSTALL_DIR% -DGRN_WITH_MECAB=bundled -DGRN_WITH_MESSAGE_PACK=bundled -DGRN_WITH_MRUBY=yes -DGRN_WITH_RAPIDJSON=bundled -DGRN_WITH_XXHASH=bundled -DGRN_WITH_ZSTD=bundled +> cmake --build groonga.build +> cmake --install groonga.build +``` Build PGroonga: ```text -pgroonga-{{ site.pgroonga_version }}> cmake --build . --config Release +> meson setup pgroonga.build -S pgroonga-{{ site.pgroonga_version }} --buildtype=release --cmake-prefix-path=%GROONGA_INSTALL_DIR% -Dpg_config=%POSTGRESQL_INSTALL_FOLDER%\bin\pg_config.exe +> meson compile -C pgroonga.build ``` Install PGroonga. You may be required administrator privilege. For example, you installed PostgreSQL by installer, you will be required administrator privilege. ```text -pgroonga-{{ site.pgroonga_version }}> cmake --build . --config Release --target Install +> meson install -C pgroonga.build ``` Create a database: diff --git a/ja/install/source.md b/ja/install/source.md index 15154799..25db12a7 100644 --- a/ja/install/source.md +++ b/ja/install/source.md @@ -24,37 +24,38 @@ PostgreSQLをインストールします。 PGroongaのソースを展開します。 ```console -% wget https://packages.groonga.org/source/pgroonga/pgroonga-{{ site.pgroonga_version }}.tar.gz -% tar xvf pgroonga-{{ site.pgroonga_version }}.tar.gz -% cd pgroonga-{{ site.pgroonga_version }} +$ wget https://packages.groonga.org/source/pgroonga/pgroonga-{{ site.pgroonga_version }}.tar.gz +$ tar xvf pgroonga-{{ site.pgroonga_version }}.tar.gz +$ cd pgroonga-{{ site.pgroonga_version }} ``` 参考:未リリースの最新版を使いたい場合は次のようにしてください。 ```console -% git clone --recursive https://github.com/pgroonga/pgroonga.git -% cd pgroonga +$ git clone --recursive https://github.com/pgroonga/pgroonga.git +$ cd pgroonga ``` -PGroongaをビルドします。いくつかオプションがあります。 - - * `HAVE_MSGPACK=1`:WALサポート付きでビルドするときは必須です。[msgpack-c](https://github.com/msgpack/msgpack-c) 1.4.1以降が必要です。Debianベースのプラットフォームでは`libmsgpack-dev`パッケージを使えます。CentOS 7では[EPEL](https://fedoraproject.org/wiki/EPEL/ja)にある`msgpack-devel`パッケージを使えます。 - -WALサポート付きでビルドしたい場合は次のコマンドラインを使います。 +[Meson](https://mesonbuild.com/)と[Ninja](https://ninja-build.org/)を使って、PGroongaをビルドしてインストールします。 ```console -% make HAVE_MSGPACK=1 +$ meson setup build +$ meson compile -C build +$ sudo meson install -C build ``` -WALサポートが必要ない場合は次のコマンドラインを使います。 +`pg_config`コマンドが`PATH`環境変数に含まれていない場合は、`pg_config`オプションで明示的に指定してください。 ```console -% make +$ meson setup build -Dpg_config=/path/to/pg_config ``` エラーが発生した場合は次のことを確認してください。 - * `PATH`環境変数内のパスに`pg_config`コマンドが存在していること。 + * `meson`と`ninja`がインストール済であること。 + + * `PATH`環境変数内のパスに`pg_config`コマンドが存在しているか、`pg_config`で正しいパスを指定していること。 + * `pkg-config --list-all`に`groonga`が含まれていること。 もし、`pg_config`コマンドが存在しない場合、PostgreSQLの開発用パッケージをインストールし忘れているかもしれません。 @@ -64,26 +65,19 @@ WALサポートが必要ない場合は次のコマンドラインを使いま 以下は`--prefix=/usr/local`オプション付きでGroongaをインストールした場合の例です。 ```console -% PKG_CONFIG_PATH=/usr/local/lib/pkgconfig make -``` - -PGroongaをインストールします。 - -```console -% sudo make install +$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig meson setup build ``` もし、SELinuxを使っているなら、ポリシーパッケージ(.pp)を作成し、インストールしなければなりません。PGroongaは、 `/pgrn*` ファイルをメモリー内にマップさせますが、これはデフォルトでは許可されていません。初めに、 `policycoreutils` と `checkpolicy` をインストールします。 ```console -% sudo dnf install policycoreutils checkpolicy +$ sudo dnf install policycoreutils checkpolicy ``` PostgreSQLのバイナリーのタイプを `postgresql_t` 、 PostgreSQlのデータファイルのタイプを `postgresql_db_t` とします。 `postgresql_t` が `postgresql_db_t` のファイルをメモリーにマップすることを許可します。そして、それをコンパイル(.mod)、パッケージ(.pp)したポリシーパッケージをインストールします。 - ```console -% cat > my-pgroonga.te << EOF +$ cat > my-pgroonga.te << EOF module my-pgroonga 1.0; require { @@ -95,15 +89,15 @@ require { allow postgresql_t postgresql_db_t:file map; EOF -% checkmodule -M -m -o my-pgroonga.mod my-pgroonga.te -% semodule_package -o my-pgroonga.pp -m my-pgroonga.mod -% sudo semodule -i my-pgroonga.pp +$ checkmodule -M -m -o my-pgroonga.mod my-pgroonga.te +$ semodule_package -o my-pgroonga.pp -m my-pgroonga.mod +$ sudo semodule -i my-pgroonga.pp ``` データベースを作成します。 ```console -% psql --command 'CREATE DATABASE pgroonga_test' +$ psql --command 'CREATE DATABASE pgroonga_test' ``` (通常は`pgroonga_test`データベース用のユーザーを作ってそのユーザーを利用するべきです。詳細は[`GRANT USAGE ON SCHEMA pgroonga`](../reference/grant-usage-on-schema-pgroonga.html)を参照してください。) @@ -111,7 +105,7 @@ EOF 作成したデータベースに接続し、`CREATE EXTENSION pgroonga`を実行します。 ```console -% psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;' +$ psql -d pgroonga_test --command 'CREATE EXTENSION pgroonga;' ``` これで終わりです! @@ -128,40 +122,51 @@ EOF * [zipバージョン](http://www.enterprisedb.com/products-services-training/pgbindownload) - * [Microsoft Visual Studio Express 2013 for Windows Desktop](https://www.visualstudio.com/downloads/#d-2013-express) + * [Visual Studio](https://visualstudio.microsoft.com/downloads/) * [CMake](http://www.cmake.org/) -packages.groonga.orgからWindows用のPGroongaソースアーカイブをダウンロードしてください。Windows用のソースアーカイブはzipファイルです。Windows用のソースアーカイブにはGroongaがバンドルされています。 + * Groongaのビルドに使います + + * [Meson](https://mesonbuild.com/) and [Ninja](https://ninja-build.org/) + + * PGroongaのビルドに使います + +packages.groonga.orgからGroongaとPGroongaのソースアーカイブをダウンロードして展開します。 + + * [groonga-latest](https://packages.groonga.org/source/groonga/groonga-latest.zip) * [pgroonga-{{ site.pgroonga_version }}](https://packages.groonga.org/source/pgroonga/pgroonga-{{ site.pgroonga_version }}.zip) -ダウンロードしたソースアーカイブを展開し、ソースフォルダーに移動してください。 +ビルドで使う変数 -```text -> cd c:\Users\%USERNAME%\Downloads\pgroonga-{{ site.pgroonga_version }} -``` + * `%GROONGA_INSTALL_DIR%`はGroongaをインストールするフォルダです。 -`cmake`のビルドオプションを指定します。64bitバージョンのPostgreSQL用にPGroongaをビルドするためのコマンドラインは次の通りです。もし、32bitバージョンのPostgreSQL用にビルドしたい場合は、代わりに`-G "Visual Studio 12 2013"`パラメーターを使ってください。 + * `%POSTGRESQL_INSTALL_FOLDER%`はPostgreSQLをインストールしたフォルダです。 -```text -pgroonga-{{ site.pgroonga_version }}> cmake . -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=%POSTGRESQL_INSTALL_FOLDER% -DGRN_WITH_BUNDLED_LZ4=yes -DGRN_WITH_BUNDLED_MECAB=yes -DGRN_WITH_BUNDLED_MESSAGE_PACK=yes -DGRN_WITH_MRUBY=yes -``` + * インストーラーを使ってPostgreSQLをインストールした場合は`%POSTGRESQL_INSTALL_FOLDER%`は`C:\Program Files\PostgreSQL\%POSTGRESQL_VERSION%`になります。 + + * zipバージョンのPostgreSQLをインストールした場合は`%POSTGRESQL_INSTALL_FOLDER%`は`%PostgreSQLのzipを展開したフォルダー%\pgsql`になります。 -インストーラーを使ってPostgreSQLをインストールした場合は`%POSTGRESQL_INSTALL_FOLDER%`は`C:\Program Files\PostgreSQL\%POSTGRESQL_VERSION%`になります。 +Groongaをビルドしてインストールします。 -zipバージョンのPostgreSQLをインストールした場合は`%POSTGRESQL_INSTALL_FOLDER%`は`%PostgreSQLのzipを展開したフォルダー%\pgsql`になります。 +```text +> cmake -B groonga.build -G Ninja -S groonga-latest -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=%GROONGA_INSTALL_DIR% -DGRN_WITH_MECAB=bundled -DGRN_WITH_MESSAGE_PACK=bundled -DGRN_WITH_MRUBY=yes -DGRN_WITH_RAPIDJSON=bundled -DGRN_WITH_XXHASH=bundled -DGRN_WITH_ZSTD=bundled +> cmake --build groonga.build +> cmake --install groonga.build +``` PGroongaをビルドします。 ```text -pgroonga-{{ site.pgroonga_version }}> cmake --build . --config Release +> meson setup pgroonga.build -S pgroonga-{{ site.pgroonga_version }} --buildtype=release --cmake-prefix-path=%GROONGA_INSTALL_DIR% -Dpg_config=%POSTGRESQL_INSTALL_FOLDER%\bin\pg_config.exe +> meson compile -C pgroonga.build ``` PGroongaをインストールします。管理者権限が必要かもしれません。たとえば、インストーラーを使ってPostgreSQLをインストールした場合は管理者権限が必要でしょう。 ```text -pgroonga-{{ site.pgroonga_version }}> cmake --build . --config Release --target Install +> meson install -C pgroonga.build ``` データベースを作成します。