Skip to content

Commit

Permalink
Appveyor (#27)
Browse files Browse the repository at this point in the history

* use appveyor to create windows dll any tag will create a new release with that tag name the dll will automatically be uploaded to the release. Currently the repo now has msvc.diff in it to allow building, this will have to be kept in sync for appveyor to build. The build environment is Visual C++ 2013
  • Loading branch information
davecramer committed Nov 9, 2017
1 parent f73576a commit b1e6ca5
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 0 deletions.
66 changes: 66 additions & 0 deletions appveyor.yml
@@ -0,0 +1,66 @@
# appveyor.yml


init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
- appveyor downloadfile https://cran.rstudio.com/bin/windows/base/R-3.4.2-win.exe
- R-3.4.2-win.exe /VERYSILENT /dir=C:\R-3.4.2
- git clone https://git.postgresql.org/git/postgresql.git c:\projects\postgresql
- cd c:\projects\postgresql
- git checkout REL_10_0
- mv c:\projects\plr src\pl
- cinst winflexbison
- SET R_HOME=C:\R-3.4.2
- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64'

before_build:
- net user testuser Blurfl9426! /add
- rename c:\ProgramData\chocolatey\bin\win_flex.exe flex.exe
- rename c:\ProgramData\chocolatey\bin\win_bison.exe bison.exe
- cd c:\projects\postgresql
- perl c:\projects\postgresql\src\pl\plr\buildsetup.pl
- dumpbin /EXPORTS C:\R-3.4.2\bin\x64\R.dll > c:\projects\postgresql\src\pl\plr\R.symbols
- tail -n +19 c:\projects\postgresql\src\pl\plr\R.symbols | tr -s ' ' |cut -d ' ' -f 5 > c:\projects\postgresql\src\pl\plr\R.stripped
- cat c:\projects\postgresql\src\pl\plr\header.def c:\projects\postgresql\src\pl\plr\R.stripped > c:\projects\postgresql\src\pl\plr\R.def
- lib /def:c:\projects\postgresql\src\pl\plr\R.def /out:C:\R-3.4.2\bin\x64\R.lib
- SET PATH=%PATH%;C:\R-3.4.2\bin\x64\
- patch -p1 < src\pl\plr\msvc.diff

build_script:
- cd c:\projects\postgresql\src\tools\msvc
- build.bat

configuration:
- Release

test_script:
- SET R_HOME=C:\R-3.2.4
- SET PATH=%PATH%;C:\R-3.2.4\bin\x64
- cd c:\projects\postgresql\src\tools\msvc
- perl install.pl c:\pgsql
- cd c:\pgsql
- bin\initdb -D data
- ps: Start-Process -FilePath .\bin\pg_ctl -ArgumentList "-D data -l logfile start"
- cd c:\projects\postgresql\src\pl\plr
- cp plr.control c:\pgsql\share\extension
- cp plr--8.3.0.17.sql c:\pgsql\share\extension
- mkdir c:\projects\plr
- cp c:\projects\postgresql\Release\plr\plr.dll c:\projects\plr\
- ps: Start-Process -FilePath ..\..\..\Release\pg_regress\pg_regress -ArgumentList "--bindir=c:\pgsql\bin --dbname=pl_regression plr"

deploy:
provider: GitHub
release: $(appveyor_repo_tag_name)
artifact: plr.dll
draft: false
prerelease: false
auth_token:
secure: v+5LgZlgiwCjr45eTclZ2s7YJIvRi+DeRPQO0HWbkCKj8iIjlXEDw27P3jkMrqiD
on:
appveyor_repo_tag: true

artifacts:
- path: '.\plr.dll'
name: plr.dll
39 changes: 39 additions & 0 deletions buildsetup.pl
@@ -0,0 +1,39 @@
# first part of postgres build.pl, just doesn't run msbuild

use strict;

BEGIN
{

chdir("../../..") if (-d "../msvc" && -d "../../../src");

}

use lib "src/tools/msvc";

use Cwd;

use Mkvcbuild;

# buildenv.pl is for specifying the build environment settings
# it should contain lines like:
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";

if (-e "src/tools/msvc/buildenv.pl")
{
do "src/tools/msvc/buildenv.pl";
}
elsif (-e "./buildenv.pl")
{
do "./buildenv.pl";
}

# set up the project
our $config;
do "config_default.pl";
do "config.pl" if (-f "src/tools/msvc/config.pl");

# print "PATH: $_\n" foreach (split(';',$ENV{PATH}));

Mkvcbuild::mkvcbuild($config);

4 changes: 4 additions & 0 deletions header.def
@@ -0,0 +1,4 @@
LIBRARY R

EXPORTS

72 changes: 72 additions & 0 deletions msvc.diff
@@ -0,0 +1,72 @@
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 686c7369f6..31b4dc799c 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -45,7 +45,7 @@ my @contrib_excludes = (
'ltree_plpython', 'pgcrypto',
'sepgsql', 'brin',
'test_extensions', 'test_pg_dump',
- 'snapshot_too_old');
+ 'snapshot_too_old','plr');

# Set of variables for frontend modules
my $frontend_defines = { 'initdb' => 'FRONTEND' };
@@ -454,6 +454,15 @@ sub mkvcbuild
$pgcrypto->AddLibrary('ws2_32.lib');
my $mf = Project::read_file('contrib/pgcrypto/Makefile');
GenerateContribSqlFiles('pgcrypto', $mf);
+ my $plr = $solution->AddProject('plr','dll','plr');
+ $plr->AddFiles(
+ 'src\pl\plr','plr.c','pg_conversion.c','pg_backend_support.c','pg_userfuncs.c','pg_rsupport.c'
+ );
+ $plr->AddReference($postgres);
+ $plr->AddLibrary('C:\R-3.4.2\bin\x64\R.lib');
+ $plr->AddIncludeDir('C:\R-3.4.2\include');
+ my $mfplr = Project::read_file('src/pl/plr/Makefile');
+ GenerateContribSqlFiles('plr', $mfplr);

foreach my $subdir ('contrib', 'src/test/modules')
{
@@ -862,16 +871,16 @@ sub GenerateContribSqlFiles
my $in = "$d.in";
my $out = "$d";

- if (Solution::IsNewer("contrib/$n/$out", "contrib/$n/$in"))
+ if (Solution::IsNewer("src/pl/$n/$out", "src/pl/$n/$in"))
{
- print "Building $out from $in (contrib/$n)...\n";
- my $cont = Project::read_file("contrib/$n/$in");
+ print "Building $out from $in (src/pl/$n)...\n";
+ my $cont = Project::read_file("src/pl/$n/$in");
my $dn = $out;
$dn =~ s/\.sql$//;
$cont =~ s/MODULE_PATHNAME/\$libdir\/$dn/g;
my $o;
- open($o, '>', "contrib/$n/$out")
- || croak "Could not write to contrib/$n/$d";
+ open($o, '>', "src/pl/$n/$out")
+ || croak "Could not write to src/pl/$n/$d";
print $o $cont;
close($o);
}
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 2904679114..99ae40205d 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -248,7 +248,7 @@ sub plcheck
{
chdir "../../pl";

- foreach my $pl (glob("*"))
+ foreach my $pl (glob("plr"))
{
next unless -d "$pl/sql" && -d "$pl/expected";
my $lang = $pl eq 'tcl' ? 'pltcl' : $pl;
@@ -286,6 +286,7 @@ sub plcheck
"../../../$Config/pg_regress/pg_regress",
"--bindir=../../../$Config/psql",
"--dbname=pl_regression", @lang_args, @tests);
+ print join(" ", @args) . "\n";
system(@args);
my $status = $? >> 8;
exit $status if $status;
12 changes: 12 additions & 0 deletions testplr.bat
@@ -0,0 +1,12 @@
cd c:\projects\postgresql\src\tools\msvc
perl install.pl c:\pgsql
pushd c:\pgsql
bin\initdb -D data
bin\pg_ctl -D data -l logfile start
popd
pushd c:\projects\postgresql\src\pl\plr
cp plr.control c:\pgsql\share\extension
cp plr--8.3.0.17.sql c:\pgsql\share\extension
..\..\..\Release\pg_regress\pg_regress --bindir=c:\pgsql\bin --dbname=pl_regression plr


0 comments on commit b1e6ca5

Please sign in to comment.