summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-10-26 18:28:10 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-10-27 10:46:38 +0300
commit3eab661e77f6c39891e02d46ff826f8ada2ba674 (patch)
tree676166ac304d82f8fb1a2b017f3867124269117b
parentb8b2758db958c83da1704bb302963978c0d823ca (diff)
Auto-generate .map and .def files
-rw-r--r--TODO3
-rw-r--r--libpq/README-DEV4
-rw-r--r--libpq/libpq/.gitignore5
-rw-r--r--libpq/libpq/buildfile30
-rw-r--r--libpq/libpq/libpqdll.def188
-rw-r--r--libpq/libpq/libpqdll.map188
6 files changed, 28 insertions, 390 deletions
diff --git a/TODO b/TODO
index fbf5c47..964ab3c 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,5 @@
On the revision:
-- Make the .map and .def files prerequisites of the libs type target and only
- on the respective OSes. Also try to generate them on the fly.
-
On the release:
Note that this requires bumping build2 version requirement to 0.15.0.
diff --git a/libpq/README-DEV b/libpq/README-DEV
index 0deb09e..0a204c4 100644
--- a/libpq/README-DEV
+++ b/libpq/README-DEV
@@ -68,7 +68,3 @@ $ cat libpq/pg_config.h | \
sort -u >defined-macros
$ diff defined-macros used-macros
-
-Copy upstream's auto-generated src/interfaces/libpq/{exports.list,libpqdll.def}
-to libpq/{libpqdll.map,libpqdll.def} or create them manually based on
-pq/exports.txt. Comment out the "LIBRARY LIBPQ" line in libpqdll.def.
diff --git a/libpq/libpq/.gitignore b/libpq/libpq/.gitignore
index 620b4c8..5db6a52 100644
--- a/libpq/libpq/.gitignore
+++ b/libpq/libpq/.gitignore
@@ -1,3 +1,8 @@
# Generated version.h.
#
version.h
+
+# Generated symbols export files.
+#
+libpqdll.map
+libpqdll.def
diff --git a/libpq/libpq/buildfile b/libpq/libpq/buildfile
index e6608b2..28cd073 100644
--- a/libpq/libpq/buildfile
+++ b/libpq/libpq/buildfile
@@ -1,6 +1,9 @@
# file : libpq/buildfile
# license : PostgreSQL License; see accompanying COPYRIGHT file
+define map: file
+map{*}: extension = map
+
# Note that libz is only used in the backend server.
#
import imp_libs = libssl%lib{ssl}
@@ -8,10 +11,6 @@ import imp_libs += libcrypto%lib{crypto}
# Exclude source code of unused features (authentication methods, etc).
#
-# @@ When it becomes possible (probably with ad hoc rules), generate
-# libpqdll.map and libpqdll.def on the fly from pq/exports.txt applying
-# regex replace to its lines and adding prologue/epilogue.
-#
lib{pq}: {h }{* -version} \
{h }{ version} \
pq/{h c}{* -fe-gssapi-common \
@@ -51,8 +50,25 @@ lib{pq}: port/c{strlcpy}: include = (!$bsd && !$macos)
lib{pq}: pq/{h c}{*win32* } \
port/{h c}{*win32* +getaddrinfo +inet_aton}: include = $windows
-libs{pq}: file{libpqdll.map}: include = ($linux || $bsd ? adhoc : false)
-libs{pq}: def{libpqdll}: include = $windows
+libs{pq}: map{libpqdll}: include = ($linux || $bsd ? adhoc : false)
+libs{pq}: def{libpqdll}: include = $windows
+
+map{libpqdll}: pq/file{exports.txt}
+{{
+ diag gen $>
+ f = $path($>)
+ echo '{ global:' >$f
+ sed -n -e 's/^\s*([^#]\S*)\s+\d+\s*$/\1;/p' $path($<) >>$f
+ echo ' local: *; };' >>$f
+}}
+
+def{libpqdll}: pq/file{exports.txt}
+{{
+ diag gen $>
+ f = $path($>)
+ echo 'EXPORTS' >$f
+ sed -n -e 's/^\s*([^#]\S*)\s+(\d+)\s*$/ \1 @ \2/p' $path($<) >>$f
+}}
# The version file is an internal one (it is only included from pg_config.h)
# so we don't distribute nor install it (see below).
@@ -216,7 +232,7 @@ switch $tclass, $tsys
#
c.loptions += -Wl,--no-undefined
- c.loptions += "-Wl,--version-script=$src_base/libpqdll.map"
+ c.loptions += "-Wl,--version-script=$out_base/libpqdll.map"
c.libs += -lpthread
}
diff --git a/libpq/libpq/libpqdll.def b/libpq/libpq/libpqdll.def
deleted file mode 100644
index 049ca06..0000000
--- a/libpq/libpq/libpqdll.def
+++ /dev/null
@@ -1,188 +0,0 @@
-;LIBRARY LIBPQ
-EXPORTS
- PQconnectdb @ 1
- PQsetdbLogin @ 2
- PQconndefaults @ 3
- PQfinish @ 4
- PQreset @ 5
- PQrequestCancel @ 6
- PQdb @ 7
- PQuser @ 8
- PQpass @ 9
- PQhost @ 10
- PQport @ 11
- PQtty @ 12
- PQoptions @ 13
- PQstatus @ 14
- PQerrorMessage @ 15
- PQsocket @ 16
- PQbackendPID @ 17
- PQtrace @ 18
- PQuntrace @ 19
- PQsetNoticeProcessor @ 20
- PQexec @ 21
- PQnotifies @ 22
- PQsendQuery @ 23
- PQgetResult @ 24
- PQisBusy @ 25
- PQconsumeInput @ 26
- PQgetline @ 27
- PQputline @ 28
- PQgetlineAsync @ 29
- PQputnbytes @ 30
- PQendcopy @ 31
- PQfn @ 32
- PQresultStatus @ 33
- PQntuples @ 34
- PQnfields @ 35
- PQbinaryTuples @ 36
- PQfname @ 37
- PQfnumber @ 38
- PQftype @ 39
- PQfsize @ 40
- PQfmod @ 41
- PQcmdStatus @ 42
- PQoidStatus @ 43
- PQcmdTuples @ 44
- PQgetvalue @ 45
- PQgetlength @ 46
- PQgetisnull @ 47
- PQclear @ 48
- PQmakeEmptyPGresult @ 49
- PQprint @ 50
- PQdisplayTuples @ 51
- PQprintTuples @ 52
- lo_open @ 53
- lo_close @ 54
- lo_read @ 55
- lo_write @ 56
- lo_lseek @ 57
- lo_creat @ 58
- lo_tell @ 59
- lo_unlink @ 60
- lo_import @ 61
- lo_export @ 62
- pgresStatus @ 63
- PQmblen @ 64
- PQresultErrorMessage @ 65
- PQresStatus @ 66
- termPQExpBuffer @ 67
- appendPQExpBufferChar @ 68
- initPQExpBuffer @ 69
- resetPQExpBuffer @ 70
- PQoidValue @ 71
- PQclientEncoding @ 72
- PQenv2encoding @ 73
- appendBinaryPQExpBuffer @ 74
- appendPQExpBufferStr @ 75
- destroyPQExpBuffer @ 76
- createPQExpBuffer @ 77
- PQconninfoFree @ 78
- PQconnectPoll @ 79
- PQconnectStart @ 80
- PQflush @ 81
- PQisnonblocking @ 82
- PQresetPoll @ 83
- PQresetStart @ 84
- PQsetClientEncoding @ 85
- PQsetnonblocking @ 86
- PQfreeNotify @ 87
- PQescapeString @ 88
- PQescapeBytea @ 89
- printfPQExpBuffer @ 90
- appendPQExpBuffer @ 91
- pg_encoding_to_char @ 92
- pg_utf_mblen @ 93
- PQunescapeBytea @ 94
- PQfreemem @ 95
- PQtransactionStatus @ 96
- PQparameterStatus @ 97
- PQprotocolVersion @ 98
- PQsetErrorVerbosity @ 99
- PQsetNoticeReceiver @ 100
- PQexecParams @ 101
- PQsendQueryParams @ 102
- PQputCopyData @ 103
- PQputCopyEnd @ 104
- PQgetCopyData @ 105
- PQresultErrorField @ 106
- PQftable @ 107
- PQftablecol @ 108
- PQfformat @ 109
- PQexecPrepared @ 110
- PQsendQueryPrepared @ 111
- PQdsplen @ 112
- PQserverVersion @ 113
- PQgetssl @ 114
- pg_char_to_encoding @ 115
- pg_valid_server_encoding @ 116
- pqsignal @ 117
- PQprepare @ 118
- PQsendPrepare @ 119
- PQgetCancel @ 120
- PQfreeCancel @ 121
- PQcancel @ 122
- lo_create @ 123
- PQinitSSL @ 124
- PQregisterThreadLock @ 125
- PQescapeStringConn @ 126
- PQescapeByteaConn @ 127
- PQencryptPassword @ 128
- PQisthreadsafe @ 129
- enlargePQExpBuffer @ 130
- PQnparams @ 131
- PQparamtype @ 132
- PQdescribePrepared @ 133
- PQdescribePortal @ 134
- PQsendDescribePrepared @ 135
- PQsendDescribePortal @ 136
- lo_truncate @ 137
- PQconnectionUsedPassword @ 138
- pg_valid_server_encoding_id @ 139
- PQconnectionNeedsPassword @ 140
- lo_import_with_oid @ 141
- PQcopyResult @ 142
- PQsetResultAttrs @ 143
- PQsetvalue @ 144
- PQresultAlloc @ 145
- PQregisterEventProc @ 146
- PQinstanceData @ 147
- PQsetInstanceData @ 148
- PQresultInstanceData @ 149
- PQresultSetInstanceData @ 150
- PQfireResultCreateEvents @ 151
- PQconninfoParse @ 152
- PQinitOpenSSL @ 153
- PQescapeLiteral @ 154
- PQescapeIdentifier @ 155
- PQconnectdbParams @ 156
- PQconnectStartParams @ 157
- PQping @ 158
- PQpingParams @ 159
- PQlibVersion @ 160
- PQsetSingleRowMode @ 161
- lo_lseek64 @ 162
- lo_tell64 @ 163
- lo_truncate64 @ 164
- PQconninfo @ 165
- PQsslInUse @ 166
- PQsslStruct @ 167
- PQsslAttributeNames @ 168
- PQsslAttribute @ 169
- PQsetErrorContextVisibility @ 170
- PQresultVerboseErrorMessage @ 171
- PQencryptPasswordConn @ 172
- PQresultMemorySize @ 173
- PQhostaddr @ 174
- PQgssEncInUse @ 175
- PQgetgssctx @ 176
- PQsetSSLKeyPassHook_OpenSSL @ 177
- PQgetSSLKeyPassHook_OpenSSL @ 178
- PQdefaultSSLKeyPassHook_OpenSSL @ 179
- PQenterPipelineMode @ 180
- PQexitPipelineMode @ 181
- PQpipelineSync @ 182
- PQpipelineStatus @ 183
- PQsetTraceFlags @ 184
- PQmblenBounded @ 185
- PQsendFlushRequest @ 186
diff --git a/libpq/libpq/libpqdll.map b/libpq/libpq/libpqdll.map
deleted file mode 100644
index 4fc401e..0000000
--- a/libpq/libpq/libpqdll.map
+++ /dev/null
@@ -1,188 +0,0 @@
-{ global:
-PQconnectdb;
-PQsetdbLogin;
-PQconndefaults;
-PQfinish;
-PQreset;
-PQrequestCancel;
-PQdb;
-PQuser;
-PQpass;
-PQhost;
-PQport;
-PQtty;
-PQoptions;
-PQstatus;
-PQerrorMessage;
-PQsocket;
-PQbackendPID;
-PQtrace;
-PQuntrace;
-PQsetNoticeProcessor;
-PQexec;
-PQnotifies;
-PQsendQuery;
-PQgetResult;
-PQisBusy;
-PQconsumeInput;
-PQgetline;
-PQputline;
-PQgetlineAsync;
-PQputnbytes;
-PQendcopy;
-PQfn;
-PQresultStatus;
-PQntuples;
-PQnfields;
-PQbinaryTuples;
-PQfname;
-PQfnumber;
-PQftype;
-PQfsize;
-PQfmod;
-PQcmdStatus;
-PQoidStatus;
-PQcmdTuples;
-PQgetvalue;
-PQgetlength;
-PQgetisnull;
-PQclear;
-PQmakeEmptyPGresult;
-PQprint;
-PQdisplayTuples;
-PQprintTuples;
-lo_open;
-lo_close;
-lo_read;
-lo_write;
-lo_lseek;
-lo_creat;
-lo_tell;
-lo_unlink;
-lo_import;
-lo_export;
-pgresStatus;
-PQmblen;
-PQresultErrorMessage;
-PQresStatus;
-termPQExpBuffer;
-appendPQExpBufferChar;
-initPQExpBuffer;
-resetPQExpBuffer;
-PQoidValue;
-PQclientEncoding;
-PQenv2encoding;
-appendBinaryPQExpBuffer;
-appendPQExpBufferStr;
-destroyPQExpBuffer;
-createPQExpBuffer;
-PQconninfoFree;
-PQconnectPoll;
-PQconnectStart;
-PQflush;
-PQisnonblocking;
-PQresetPoll;
-PQresetStart;
-PQsetClientEncoding;
-PQsetnonblocking;
-PQfreeNotify;
-PQescapeString;
-PQescapeBytea;
-printfPQExpBuffer;
-appendPQExpBuffer;
-pg_encoding_to_char;
-pg_utf_mblen;
-PQunescapeBytea;
-PQfreemem;
-PQtransactionStatus;
-PQparameterStatus;
-PQprotocolVersion;
-PQsetErrorVerbosity;
-PQsetNoticeReceiver;
-PQexecParams;
-PQsendQueryParams;
-PQputCopyData;
-PQputCopyEnd;
-PQgetCopyData;
-PQresultErrorField;
-PQftable;
-PQftablecol;
-PQfformat;
-PQexecPrepared;
-PQsendQueryPrepared;
-PQdsplen;
-PQserverVersion;
-PQgetssl;
-pg_char_to_encoding;
-pg_valid_server_encoding;
-pqsignal;
-PQprepare;
-PQsendPrepare;
-PQgetCancel;
-PQfreeCancel;
-PQcancel;
-lo_create;
-PQinitSSL;
-PQregisterThreadLock;
-PQescapeStringConn;
-PQescapeByteaConn;
-PQencryptPassword;
-PQisthreadsafe;
-enlargePQExpBuffer;
-PQnparams;
-PQparamtype;
-PQdescribePrepared;
-PQdescribePortal;
-PQsendDescribePrepared;
-PQsendDescribePortal;
-lo_truncate;
-PQconnectionUsedPassword;
-pg_valid_server_encoding_id;
-PQconnectionNeedsPassword;
-lo_import_with_oid;
-PQcopyResult;
-PQsetResultAttrs;
-PQsetvalue;
-PQresultAlloc;
-PQregisterEventProc;
-PQinstanceData;
-PQsetInstanceData;
-PQresultInstanceData;
-PQresultSetInstanceData;
-PQfireResultCreateEvents;
-PQconninfoParse;
-PQinitOpenSSL;
-PQescapeLiteral;
-PQescapeIdentifier;
-PQconnectdbParams;
-PQconnectStartParams;
-PQping;
-PQpingParams;
-PQlibVersion;
-PQsetSingleRowMode;
-lo_lseek64;
-lo_tell64;
-lo_truncate64;
-PQconninfo;
-PQsslInUse;
-PQsslStruct;
-PQsslAttributeNames;
-PQsslAttribute;
-PQsetErrorContextVisibility;
-PQresultVerboseErrorMessage;
-PQencryptPasswordConn;
-PQresultMemorySize;
-PQhostaddr;
-PQgssEncInUse;
-PQgetgssctx;
-PQsetSSLKeyPassHook_OpenSSL;
-PQgetSSLKeyPassHook_OpenSSL;
-PQdefaultSSLKeyPassHook_OpenSSL;
-PQenterPipelineMode;
-PQexitPipelineMode;
-PQpipelineSync;
-PQpipelineStatus;
-PQsetTraceFlags;
-PQmblenBounded;
-PQsendFlushRequest;
- local: *; };