Skip to content

Commit

Permalink
quick fixes for bin releases and mac osx on mojave
Browse files Browse the repository at this point in the history
  • Loading branch information
larryk85 committed Dec 11, 2018
1 parent 8ddf206 commit 6cc6aca
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
22 changes: 16 additions & 6 deletions scripts/generate_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cp -R ${BUILD_DIR}/bin/* ${CDT_PREFIX}/bin
cp -R ${BUILD_DIR}/licenses/* ${CDT_PREFIX}/licenses

# install cmake modules
sed "s/_PREFIX_/\/${SPREFIX}/g" ${BUILD_DIR}/modules/EosioCDTMacrosPackage.cmake &> ${CDT_PREFIX}/lib/cmake/${PROJECT}/EosioCDTMacros.cmake
sed "s/_PREFIX_/\/${SPREFIX}/g" ${BUILD_DIR}/modules/EosioWasmToolchainPackage.cmake &> ${CDT_PREFIX}/lib/cmake/${PROJECT}/EosioWasmToolchain.cmake
sed "s/_PREFIX_/\/${SPREFIX}\/${SSUBPREFIX}/g" ${BUILD_DIR}/modules/${PROJECT}-config.cmake.package &> ${CDT_PREFIX}/lib/cmake/${PROJECT}/${PROJECT}-config.cmake

Expand All @@ -37,14 +38,23 @@ cp ${BUILD_DIR}/lib/*.a ${CDT_PREFIX}/lib
pushd ${PREFIX}/lib/cmake/${PROJECT} &> /dev/null
ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/${PROJECT}-config.cmake ${PROJECT}-config.cmake
ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/EosioWasmToolchain.cmake EosioWasmToolchain.cmake
ln -sf ../../../${SUBPREFIX}/lib/cmake/${PROJECT}/EosioCDTMacros.cmake EosioCDTMacros.cmake
popd &> /dev/null

pushd ${PREFIX}/bin &> /dev/null
for f in `ls ${BUILD_DIR}/bin/eosio-\*`; do
bn=$(basename $f)
ln -sf ../${SUBPREFIX}/bin/$bn $bn
done
popd &> /dev/null
create_symlink() {
pushd ${PREFIX}/bin &> /dev/null
ln -sf ../${SUBPREFIX}/bin/$1 $2
popd &> /dev/null
}

create_symlink "eosio-cc eosio-cc"
create_symlink "eosio-cpp eosio-cpp"
create_symlink "eosio-ld eosio-ld"
create_symlink "eosio-pp eosio-pp"
create_symlink "eosio-proj eosio-proj"
create_symlink "eosio-abigen eosio-abigen"
create_symlink "eosio-wasm2wast eosio-wasm2wast"
create_symlink "eosio-wast2wasm eosio-wast2wasm"

tar -cvzf $NAME ./${PREFIX}/*
rm -r ${PREFIX}
2 changes: 1 addition & 1 deletion tests/unit/name_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using namespace eosio::native;

EOSIO_TEST_BEGIN(name_test)
silence_output(true);
//silence_output(true);
eosio_assert( eosio::name{"azaa34"}.value == "azaa34"_n.value, "eosio::name != azaa34" );
eosio_assert( eosio::name{0}.value == 0, "eosio::name != 0" );
eosio_assert( eosio::name{"aa11"}.value == "aa11"_n.value, "eosio::name != aa11" );
Expand Down
8 changes: 7 additions & 1 deletion tools/include/compiler_options.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ static void GetLdDefaults(std::vector<std::string>& ldopts) {
ldopts.emplace_back("--merge-data-segments");
} else {
#ifdef __APPLE__
ldopts.emplace_back("-arch x86_64 -macosx_version_min 10.13 -framework Foundation -framework System -static");
ldopts.emplace_back("-arch x86_64 -macosx_version_min 10.13 -framework Foundation -framework System ");
ldopts.emplace_back("-e __wrap_main");
#endif
}
Expand Down Expand Up @@ -449,7 +449,9 @@ static Options CreateOptions(bool add_defaults=true) {

#ifdef ONLY_LD
ldopts.emplace_back("-L"+eosio::cdt::whereami::where()+"/../lib");
#ifndef __APPLE__
ldopts.emplace_back("-L"+eosio::cdt::whereami::where()+"/../lib64");
#endif
#endif
#ifndef ONLY_LD
if (!sysroot_opt.empty()) {
Expand All @@ -460,7 +462,9 @@ static Options CreateOptions(bool add_defaults=true) {
agopts.emplace_back("-I"+sysroot_opt+"/include/libcxx");
agopts.emplace_back("-I"+sysroot_opt+"/include/libc");
ldopts.emplace_back("-L"+sysroot_opt+"/lib");
#ifndef __APPLE__
ldopts.emplace_back("-L"+sysroot_opt+"/lib64");
#endif
}
else {
copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/libcxx");
Expand All @@ -472,7 +476,9 @@ static Options CreateOptions(bool add_defaults=true) {
agopts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include");
agopts.emplace_back("--sysroot="+eosio::cdt::whereami::where()+"/../");
ldopts.emplace_back("-L"+eosio::cdt::whereami::where()+"/../lib");
#ifndef __APPLE__
ldopts.emplace_back("-L"+eosio::cdt::whereami::where()+"/../lib64");
#endif
}

if (!isystem_opt.empty()) {
Expand Down
7 changes: 5 additions & 2 deletions tools/include/eosio/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ struct environment {
}
return env_table;
}
static bool exec_subprogram(const std::string prog, std::vector<std::string> options) {
static bool exec_subprogram(const std::string prog, std::vector<std::string> options, bool root=false) {
std::stringstream args;
for (auto s : options)
args << s << " ";
if ( auto path = llvm::sys::findProgramByName(prog.c_str(), {eosio::cdt::whereami::where()}) )
std::string find_path = eosio::cdt::whereami::where();
if (root)
find_path = "/usr/bin";
if ( auto path = llvm::sys::findProgramByName(prog.c_str(), {find_path}) )
std::system((*path+" "+args.str()).c_str());
else
return false;
Expand Down
4 changes: 1 addition & 3 deletions tools/ld/eosio-ld.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ int main(int argc, const char **argv) {
std::string line;
if (opts.native) {
#ifdef __APPLE__
opts.ld_options.push_back("-arch x86_64");
opts.ld_options.push_back("-macosx_version_min 10.13");
if (!eosio::cdt::environment::exec_subprogram("ld64.lld", opts.ld_options))
if (!eosio::cdt::environment::exec_subprogram("ld", opts.ld_options, true))
#else
if (!eosio::cdt::environment::exec_subprogram("ld.lld", opts.ld_options))
#endif
Expand Down

0 comments on commit 6cc6aca

Please sign in to comment.