postgresql/src/backend/utils/mb/conversion_procs
Peter Eisentraut 721856ff24 Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation.  We have done this consistent with established
practice at the time to not require these tools for building from a
tarball.  Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.

Now this has at least two problems:

One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball.  This is pretty
complicated, but it works so far for autoconf/make.  It does not
currently work for meson; you can currently only build with meson from
a git checkout.  Making meson builds work from a tarball seems very
difficult or impossible.  One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree.  So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree.  So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.

Second, there is increased interest nowadays in precisely tracking the
origin of software.  We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs.  But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.

The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball.  The tarball now only contains
what is in the git tree (*).  Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant.  And of course we
want to get the meson build system working universally.

This commit removes the make distprep target altogether.  The make
dist target continues to do its job, it just doesn't call distprep
anymore.

(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep.  This is unchanged for now.

The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep.  (In practice, it is probably obsolete given
that git clean is available.)

The following programs are now hard build requirements in configure
(they were already required by meson.build):

- bison
- flex
- perl

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 15:18:04 +01:00
..
cyrillic_and_mic Update copyright for 2023 2023-01-02 15:00:37 -05:00
euc2004_sjis2004 Update copyright for 2023 2023-01-02 15:00:37 -05:00
euc_cn_and_mic Update copyright for 2023 2023-01-02 15:00:37 -05:00
euc_jp_and_sjis Update copyright for 2023 2023-01-02 15:00:37 -05:00
euc_kr_and_mic Update copyright for 2023 2023-01-02 15:00:37 -05:00
euc_tw_and_big5 Update copyright for 2023 2023-01-02 15:00:37 -05:00
latin2_and_win1250 Update copyright for 2023 2023-01-02 15:00:37 -05:00
latin_and_mic Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_big5 Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_cyrillic Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_euc2004 Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_euc_cn Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_euc_jp Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_euc_kr Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_euc_tw Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_gb18030 Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_gbk Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_iso8859 Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_iso8859_1 Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_johab Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_sjis Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_sjis2004 Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_uhc Update copyright for 2023 2023-01-02 15:00:37 -05:00
utf8_and_win Update copyright for 2023 2023-01-02 15:00:37 -05:00
Makefile Update copyright for 2023 2023-01-02 15:00:37 -05:00
README.euc_jp Fix description how to create conversion function. 2007-04-15 10:49:26 +00:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
proc.mk Remove distprep 2023-11-06 15:18:04 +01:00

README.euc_jp

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

新しいエンコーディング変換関数の追加方法

	2006/04/15 Tatsuo Ishii

はじめに

PostgreSQLにはデータベースとフロントエンドのエンコーディングが異なる
ときに,自動的にエンコーディングの変換を行う機能があります.このディレ
クトリには,そのときに使われる関数が登録されています.これらの関数はユー
ザ定義C関数としてinitdbの中で登録されます具体的には
/usr/local/pgsql/share/conversion_create.sql の中で登録されます(このファ
イルはこのディレクトリでmakeしたときに自動生成されます)

またこれらの関数はconvert()関数からも呼び出されることもあります.

このREADMEではC関数を定義する方法とそれをMakefileなどに追加する方
法を説明します.

o C関数の呼び出し形式

  エンコーディング変換関数の呼び出し形式は次のようになります.

  conv_proc(
	INTEGER,	-- source encoding id
	INTEGER,	-- destination encoding id
	CSTRING,	-- source string (null terminated C string)
	INTERNAL,	-- destination string (null terminated C string)
	INTEGER		-- source string length
  ) returns VOID;

  唯一の出力引数は4番目のdestination stringですユーザ定義関数は必要
  なメモリをpallocしそこに変換結果をNULLターミネートされたC文字列と
  して出力しなければなりません.また,適切な大きさのメモリを確保するの
  はこのC関数の責任ですというのは一般に変換された文字列の長さは
  ソース文字列の長さ(5番目の引数で指定されます単位はNULLターミネート
  を含まないバイト数です)とは一致しないからです.

  エンコーディングIDはinclude/mb/pg_wchar.hのtypedef enum pg_encで定義
  されています.

o 関数の登録とコンパイル

  作ったC関数はサブディレクトリを作りその中に納めますその中に
  Makefileも必要になりますが他のディレクトリにあるMakefileを参考にす
  れば簡単に作成できるでしょう.

  次にメインのMakefile(このファイルが置いてある同じディレクトリにあり
  ます)に関数に関する記述を追加します.

  (1) DIRS=の後にサブディレクトリ名を追加します.

  (2) @set \ で始まる項目に記述を追加します1関数につき1行の追加が必要
    です.

    コンバージョンの名前
    ソースエンコーディング名
    デスティネーションエンコーディング名
    関数名
    オブジェクトファイル名

    を1行の中にスペースで区切って追加します

o テスト

  以上が終わったらこのファイルがあるディレクトリでmakeしすべてがう
  まくいくことを確認します特にcreate_conversion.sqlがちゃんとした
  内容になっているかどうか確認しましょう.良さそうだったら,テスト用に
  新しいデータベースを作り,そこでこのスクリプトを実行します.

  $ psql -e -f create_conversion.sql test

  これも正常だったら最後にregression test suiteにテスト項目を追加し
  てください具体的にはsrc/test/regress/sql/conversion.sqlに追加し
  regression testを行います

o 注意事項

  デフォルトのエンコーディング変換として使用できるためには,ソースエン
  コーディングとデスティネーションエンコーディングの間で双方向の変換が
  できることが必要ですすなわちあるエンコーディングのペアに付き2
  個の関数の作成が必要です.これらの関数は別々のサブディレクトリに登録
  しても良いですが通常は一つのソースファイル中に2個の関数を書くこと
  が多いでしょう.