OBJS = \
conv.o \
- encnames.o \
mbutils.o \
stringinfo_mb.o \
- wchar.o \
wstrcmp.o \
wstrncmp.o
Encodings
=========
-encnames.c: public functions for both the backend and the frontend.
conv.c: static functions and a public table for code conversion
-wchar.c: mostly static functions and a public table for mb string and
- multibyte conversion
mbutils.c: public functions for the backend only.
- requires conv.c and wchar.c
stringinfo_mb.c: public backend-only multibyte-aware stringinfo functions
wstrcmp.c: strcmp for mb
wstrncmp.c: strncmp for mb
iso.c: a tool to generate KOI8 <--> ISO8859-5 conversion table
win1251.c: a tool to generate KOI8 <--> CP1251 conversion table
+See also in src/common/:
+
+encnames.c: public functions for encoding names
+wchar.c: mostly static functions and a public table for mb string and
+ multibyte conversion
+
Introduction
------------
http://www.cprogramming.com/tutorial/unicode.html
-/encnames.c
/localtime.c
/initdb
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS)
-# note: we need libpq only because fe_utils does
+# Note: it's important that we link to encnames.o from libpgcommon, not
+# from libpq, else we have risks of version skew if we run with a libpq
+# shared library from a different PG version. The libpq_pgport macro
+# should ensure that that happens.
+#
+# We need libpq only because fe_utils does.
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
# use system timezone data?
OBJS = \
$(WIN32RES) \
- encnames.o \
findtimezone.o \
initdb.o \
localtime.o
initdb: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
-# We used to pull in all of libpq to get encnames.c, but that
-# exposes us to risks of version skew if we link to a shared library.
-# Do it the hard way, instead, so that we're statically linked.
-
-encnames.c: % : $(top_srcdir)/src/backend/utils/mb/%
- rm -f $@ && $(LN_S) $< .
-
-# Likewise, pull in localtime.c from src/timezones
-
+# We must pull in localtime.c from src/timezones
localtime.c: % : $(top_srcdir)/src/timezone/%
rm -f $@ && $(LN_S) $< .
rm -f '$(DESTDIR)$(bindir)/initdb$(X)'
clean distclean maintainer-clean:
- rm -f initdb$(X) $(OBJS) encnames.c localtime.c
+ rm -f initdb$(X) $(OBJS) localtime.c
rm -rf tmp_check
# ensure that changes in datadir propagate into object file
config_info.o \
controldata_utils.o \
d2s.o \
+ encnames.o \
exec.o \
f2s.o \
file_perm.o \
stringinfo.o \
unicode_norm.o \
username.o \
- wait_error.o
+ wait_error.o \
+ wchar.o
ifeq ($(with_openssl),yes)
OBJS_COMMON += sha2_openssl.o
#include "common/saslprep.h"
#include "common/unicode_norm.h"
-
-/*
- * Note: The functions in this file depend on functions from
- * src/backend/utils/mb/wchar.c, so in order to use this in frontend
- * code, you will need to link that in, too.
- */
#include "mb/pg_wchar.h"
/*
* PostgreSQL encoding identifiers
*
* WARNING: the order of this enum must be same as order of entries
- * in the pg_enc2name_tbl[] array (in mb/encnames.c), and
- * in the pg_wchar_table[] array (in mb/wchar.c)!
+ * in the pg_enc2name_tbl[] array (in src/common/encnames.c), and
+ * in the pg_wchar_table[] array (in src/common/wchar.c)!
*
* If you add some encoding don't forget to check
* PG_ENCODING_BE_LAST macro.
/exports.list
-# .c files that are symlinked in from elsewhere
-/encnames.c
-/wchar.c
pqexpbuffer.o \
fe-auth.o
-# src/backend/utils/mb
-OBJS += \
- encnames.o \
- wchar.o
-
ifeq ($(with_openssl),yes)
OBJS += \
fe-secure-common.o \
backend_src = $(top_srcdir)/src/backend
-# We use a few backend modules verbatim, but since we need
-# to compile with appropriate options to build a shared lib, we can't
-# use the same object files built for the backend.
-# Instead, symlink the source files in here and build our own object files.
-# When you add a file here, remember to add it in the "clean" target below.
-
-encnames.c wchar.c: % : $(backend_src)/utils/mb/%
- rm -f $@ && $(LN_S) $< .
-
-
-# Make dependencies on pg_config_paths.h visible, too.
+# Make dependencies on pg_config_paths.h visible in all builds.
fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h
fe-misc.o: fe-misc.c $(top_builddir)/src/port/pg_config_paths.h
rm -f $(OBJS) pthread.h
# Might be left over from a Win32 client-only build
rm -f pg_config_paths.h
-# Remove files we (may have) symlinked in from other places
- rm -f encnames.c wchar.c
maintainer-clean: distclean
$(MAKE) -C test $@
}
our @pgcommonallfiles = qw(
- base64.c config_info.c controldata_utils.c d2s.c exec.c f2s.c file_perm.c ip.c
+ base64.c config_info.c controldata_utils.c d2s.c encnames.c exec.c
+ f2s.c file_perm.c ip.c
keywords.c kwlookup.c link-canary.c md5.c
pg_lzcompress.c pgfnames.c psprintf.c relpath.c rmtree.c
saslprep.c scram-common.c string.c stringinfo.c unicode_norm.c username.c
- wait_error.c);
+ wait_error.c wchar.c);
if ($solution->{options}->{openssl})
{