Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[boost-filesystem] fix emscripten build #29540

Merged
merged 5 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions ports/boost-build/0003-fix-emscripten.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/src/tools/emscripten.jam b/src/tools/emscripten.jam
index d6594c5e43..8b15d0af96 100644
--- a/src/tools/emscripten.jam
+++ b/src/tools/emscripten.jam
@@ -6,6 +6,7 @@
import feature ;
import os ;
import toolset ;
+import generators ;
import common ;
import gcc ;
import type ;
@@ -37,6 +38,9 @@ rule init ( version ? : command * : options * )

feature.extend toolset : emscripten ;

+generators.override builtin.lib-generator : emscripten.prebuilt ;
+generators.override emscripten.searched-lib-generator : searched-lib-generator ;
+
toolset.inherit-generators emscripten <toolset>emscripten
: gcc
: gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch
@@ -53,7 +57,7 @@ toolset.inherit-flags emscripten : gcc

type.set-generated-target-suffix EXE : <toolset>emscripten : "js" ;
type.set-generated-target-suffix OBJ : <toolset>emscripten : "bc" ;
-type.set-generated-target-suffix STATIC_LIB : <toolset>emscripten : "bc" ;
+type.set-generated-target-suffix STATIC_LIB : <toolset>emscripten : "a" ;

toolset.flags emscripten.compile OPTIONS <flags> ;
toolset.flags emscripten.compile OPTIONS <cflags> ;

1 change: 1 addition & 0 deletions ports/boost-build/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
0002-fix-get-version.patch
0003-fix-emscripten.patch
)

vcpkg_download_distfile(ARCHIVE
Expand Down
2 changes: 1 addition & 1 deletion ports/boost-build/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$comment": "Automatically generated by scripts/boost/generate-ports.ps1",
"name": "boost-build",
"version": "1.81.0",
"port-version": 1,
"port-version": 2,
"description": "Boost.Build",
"homepage": "https://github.com/boostorg/build",
"license": "BSL-1.0",
Expand Down
28 changes: 2 additions & 26 deletions ports/boost-modular-build-helper/boost-modular-build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function(boost_modular_build)
else()
set(BOOST_LIB_PREFIX lib)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
set(BOOST_LIB_RELEASE_SUFFIX .bc)
set(BOOST_LIB_DEBUG_SUFFIX .bc)
set(BOOST_LIB_RELEASE_SUFFIX .a)
set(BOOST_LIB_DEBUG_SUFFIX .a)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(BOOST_LIB_RELEASE_SUFFIX .a)
set(BOOST_LIB_DEBUG_SUFFIX .a)
Expand Down Expand Up @@ -147,30 +147,6 @@ function(boost_modular_build)
"${CURRENT_PACKAGES_DIR}/debug/bin/*.pyd"
)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
# install .bc files
file(GLOB WASM_LIBS_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/boost/build/*/${BOOST_LIB_PREFIX}*${BOOST_LIB_RELEASE_SUFFIX}")
file(GLOB WASM_LIBS_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/boost/build/*/${BOOST_LIB_PREFIX}*${BOOST_LIB_DEBUG_SUFFIX}")
file(COPY ${WASM_LIBS_RELEASE} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(COPY ${WASM_LIBS_DEBUG} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")

# rename .bc to .a
file(GLOB WASM_LIBS_RELEASE "${CURRENT_PACKAGES_DIR}/lib/*.bc")
file(GLOB WASM_LIBS_DEBUG "${CURRENT_PACKAGES_DIR}/debug/lib/*.bc")
foreach(LIB IN LISTS WASM_LIBS_RELEASE)
get_filename_component(OLD_FILENAME ${LIB} NAME)
get_filename_component(DIRECTORY_OF_LIB_FILE ${LIB} DIRECTORY)
string(REPLACE ".bc" ".a" NEW_FILENAME ${OLD_FILENAME})
file(RENAME ${LIB} ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME})
endforeach()
foreach(LIB IN LISTS WASM_LIBS_DEBUG)
get_filename_component(OLD_FILENAME ${LIB} NAME)
get_filename_component(DIRECTORY_OF_LIB_FILE ${LIB} DIRECTORY)
string(REPLACE ".bc" ".a" NEW_FILENAME ${OLD_FILENAME})
file(RENAME ${LIB} ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME})
endforeach()
endif()

file(GLOB INSTALLED_LIBS "${CURRENT_PACKAGES_DIR}/debug/lib/*.lib" "${CURRENT_PACKAGES_DIR}/lib/*.lib")
foreach(LIB IN LISTS INSTALLED_LIBS)
get_filename_component(OLD_FILENAME ${LIB} NAME)
Expand Down
2 changes: 1 addition & 1 deletion ports/boost-modular-build-helper/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$comment": "Automatically generated by scripts/boost/generate-ports.ps1",
"name": "boost-modular-build-helper",
"version": "1.81.0",
"port-version": 2,
"port-version": 3,
"description": "Internal vcpkg port used to build Boost libraries",
"license": "MIT",
"dependencies": [
Expand Down
5 changes: 5 additions & 0 deletions versions/b-/boost-build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "40cd5234db2baf10fb0a2b0ec8b40771910ca045",
"version": "1.81.0",
"port-version": 2
},
{
"git-tree": "e4e7001fc4602b7fc61c55acf2c3b641e79c7de7",
"version": "1.81.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/b-/boost-modular-build-helper.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d47cef023f39ac9d5f3a043d35cba1a74710e1b3",
"version": "1.81.0",
"port-version": 3
},
{
"git-tree": "99f9bc3d7c9ac2864942f3f8d80a3d8db4689794",
"version": "1.81.0",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
},
"boost-build": {
"baseline": "1.81.0",
"port-version": 1
"port-version": 2
},
"boost-callable-traits": {
"baseline": "1.81.0",
Expand Down Expand Up @@ -894,7 +894,7 @@
},
"boost-modular-build-helper": {
"baseline": "1.81.0",
"port-version": 2
"port-version": 3
},
"boost-move": {
"baseline": "1.81.0",
Expand Down