PGSQL 在 PGDG Repo 裡面已經提供現成的 RPM 可以用了(可以載 https://tds-fdw.github.io/yum/tds_fdw.repo,或其實 PGDG 本身裡面就有提供了),因此不用擔心~
為了準備 EDB 13 的套件,主要是要先準備 EDB 13 編譯環境:因為 EDB 用到 LLVM 5.0 與 CLang 3.9,因此要準備好。先看一下必要套件有哪些:標黃色的 CLang 5 相關套件在 Software Collections 的 Clang and LLVM Toolset 7 取得。而 LLVM 5.0 devel 則在 EPEL Repo 裡面就有了
[root@edbdev ~]# yum install -y edb-as13 [root@edbdev ~]# export PATH=$PATH:/usr/edb/as13/bin/ [root@edbdev ~]# pg_config --configure '--prefix=/usr/edb/as13' '--includedir=/usr/edb/as13/include' '--mandir=/usr/edb/as13/share/man' '--datadir=/usr/edb/as13/share' '--libdir=/usr/edb/as13/lib' '--with-llvm' '--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-openssl' '--with-pam' '--with-krb5' '--with-gssapi' '--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls' '--with-ossp-uuid' '--with-libxml' '--with-libxslt' '--with-ldap' '--with-systemd' '--with-libcurl' '--with-icu' '--with-oci=/usr/include/oracle/10.2.0.5/client64' '--with-system-tzdata=/usr/share/zoneinfo' '--sysconfdir=/etc/sysconfig/edb/as13' '--docdir=/usr/share/doc' '--with-pgport=5444' 'CFLAGS=-I/usr/libexec/edb-as13-icu66.1/include/ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et' 'LDFLAGS=-L/usr/libexec/edb-as13-icu66.1/lib/ ' 'CPPFLAGS= -I/usr/include/et' 'CXXFLAGS= -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' 'LLVM_CONFIG=/usr/lib64/llvm5.0/bin/llvm-config' 'CLANG=/opt/rh/llvm-toolset-7/root/usr/bin/clang' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' 'ICU_CFLAGS=-I/usr/libexec/edb-as13-icu66.1/include/' 'ICU_LIBS=-Wl,-rpath,/usr/libexec/edb-as13-icu66.1/lib -L/usr/libexec/edb-as13-icu66.1/lib -licui18n -licuuc -licudata' 'PYTHON=/usr/bin/python2' [root@edbdev ~]#
開始來處理相依套件:其中裝了 RPM Build 工具,是等下要用的,以及 pgdg-srpm-macros 是打包 PGSQL RPM 的預設 rpmbuild 變數。
[root@edbdev ~]# yum group install -y "Development Tools" [root@edbdev ~]# yum install -y epel-release centos-release-scl edb-as13-server-devel [root@edbdev ~]# yum install -y llvm5.0-devel [root@edbdev ~]# yum install -y llvm-toolset-7 [root@edbdev ~]# yum install -y rpm-build rpmdevtools [root@edbdev ~]# yum install https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-7.0-x86_64/pgdg-srpm-macros-1.0.10-1.rhel7.x86_64.rpm [root@edbdev ~]#
[root@edbdev ~]# rpm -ql pgdg-srpm-macros /usr/lib/rpm/macros.d/macros.pgdg-postgresql /usr/share/doc/pgdg-srpm-macros-1.0.10 /usr/share/doc/pgdg-srpm-macros-1.0.10/AUTHORS /usr/share/licenses/pgdg-srpm-macros-1.0.10 /usr/share/licenses/pgdg-srpm-macros-1.0.10/COPYRIGHT [root@edbdev ~]#
然後裝 freetds
[root@edbdev ~]# yum install -y freetds freetds-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: free.nchc.org.tw * centos-sclo-rh: free.nchc.org.tw * centos-sclo-sclo: free.nchc.org.tw * epel: ftp.jaist.ac.jp * extras: free.nchc.org.tw * updates: free.nchc.org.tw Resolving Dependencies --> Running transaction check ---> Package freetds.x86_64 0:1.1.20-1.el7 will be installed --> Processing Dependency: freetds-libs(x86-64) = 1.1.20-1.el7 for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libodbc.so.2()(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libsybdb.so.5()(64bit) for package: freetds-1.1.20-1.el7.x86_64 ---> Package freetds-devel.x86_64 0:1.1.20-1.el7 will be installed --> Running transaction check ---> Package freetds-libs.x86_64 0:1.1.20-1.el7 will be installed ---> Package unixODBC.x86_64 0:2.3.1-14.el7 will be installed --> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-14.el7.x86_64 --> Running transaction check ---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================== Package Arch Version Repository Size ============================================================================================== Installing: freetds x86_64 1.1.20-1.el7 epel 396 k freetds-devel x86_64 1.1.20-1.el7 epel 43 k Installing for dependencies: freetds-libs x86_64 1.1.20-1.el7 epel 368 k libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k unixODBC x86_64 2.3.1-14.el7 base 413 k Transaction Summary ============================================================================================== Install 2 Packages (+3 Dependent packages) Total download size: 1.2 M Installed size: 4.1 M Downloading packages: (1/5): freetds-devel-1.1.20-1.el7.x86_64.rpm | 43 kB 00:00:00 (2/5): freetds-1.1.20-1.el7.x86_64.rpm | 396 kB 00:00:00 (3/5): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm | 49 kB 00:00:00 (4/5): unixODBC-2.3.1-14.el7.x86_64.rpm | 413 kB 00:00:00 (5/5): freetds-libs-1.1.20-1.el7.x86_64.rpm | 368 kB 00:00:00 ---------------------------------------------------------------------------------------------- Total 1.3 MB/s | 1.2 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 1/5 Installing : unixODBC-2.3.1-14.el7.x86_64 2/5 Installing : freetds-libs-1.1.20-1.el7.x86_64 3/5 Installing : freetds-1.1.20-1.el7.x86_64 4/5 Installing : freetds-devel-1.1.20-1.el7.x86_64 5/5 Verifying : freetds-devel-1.1.20-1.el7.x86_64 1/5 Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 2/5 Verifying : freetds-libs-1.1.20-1.el7.x86_64 3/5 Verifying : unixODBC-2.3.1-14.el7.x86_64 4/5 Verifying : freetds-1.1.20-1.el7.x86_64 5/5 Installed: freetds.x86_64 0:1.1.20-1.el7 freetds-devel.x86_64 0:1.1.20-1.el7 Dependency Installed: freetds-libs.x86_64 0:1.1.20-1.el7 libtool-ltdl.x86_64 0:2.4.2-22.el7_3 unixODBC.x86_64 0:2.3.1-14.el7 Complete! [root@edbdev ~]#
為了仿照 PGDG 打包 RPM 檔,這邊從 https://download.postgresql.org/pub/repos/yum/srpms/ 下載 tds_fdw13-2.0.2-1.rhel7.src.rpm 來用,倒也不是從 GitHub 抓原始碼來用
[root@edbdev ~]# wget https://download.postgresql.org/pub/repos/yum/srpms/13/redhat/rhel-7-x86_64/tds_fdw13-2.0.2-1.rhel7.src.rpm [root@edbdev ~]# [root@edbdev ~]# rpm -ivh tds_fdw13-2.0.2-1.rhel7.src.rpm warning: tds_fdw13-2.0.2-1.rhel7.src.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY Updating / installing... 1:tds_fdw13-2.0.2-1.rhel7 ################################# [100%] warning: user postgres does not exist - using root warning: group postgres does not exist - using root warning: user postgres does not exist - using root warning: group postgres does not exist - using root warning: user postgres does not exist - using root warning: group postgres does not exist - using root [root@edbdev ~]#
看一下套件建立目錄,以及 pg_config 內容,就準備開始編譯了
[root@edbdev ~]# tree ~/rpmbuild/ /root/rpmbuild/ |-- SOURCES | |-- tds_fdw-pg13-makefile-pgxs.patch | `-- v2.0.2.zip `-- SPECS `-- tds_fdw.spec 2 directories, 3 files [root@edbdev ~]# [root@edbdev ~]# export PATH=$PATH:/usr/edb/as13/bin/ [root@edbdev ~]# pg_config --pgxs /usr/edb/as13/lib/pgxs/src/makefiles/pgxs.mk [root@edbdev ~]#
[root@edbdev ~]# export PATH=$PATH:/usr/edb/as13/bin/ [root@edbdev ~]# rpmbuild -ba ~/rpmbuild/SPECS/tds_fdw.spec error: Bad source: /root/rpmbuild/SOURCES/tds_fdw-pg%{pgmajorversion}-makefile-pgxs.patch: No such file or directory [root@edbdev ~]#
看起來。。。要改一下 spec 檔裡面相關的 DB 版本名稱與資訊。。
[root@edbdev ~]# rpm -qa | grep as13 edb-as13-server-libs-13.1.4-1.rhel7.x86_64 edb-as13-server-devel-13.1.4-1.rhel7.x86_64 edb-as13-server-plperl-13.1.4-1.rhel7.x86_64 edb-as13-server-indexadvisor-13.1.4-1.rhel7.x86_64 edb-as13-server-plpython3-13.1.4-1.rhel7.x86_64 edb-as13-server-client-13.1.4-1.rhel7.x86_64 edb-as13-server-contrib-13.1.4-1.rhel7.x86_64 edb-as13-server-parallel-clone-1.8-1.rhel7.x86_64 edb-as13-server-sqlprofiler-4.0-1.rhel7.x86_64 edb-as13-server-pltcl-13.1.4-1.rhel7.x86_64 edb-as13-server-docs-13.1.4-1.rhel7.x86_64 edb-as13-server-sqlprotect-13.1.4-1.rhel7.x86_64 edb-as13-server-sslutils-1.3-1.rhel7.x86_64 edb-as13-server-13.1.4-1.rhel7.x86_64 edb-as13-server-llvmjit-13.1.4-1.rhel7.x86_64 edb-as13-server-core-13.1.4-1.rhel7.x86_64 edb-as13-server-pldebugger-1.1-1.rhel7.x86_64 edb-as13-server-edb-modules-1.0-1.rhel7.x86_64 edb-as13-server-cloneschema-1.14-1.rhel7.x86_64 [root@edbdev ~]# [root@edbdev ~]# grep pgmajorversion ~/rpmbuild/SPECS/tds_fdw.spec Name: %{sname}%{pgmajorversion} Patch0: %{sname}-pg%{pgmajorversion}-makefile-pgxs.patch BuildRequires: postgresql%{pgmajorversion}-devel, freetds-devel pgdg-srpm-macros Requires: postgresql%{pgmajorversion}-server, freetds %if %{pgmajorversion} >= 11 && %{pgmajorversion} < 90 [root@edbdev ~]# [root@edbdev ~]# grep '%doc' ~/rpmbuild/SPECS/tds_fdw.spec %doc %{pginstdir}/doc/extension/*%{sname}.md [root@edbdev ~]#
[root@edbdev ~]# ## 用 vi 偷編輯一下..再呈現異動內容 [root@edbdev ~]# vi ~/rpmbuild/SPECS/tds_fdw.spec [root@edbdev ~]# [root@edbdev ~]# ##調整套件名稱 [root@edbdev ~]# grep pgmajorversion ~/rpmbuild/SPECS/tds_fdw.spec Name: edb-as%{pgmajorversion}-server-%{sname} Patch0: %{sname}-pg%{pgmajorversion}-makefile-pgxs.patch BuildRequires: edb-as%{pgmajorversion}-server-devel, freetds-devel pgdg-srpm-macros Requires: edb-as%{pgmajorversion}-server, freetds %if %{pgmajorversion} >= 11 && %{pgmajorversion} < 90 [root@edbdev ~]# [root@edbdev ~]# ##調整 doc 目錄 [root@edbdev ~]# grep install ~/rpmbuild/SPECS/tds_fdw.spec %install %{__make} DESTDIR=%{buildroot} USE_PGXS=1 %{?_smp_mflags} install # Install README and howto file under PostgreSQL installation directory: %{__install} -d %{buildroot}%{pginstdir}/share/extension %{__install} -d %{buildroot}%{pginstdir}/share/doc/extension %{__install} -m 644 ForeignSchemaImporting.md %{buildroot}%{pginstdir}/share/doc/extension/ForeignSchemaImporting-%{sname}.md %{__install} -m 644 ForeignServerCreation.md %{buildroot}%{pginstdir}/share/doc/extension/ForeignServerCreation-%{sname}.md %{__install} -m 644 ForeignTableCreation.md %{buildroot}%{pginstdir}/share/doc/extension/ForeignTableCreation-%{sname}.md %{__install} -m 644 UserMappingCreation.md %{buildroot}%{pginstdir}/share/doc/extension/UserMappingCreation-%{sname}.md %{__install} -m 644 Variables.md %{buildroot}%{pginstdir}/share/doc/extension/Variables-%{sname}.md %{__install} -m 644 README.md %{buildroot}%{pginstdir}/share/doc/extension/README-%{sname}.md [root@edbdev ~]# [root@edbdev ~]# ##調整 doc 位置 [root@edbdev ~]# grep 'doc' ~/rpmbuild/SPECS/tds_fdw.spec %{__install} -m 644 ForeignSchemaImporting.md %{buildroot}%{pginstdir}/share/doc/extension/ForeignSchemaImporting-%{sname}.md %{__install} -m 644 ForeignServerCreation.md %{buildroot}%{pginstdir}/share/doc/extension/ForeignServerCreation-%{sname}.md %{__install} -m 644 ForeignTableCreation.md %{buildroot}%{pginstdir}/share/doc/extension/ForeignTableCreation-%{sname}.md %{__install} -m 644 UserMappingCreation.md %{buildroot}%{pginstdir}/share/doc/extension/UserMappingCreation-%{sname}.md %{__install} -m 644 Variables.md %{buildroot}%{pginstdir}/share/doc/extension/Variables-%{sname}.md %{__install} -m 644 README.md %{buildroot}%{pginstdir}/share/doc/extension/README-%{sname}.md %{__rm} -f %{buildroot}/%{pginstdir}/share/doc/extension/README.%{sname}.md # Remove Extra README file from /usr/share/doc %{__rm} -f %{buildroot}/usr/share/doc/extension/README.tds_fdw.md %doc %{pginstdir}/share/doc/extension/*%{sname}.md [root@edbdev ~]# [root@edbdev ~]# [root@edbdev ~]# [root@edbdev ~]# grep PG_CONFIG ~/rpmbuild/SOURCES/tds_fdw-pg13-makefile-pgxs.patch -PG_CONFIG = pg_config +PG_CONFIG = /usr/pgsql-13/bin/pg_config [root@edbdev ~]# [root@edbdev ~]# sed -e "s@pgsql-13@edb/as13@g" -i ~/rpmbuild/SOURCES/tds_fdw-pg13-makefile-pgxs.patch [root@edbdev ~]# [root@edbdev ~]# grep PG_CONFIG ~/rpmbuild/SOURCES/tds_fdw-pg13-makefile-pgxs.patch -PG_CONFIG = pg_config +PG_CONFIG = /usr/edb/as13/bin/pg_config [root@edbdev ~]#
[root@edbdev ~]# scl enable llvm-toolset-7 bash
[root@edbdev ~]# export PATH=$PATH:/usr/edb/as13/bin/
[root@edbdev ~]# rpmbuild --define='%pgmajorversion 13' --define='pginstdir /usr/edb/as%{pgmajorversion}' -bb ~/rpmbuild/SPECS/tds_fdw.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.6RYZjQ
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf tds_fdw-2.0.2
+ /usr/bin/unzip -qq /root/rpmbuild/SOURCES/v2.0.2.zip
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd tds_fdw-2.0.2
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (tds_fdw-pg13-makefile-pgxs.patch):'
Patch #0 (tds_fdw-pg13-makefile-pgxs.patch):
+ /usr/bin/cat /root/rpmbuild/SOURCES/tds_fdw-pg13-makefile-pgxs.patch
+ /usr/bin/patch -p0 --fuzz=0
patching file Makefile
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.egvilw
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd tds_fdw-2.0.2
+ /usr/bin/make USE_PGXS=1 -j4
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I/usr/libexec/edb-as13-icu66.1/include/ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et -fPIC -I./include/ -fvisibility=hidden -I. -I./ -I/usr/edb/as13/include/server -I/usr/edb/as13/include/internal -I/usr/libexec/edb-as13-icu66.1/include/ -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/tds_fdw.o src/tds_fdw.c
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I/usr/libexec/edb-as13-icu66.1/include/ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et -fPIC -I./include/ -fvisibility=hidden -I. -I./ -I/usr/edb/as13/include/server -I/usr/edb/as13/include/internal -I/usr/libexec/edb-as13-icu66.1/include/ -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/options.o src/options.c
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I/usr/libexec/edb-as13-icu66.1/include/ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et -fPIC -I./include/ -fvisibility=hidden -I. -I./ -I/usr/edb/as13/include/server -I/usr/edb/as13/include/internal -I/usr/libexec/edb-as13-icu66.1/include/ -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o src/deparse.o src/deparse.c
cp sql/tds_fdw.sql sql/tds_fdw--2.0.2.sql
cp README.md README.tds_fdw.md
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I./include/ -fvisibility=hidden -I. -I./ -I/usr/edb/as13/include/server -I/usr/edb/as13/include/internal -I/usr/libexec/edb-as13-icu66.1/include/ -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/tds_fdw.bc src/tds_fdw.c
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I./include/ -fvisibility=hidden -I. -I./ -I/usr/edb/as13/include/server -I/usr/edb/as13/include/internal -I/usr/libexec/edb-as13-icu66.1/include/ -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/options.bc src/options.c
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I./include/ -fvisibility=hidden -I. -I./ -I/usr/edb/as13/include/server -I/usr/edb/as13/include/internal -I/usr/libexec/edb-as13-icu66.1/include/ -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/deparse.bc src/deparse.c
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I/usr/libexec/edb-as13-icu66.1/include/ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et -fPIC -shared -o tds_fdw.so src/tds_fdw.o src/options.o src/deparse.o -L/usr/edb/as13/lib -L/usr/libexec/edb-as13-icu66.1/lib/ -L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/edb/as13/lib',--enable-new-dtags -lsybdb
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Yj5ITg
+ umask 022
+ cd /root/rpmbuild/BUILD
+ '[' /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 '!=' / ']'
+ rm -rf /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
++ dirname /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT
+ mkdir /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
+ cd tds_fdw-2.0.2
+ /usr/bin/rm -rf /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
+ /usr/bin/make DESTDIR=/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 USE_PGXS=1 -j4 install
/bin/mkdir -p '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib'
/bin/mkdir -p '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/extension'
/bin/install -c -m 755 tds_fdw.so '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/tds_fdw.so'
/bin/mkdir -p '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/extension'
/bin/mkdir -p '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/share/doc/extension'
/bin/install -c -m 644 .//tds_fdw.control '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/extension/'
/bin/install -c -m 644 .//sql/tds_fdw--2.0.2.sql '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/extension/'
/bin/install -c -m 644 .//README.tds_fdw.md '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/share/doc/extension/'
/bin/mkdir -p '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/bitcode/tds_fdw'
/bin/mkdir -p '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/bitcode'/tds_fdw/src/
/bin/install -c -m 644 src/tds_fdw.bc '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/bitcode'/tds_fdw/src/
/bin/install -c -m 644 src/options.bc '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/bitcode'/tds_fdw/src/
/bin/install -c -m 644 src/deparse.bc '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/bitcode'/tds_fdw/src/
cd '/root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/bitcode' && /usr/lib64/llvm5.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o tds_fdw.index.bc tds_fdw/src/tds_fdw.bc tds_fdw/src/options.bc tds_fdw/src/deparse.bc
+ /usr/bin/install -d /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/extension
+ /usr/bin/install -d /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension
+ /usr/bin/install -m 644 ForeignSchemaImporting.md /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension/ForeignSchemaImporting-tds_fdw.md
+ /usr/bin/install -m 644 ForeignServerCreation.md /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension/ForeignServerCreation-tds_fdw.md
+ /usr/bin/install -m 644 ForeignTableCreation.md /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension/ForeignTableCreation-tds_fdw.md
+ /usr/bin/install -m 644 UserMappingCreation.md /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension/UserMappingCreation-tds_fdw.md
+ /usr/bin/install -m 644 Variables.md /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension/Variables-tds_fdw.md
+ /usr/bin/install -m 644 README.md /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/share/doc/extension/README-tds_fdw.md
+ /usr/bin/rm -f /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64//usr/edb/as13/share/doc/extension/README.tds_fdw.md
+ /usr/bin/rm -f /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/share/doc/extension/README.tds_fdw.md
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /root/rpmbuild/BUILD/tds_fdw-2.0.2
extracting debug info from /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64/usr/edb/as13/lib/tds_fdw.so
dwz: Too few files for multifile optimization
/usr/lib/rpm/sepdebugcrcfix: Updated 1 CRC32s, 0 CRC32s did match.
385 blocks
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
Provides: edb-as13-server-tds_fdw = 2.0.2-1.el7 edb-as13-server-tds_fdw(x86-64) = 2.0.2-1.el7
Requires(interp): /sbin/ldconfig /sbin/ldconfig
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libsybdb.so.5()(64bit) rtld(GNU_HASH)
Processing files: edb-as13-server-tds_fdw-debuginfo-2.0.2-1.el7.x86_64
Provides: edb-as13-server-tds_fdw-debuginfo = 2.0.2-1.el7 edb-as13-server-tds_fdw-debuginfo(x86-64) = 2.0.2-1.el7
Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
Wrote: /root/rpmbuild/RPMS/x86_64/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/edb-as13-server-tds_fdw-debuginfo-2.0.2-1.el7.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.4ib6eC
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd tds_fdw-2.0.2
+ /usr/bin/rm -rf /root/rpmbuild/BUILDROOT/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64
+ exit 0
[root@edbdev ~]#
[root@edbdev ~]# ls ~/rpmbuild/RPMS/x86_64/ edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm edb-as13-server-tds_fdw-debuginfo-2.0.2-1.el7.x86_64.rpm [root@edbdev ~]#
編譯完成。。
取出來安裝
user@lxdlab:~$ lxc file pull edbdev/root/rpmbuild/RPMS/x86_64/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm ~ user@lxdlab:~$ lxc file push ~/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm edb13/root/ omniware@lxdlab:~$
[root@edb13 ~]# yum install -y ~/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm Loaded plugins: fastestmirror Examining /root/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm: edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 Marking /root/edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package edb-as13-server-tds_fdw.x86_64 0:2.0.2-1.el7 will be installed --> Processing Dependency: freetds for package: edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 Loading mirror speeds from cached hostfile epel/x86_64/metalink | 5.9 kB 00:00:00 * base: ftp.tc.edu.tw * epel: ftp.jaist.ac.jp * extras: ftp.tc.edu.tw * updates: ftp.tc.edu.tw base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 local-edb | 2.5 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/2): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (2/2): epel/x86_64/primary_db | 6.9 MB 00:00:01 --> Processing Dependency: libsybdb.so.5()(64bit) for package: edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 --> Running transaction check ---> Package freetds.x86_64 0:1.1.20-1.el7 will be installed --> Processing Dependency: libgnutls.so.28(GNUTLS_1_4)(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28(GNUTLS_2_10)(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28(GNUTLS_2_12)(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28(GNUTLS_3_0_0)(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28()(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libhogweed.so.2()(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libnettle.so.4()(64bit) for package: freetds-1.1.20-1.el7.x86_64 --> Processing Dependency: libodbc.so.2()(64bit) for package: freetds-1.1.20-1.el7.x86_64 ---> Package freetds-libs.x86_64 0:1.1.20-1.el7 will be installed --> Running transaction check ---> Package gnutls.x86_64 0:3.3.29-9.el7_6 will be installed --> Processing Dependency: trousers >= 0.3.11.2 for package: gnutls-3.3.29-9.el7_6.x86_64 ---> Package nettle.x86_64 0:2.7.1-8.el7 will be installed ---> Package unixODBC.x86_64 0:2.3.1-14.el7 will be installed --> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-14.el7.x86_64 --> Running transaction check ---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed ---> Package trousers.x86_64 0:0.3.14-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================== Package Arch Version Repository Size ============================================================================================== Installing: edb-as13-server-tds_fdw x86_64 2.0.2-1.el7 /edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 250 k Installing for dependencies: freetds x86_64 1.1.20-1.el7 epel 396 k freetds-libs x86_64 1.1.20-1.el7 epel 368 k gnutls x86_64 3.3.29-9.el7_6 base 680 k libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k nettle x86_64 2.7.1-8.el7 base 327 k trousers x86_64 0.3.14-2.el7 base 289 k unixODBC x86_64 2.3.1-14.el7 base 413 k Transaction Summary ============================================================================================== Install 1 Package (+7 Dependent packages) Total size: 2.7 M Total download size: 2.5 M Installed size: 7.8 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : nettle-2.7.1-8.el7.x86_64 1/8 Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 2/8 Installing : unixODBC-2.3.1-14.el7.x86_64 3/8 Installing : trousers-0.3.14-2.el7.x86_64 4/8 Installing : gnutls-3.3.29-9.el7_6.x86_64 5/8 Installing : freetds-libs-1.1.20-1.el7.x86_64 6/8 Installing : freetds-1.1.20-1.el7.x86_64 7/8 Installing : edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 8/8 Verifying : trousers-0.3.14-2.el7.x86_64 1/8 Verifying : freetds-libs-1.1.20-1.el7.x86_64 2/8 Verifying : edb-as13-server-tds_fdw-2.0.2-1.el7.x86_64 3/8 Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 4/8 Verifying : unixODBC-2.3.1-14.el7.x86_64 5/8 Verifying : nettle-2.7.1-8.el7.x86_64 6/8 Verifying : gnutls-3.3.29-9.el7_6.x86_64 7/8 Verifying : freetds-1.1.20-1.el7.x86_64 8/8 Installed: edb-as13-server-tds_fdw.x86_64 0:2.0.2-1.el7 Dependency Installed: freetds.x86_64 0:1.1.20-1.el7 freetds-libs.x86_64 0:1.1.20-1.el7 gnutls.x86_64 0:3.3.29-9.el7_6 libtool-ltdl.x86_64 0:2.4.2-22.el7_3 nettle.x86_64 0:2.7.1-8.el7 trousers.x86_64 0:0.3.14-2.el7 unixODBC.x86_64 0:2.3.1-14.el7 Complete! [root@edb13 ~]# [root@edb13 ~]# service edb-as-13 restart Redirecting to /bin/systemctl restart edb-as-13.service [root@edb13 ~]# [root@edb13 ~]# echo "10.18.0.80 mssqlsvrxe" >> /etc/hosts [root@edb13 ~]# [root@edb13 ~]# su - enterprisedb -bash-4.2$ psql -d edb psql (13.1.4, server 13.1.4) Type "help" for help. edb=# edb=# create extension tds_fdw ; CREATE EXTENSION edb=#
edb=# CREATE SERVER mssql_svr FOREIGN DATA WRAPPER tds_fdw OPTIONS (servername 'mssqlsvrxe', port '1433', database 'master' ); CREATE SERVER edb=# edb=# CREATE USER MAPPING FOR PUBLIC SERVER mssql_svr OPTIONS (username 'sa', password 'SQLS1rv1r'); CREATE USER MAPPING edb=# edb=# IMPORT FOREIGN SCHEMA dbo FROM SERVER mssql_svr INTO public OPTIONS (import_default 'false'); IMPORT FOREIGN SCHEMA edb=# edb=# \dE testms List of relations Schema | Name | Type | Owner --------+--------+---------------+-------------- public | testms | foreign table | enterprisedb (1 row) edb=# edb=# select * from testms ; NOTICE: tds_fdw: Query executed correctly NOTICE: tds_fdw: Getting results id | txt ----+-------- 1 | hi, ms (1 row) edb=#
測通成功~
https://github.com/theory/postgres-xc-rpm/blob/master/SOURCES/postgresxc.init
https://github.com/2ndquadrant-it/pgespresso/blob/master/rpm/pgespresso.spec
https://stackoverflow.com/questions/33936476/create-global-variable-or-variable-user-group-rpm
rpmbuild default global variable - Google 搜尋
https://sysadmincrumbs.readthedocs.io/en/latest/rpmbuild/RPMBUILD/
https://fedoraproject.org/wiki/How_to_create_an_RPM_package/zh-tw
沒有留言:
張貼留言