Skip to content

Commit

Permalink
Merge pull request #192 from pmienk/version3
Browse files Browse the repository at this point in the history
Update to maintain libbitcoin project in libbitcoin-system repository.
  • Loading branch information
evoskuil authored Jan 5, 2019
2 parents 8938d28 + d51b0d6 commit 0a8dc44
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 67 deletions.
4 changes: 2 additions & 2 deletions generate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- Copyright (c) 2014-2016 libbitcoin developers (see COPYING). -->
<generate language="en-us" >

<repository name="libbitcoin" version="3.4.0" email="[email protected]" >
<repository name="libbitcoin" version="3.4.0" email="[email protected]" path="libbitcoin-system" >

<package library="bitcoin" description="Bitcoin Cross-Platform C++ Development Toolkit" url="https://github.com/libbitcoin/libbitcoin" >
<package library="bitcoin" description="Bitcoin Cross-Platform C++ Development Toolkit" url="https://github.com/libbitcoin/libbitcoin-system" >
<flag value="@icu@" />
<flag value="@png@" />
<flag value="@qrencode@" />
Expand Down
47 changes: 26 additions & 21 deletions gsl.copy_properties.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ pushd %~dp0

.endmacro emit_initialize
.
.macro emit_import_copy_project(output, repository_name, import_name, vs_version)
. define my.msvc_path = "$(my.output)\\$(my.repository_name)\\builds\\msvc\\$(my.vs_version)"
.macro emit_import_copy_project(repository, output, import_name, vs_version)
. define my.repository = emit_import_copy_project.repository
. define my.msvc_path = "$(my.output)\\$(canonical_path_name(my.repository))\\builds\\msvc\\$(my.vs_version)"
if not exist "$(my.msvc_path)" call mkdir "$(my.msvc_path)"
. emit_error_handler("Failed to create directory.")

Expand All @@ -30,12 +31,13 @@ call xcopy /y "props\\import\\$(my.import_name).import.*" $(my.msvc_path)

.endmacro emit_import_copy_project
.
.macro emit_import_copy(output, repository_name, import_name)
REM Copy $(my.import_name) imports for $(my.repository_name)
. emit_import_copy_project(my.output, my.repository_name, my.import_name, "vs2013")
. emit_import_copy_project(my.output, my.repository_name, my.import_name, "vs2015")
. emit_import_copy_project(my.output, my.repository_name, my.import_name, "vs2017")
. define my.msvc_path = "$(my.output)\\$(my.repository_name)\\builds\\msvc"
.macro emit_import_copy(repository, output, import_name)
. define my.repository = emit_import_copy.repository
REM Copy $(my.import_name) imports for $(my.repository.name)
. emit_import_copy_project(my.repository, my.output, my.import_name, "vs2013")
. emit_import_copy_project(my.repository, my.output, my.import_name, "vs2015")
. emit_import_copy_project(my.repository, my.output, my.import_name, "vs2017")
. define my.msvc_path = "$(my.output)\\$(canonical_path_name(my.repository))\\builds\\msvc"
if not exist "$(my.msvc_path)\\build\\" call mkdir "$(my.msvc_path)\\build\\"
. emit_error_handler("Failed to create build directory.")
call xcopy /y "props\\nuget.config" "$(my.msvc_path)"
Expand All @@ -46,23 +48,26 @@ call xcopy /y "props\\build\\build_base.bat" "$(my.msvc_path)\\build\\"

.endmacro
.
.macro emit_project_props_copy_project(output, repository_name, vs_version)
. define my.msvc_path = "$(my.output)\\$(my.repository_name)\\builds\\msvc\\$(my.vs_version)"
.macro emit_project_props_copy_project(repository, output, vs_version)
. define my.repository = emit_project_props_copy_project.repository
. define my.msvc_path = "$(my.output)\\$(canonical_path_name(my.repository))\\builds\\msvc\\$(my.vs_version)"
call :pending "Seeding props $(my.msvc_path)"
call xcopy /s /y "props\\project\\$(my.repository_name)\\*" $(my.msvc_path)
call xcopy /s /y "props\\project\\$(my.repository.name)\\*" $(my.msvc_path)
. emit_error_handler("Failed to copy import files.")

.endmacro
.
.macro emit_project_props_copy(output, repository_name)
REM Copy project props for $(my.repository_name)
. emit_project_props_copy_project(my.output, my.repository_name, "vs2013")
. emit_project_props_copy_project(my.output, my.repository_name, "vs2015")
. emit_project_props_copy_project(my.output, my.repository_name, "vs2017")
.macro emit_project_props_copy(repository, output)
. define my.repository = emit_project_props_copy.repository
REM Copy project props for $(my.repository.name)
. emit_project_props_copy_project(my.repository, my.output, "vs2013")
. emit_project_props_copy_project(my.repository, my.output, "vs2015")
. emit_project_props_copy_project(my.repository, my.output, "vs2017")
.endmacro
.
.macro emit_repository_completion_message(repository_name)
call :success "Completed population of $(my.repository_name) artifacts."
.macro emit_repository_completion_message(repository)
. my.repository = emit_repository_completion_message
call :success "Completed population of $(my.repository.name) artifacts."
.endmacro emit_repository_completion_message
.
.macro emit_error_handler(message)
Expand Down Expand Up @@ -118,10 +123,10 @@ function generate_artifacts(path_prefix)
for _repository->install.build as _build where\
defined(_build.repository) &\
starts_with(_build.repository, "libbitcoin")
emit_import_copy(my.path_prefix, _repository.name, _build.repository)
emit_import_copy(_repository, my.path_prefix, _build.repository)
endfor
emit_project_props_copy(my.path_prefix, _repository.name)
emit_repository_completion_message(_repository.name)
emit_project_props_copy(_repository, my.path_prefix)
emit_repository_completion_message(_repository)
endfor

emit_completion()
Expand Down
46 changes: 26 additions & 20 deletions gsl.copy_properties.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,41 @@ declare -a vs_version=( \\
"vs2015" \\
"vs2017" \\
)

.endmacro
.
.macro emit_import_copy(output, repository_name, import_name)
.macro emit_import_copy(repository, output, import_name)
. define my.repository = emit_import_copy.repository
.
for version in "\${vs_version[@]}"
do
mkdir -p $(my.output)/$(my.repository_name)/builds/msvc/\$version/
eval cp -f props/import/$(my.import_name).import.* $(my.output)/$(my.repository_name)/builds/msvc/\$version/
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
eval cp -f props/import/$(my.import_name).import.* $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
done

.endmacro
.
.macro emit_project_props_copy(output, repository_name)
.macro emit_project_props_copy(repository, output)
. define my.repository = emit_project_props_copy.repository
.
for version in "\${vs_version[@]}"
do
mkdir -p $(my.output)/$(my.repository_name)/builds/msvc/\$version/
eval cp -rf props/project/$(my.repository_name)/* $(my.output)/$(my.repository_name)/builds/msvc/\$version/
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
eval cp -rf props/project/$(my.repository.name)/* $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
done
mkdir -p $(my.output)/$(my.repository_name)/builds/msvc/build/
eval cp -rf props/nuget.config $(my.output)/$(my.repository_name)/builds/msvc/
eval cp -rf props/build/build_base.bat $(my.output)/$(my.repository_name)/builds/msvc/build/
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/build/
eval cp -rf props/nuget.config $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/
eval cp -rf props/build/build_base.bat $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/build/

.endmacro
.
.macro emit_nuget_config_copy(output, repository_name)
.macro emit_nuget_config_copy(repository, output)
. define my.repository = emit_nuget_config_copy.repository
.
for version in "\${vs_version[@]}"
do
mkdir -p $(my.output)/$(my.repository_name)/builds/msvc/
eval cp -rf props/nuget.config $(my.output)/$(my.repository_name)/builds/msvc/
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/
eval cp -rf props/nuget.config $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/
done

.endmacro
Expand All @@ -73,14 +79,14 @@ function generate_artifacts(path_prefix)

# TODO: walk dependency tree, not build list.
# TODO: build list is for telling installer what to compile.
for generate.repository by name as _repository
echo(" Evaluating repository: $(_repository.name)")
for generate.repository by name as _repository
echo(" Evaluating repository: $(_repository.name)")
for _repository->install.build as _build where\
defined(_build.repository) & starts_with(_build.repository, "libbitcoin")
emit_import_copy(my.path_prefix, _repository.name, _build.repository)
endfor
emit_project_props_copy(my.path_prefix, _repository.name)
endfor
defined(_build.repository) & starts_with(_build.repository, "libbitcoin")
emit_import_copy(_repository, my.path_prefix, _build.repository)
endfor
emit_project_props_copy(_repository, my.path_prefix)
endfor

endfunction
###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions templates/gsl.Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -735,15 +735,15 @@ for generate.repository as _repository by _repository.name\
where (defined(_repository->make))

require(_repository, "repository", "name")
my.output_path = join(my.path_prefix, _repository.name)
my.output_path = join(my.path_prefix, canonical_path_name(_repository))
create_directory(my.output_path)
define my.out_file = "$(my.output_path)/Makefile.am"
notify(my.out_file)
output(my.out_file)

copyleft(_repository.name)
define my.make = _repository->make
define my.absolute = "$(global.root)/$(_repository.name)"
define my.absolute = "$(global.root)/$(canonical_path_name(_repository))"
define my.base = normalize_directory(my.absolute)

heading1("Automake settings.")
Expand Down
8 changes: 4 additions & 4 deletions templates/gsl.appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ endfunction
Write-Host "CTP Compiler Installation Complete." -ForegroundColor Green;
.endmacro # emit_ctp_installation
.
.macro emit_test_execution()
.macro emit_test_execution(name)
- ps: >-
Write-Host "Locating test executables..." -ForegroundColor Yellow;
$BC_TEST_EXES = @(Get-ChildItem -Path "$env:APPVEYOR_BUILD_FOLDER\\bin" -recurse | Where-Object { $_.Name -eq "$env:APPVEYOR_PROJECT_NAME-test.exe" });
$BC_TEST_EXES = @(Get-ChildItem -Path "$env:APPVEYOR_BUILD_FOLDER\\bin" -recurse | Where-Object { $_.Name -eq "$(my.name)-test.exe" });
If ($BC_TEST_EXES.Count -ne 1) {
Write-Host "Failure, invalid count of test executables." -ForegroundColor Red;
exit 1;
Expand Down Expand Up @@ -166,7 +166,7 @@ endfunction
.macro generate_appveyor_yml(path_prefix)
.for generate.repository by name as _repository
. require(_repository, "repository", "name")
. my.output_path = join(my.path_prefix, _repository.name)
. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
. create_directory(my.output_path)
. define my.out_file = "$(my.output_path)/.appveyor.yml"
. notify(my.out_file)
Expand Down Expand Up @@ -199,7 +199,7 @@ build_script:
- cd /d %APPVEYOR_BUILD_FOLDER%

test_script:
. emit_test_execution()
. emit_test_execution(_repository.name)
.
. close
.endfor _repository
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
.macro generate_autogen(path_prefix)
. for generate.repository by name as _repository
. require(_repository, "repository", "name")
. my.output_path = join(my.path_prefix, _repository.name)
. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
. create_directory(my.output_path)
. define my.out_file = "$(my.output_path)/autogen.sh"
. notify(my.out_file)
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ IF EXIST "%~5" SET "msbuild_exe=%~5"
.macro generate_build_cmd(path_prefix)
.for generate.repository by name as _repository
. require(_repository, "repository", "name")
. my.output_path = join(my.path_prefix, _repository.name)
. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
. create_directory(my.output_path)
. define my.out_file = "$(my.output_path)/build.cmd"
. notify(my.out_file)
Expand Down
4 changes: 3 additions & 1 deletion templates/gsl.configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,9 @@ function generate_configure(path_prefix)
for generate.repository by name as _repository

require(_repository, "repository", "name")
define my.output_path = join(my.path_prefix, _repository.name)
define my.output_path = join(my.path_prefix,\
canonical_path_name(_repository))

create_directory(my.output_path)
define my.out_file = "$(my.output_path)/configure.ac"
notify(my.out_file)
Expand Down
4 changes: 2 additions & 2 deletions templates/gsl.include.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ endfunction
function generate_include(path_prefix)
for generate.repository by name as _repository
define my.primary = bitcoin_to_include(_repository.name)
define my.absolute = "$(global.root)/$(_repository.name)"
define my.absolute = "$(global.root)/$(canonical_path_name(_repository))"
define my.base = normalize_directory(my.absolute)
for _repository.make as _make
for _make.product as _product where is_headers(_product)
for _product.files as _files
define my.include = join(join(my.path_prefix,\
_repository.name), _files.path)
canonical_path_name(_repository)), _files.path)
create_directory(my.include)
define my.out_file = "$(my.include)/$(my.primary).hpp"
notify(my.out_file)
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ fi
function generate_installer(path_prefix)
for generate.repository by name as _repository
require(_repository, "repository", "name")
my.output_path = join(my.path_prefix, _repository.name)
my.output_path = join(my.path_prefix, canonical_path_name(_repository))
define my.out_file = "$(my.output_path)/install.sh"
define my.install = _repository->install
create_directory(my.output_path)
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.package.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ for generate.repository by name as _repository\

for _repository.package as _package
require(_repository, "repository", "name")
my.output_path = join(my.path_prefix, _repository.name)
my.output_path = join(my.path_prefix, canonical_path_name(_repository))
create_directory(my.output_path)
define my.package_name = get_package_name(_package)
define my.out_file = "$(my.output_path)/$(my.package_name).pc.in"
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function project_build_dir_relative_path(repository, product, path_prefix,\
define my.proj_name = project_name(my.product, my.repository)
define my.subpath = "builds/msvc/$(my.vs_version)"
return append_path(append_path(append_path(my.path_prefix,\
my.repository.name), my.subpath), my.proj_name)
canonical_path_name(my.repository)), my.subpath), my.proj_name)
endfunction

function packages_config_file(repository, product, path_prefix, vs_version)
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ for generate.repository by name as _repository\
where (defined(_product->runner))

define target_name = target_name(_product, _repository)
my.output_path = join(my.path_prefix, _repository.name)
my.output_path = join(my.path_prefix, canonical_path_name(_repository))
create_directory(my.output_path)
define my.out_file = "$(my.output_path)/$(target_name)_runner.sh"
notify(my.out_file)
Expand Down
4 changes: 2 additions & 2 deletions templates/gsl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function solution_relative_path(repository, path_prefix, vs_version)
define my.repository = solution_relative_path.repository
require(my.repository, "repository", "name")
define my.subpath = "builds/msvc/$(my.vs_version)"
return append_path(append_path(my.path_prefix, my.repository.name),\
my.subpath)
return append_path(append_path(my.path_prefix,\
canonical_path_name(my.repository)), my.subpath)
endfunction

function solution_file(repository, path_prefix, vs_version)
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ matrix:
.macro generate_travis_yml(path_prefix)
.for generate.repository by name as _repository
. require(_repository, "repository", "name")
. my.output_path = join(my.path_prefix, _repository.name)
. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
. create_directory(my.output_path)
. define my.out_file = "$(my.output_path)/.travis.yml"
. notify(my.out_file)
Expand Down
4 changes: 2 additions & 2 deletions templates/gsl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function project_build_relative_path(repository, product, path_prefix,\
define my.proj_name = project_name(my.product, my.repository)
define my.subpath = "builds/msvc/$(my.vs_version)"
return append_path(append_path(append_path(my.path_prefix,\
my.repository.name), my.subpath), my.proj_name)
canonical_path_name(my.repository)), my.subpath), my.proj_name)
endfunction

function project_file(repository, product, path_prefix, vs_version)
Expand Down Expand Up @@ -720,7 +720,7 @@ function generate_vcxproj(path_prefix, generate, vs_version)

require(_repository, "repository", "name")
define my.absolute_project_path = append_path(global.root,\
_repository.name)
canonical_path_name(_repository))

for _repository->make.product as _product where \
has_uuid(_product) & defined(_product.path)
Expand Down
6 changes: 3 additions & 3 deletions templates/gsl.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ function project_build_dir_relative_path(repository, product, path_prefix,\
define my.product = project_build_dir_relative_path.product
define my.proj_name = project_name(my.product, my.repository)
define my.subpath = "builds/msvc/$(my.vs_version)"
return append_path(append_path(append_path(\
my.path_prefix, my.repository.name), my.subpath), my.proj_name)
return append_path(append_path(append_path(my.path_prefix,\
canonical_path_name(my.repository)), my.subpath), my.proj_name)
endfunction

function project_file(repository, product, path_prefix, vs_version)
Expand Down Expand Up @@ -418,7 +418,7 @@ function generate_filter(path_prefix, generate, vs_version)

require(_repository, "repository", "name")
define my.absolute_project_path = append_path(global.root,\
_repository.name)
canonical_path_name(_repository))

for _repository->make.product as _product where \
has_uuid(_product) & defined(_product.path)
Expand Down
2 changes: 1 addition & 1 deletion templates/gsl.version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function generate_version(path_prefix)

# We are writing into local primary includes (not installdir).
define my.include = join(join(my.path_prefix,\
_repository.name), _files.path)
canonical_path_name(_repository)), _files.path)
define my.path = "$(my.include)/$(my.primary)"
create_directory(my.path)

Expand Down
6 changes: 6 additions & 0 deletions utilities.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ endfunction
# Library utilities.
#------------------------------------------------------------------------------

function global.canonical_path_name(repository)
define my.repository = canonical_path_name.repository
return defined(my.repository.path) ?? my.repository.path ?\
my.repository.name
endfunction

# Get the product with the given library name.
function global.find_library_product(name, make, repository)
define my.make = find_library_product.make
Expand Down

0 comments on commit 0a8dc44

Please sign in to comment.