diff --git a/configure.ac b/configure.ac index c542219cd..94f48dd31 100644 --- a/configure.ac +++ b/configure.ac @@ -709,7 +709,7 @@ fi # These packages don't provide pkgconfig config files across all # platforms, so we use older autoconf detection mechanisms: AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing)) -AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) +#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)]) AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing)) AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) diff --git a/contrib/macdeploy/SDBackground.png b/contrib/macdeploy/SDBackground.png new file mode 100644 index 000000000..e990d50ae Binary files /dev/null and b/contrib/macdeploy/SDBackground.png differ diff --git a/contrib/macdeploy/sd-macdeploy.command b/contrib/macdeploy/sd-macdeploy.command new file mode 100755 index 000000000..eec6b8fa5 --- /dev/null +++ b/contrib/macdeploy/sd-macdeploy.command @@ -0,0 +1,136 @@ +#!/bin/bash + +# by Andy Maloney +# http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/ + +# make sure we are in the correct dir when we double-click a .command file +dir=${0%/*} +if [ -d "$dir" ]; then + cd "$dir" +fi + +# set up your app name, version number, and background image file name +APP_NAME="SilentDragon" +VERSION="1.3.0" +DMG_BACKGROUND_IMG="SDBackground.png" + +# you should not need to change these +APP_EXE="${APP_NAME}.app/Contents/MacOS/${APP_NAME}" + +VOL_NAME="${APP_NAME} ${VERSION}" # volume name will be "SilentDragon 1.3.0" +DMG_TMP="${VOL_NAME}-temp.dmg" +DMG_FINAL="${VOL_NAME}.dmg" # final DMG name will be "SilentDragon 1.3.0.dmg" +STAGING_DIR="./Install" # we copy all our stuff into this dir + +# Check the background image DPI and convert it if it isn't 72x72 +_BACKGROUND_IMAGE_DPI_H=`sips -g dpiHeight ${DMG_BACKGROUND_IMG} | grep -Eo '[0-9]+\.[0-9]+'` +_BACKGROUND_IMAGE_DPI_W=`sips -g dpiWidth ${DMG_BACKGROUND_IMG} | grep -Eo '[0-9]+\.[0-9]+'` + +if [ $(echo " $_BACKGROUND_IMAGE_DPI_H != 72.0 " | bc) -eq 1 -o $(echo " $_BACKGROUND_IMAGE_DPI_W != 72.0 " | bc) -eq 1 ]; then + echo "WARNING: The background image's DPI is not 72. This will result in distorted backgrounds on Mac OS X 10.7+." + echo " I will convert it to 72 DPI for you." + + _DMG_BACKGROUND_TMP="${DMG_BACKGROUND_IMG%.*}"_dpifix."${DMG_BACKGROUND_IMG##*.}" + + sips -s dpiWidth 72 -s dpiHeight 72 ${DMG_BACKGROUND_IMG} --out ${_DMG_BACKGROUND_TMP} + + DMG_BACKGROUND_IMG="${_DMG_BACKGROUND_TMP}" +fi + +# clear out any old data +rm -rf "${STAGING_DIR}" "${DMG_TMP}" "${DMG_FINAL}" + +# copy over the stuff we want in the final disk image to our staging dir +mkdir -p "${STAGING_DIR}" +cp -rpf "${APP_NAME}.app" "${STAGING_DIR}" +# ... cp anything else you want in the DMG - documentation, etc. + +pushd "${STAGING_DIR}" + +# strip the executable +echo "Stripping ${APP_EXE}..." +strip -u -r "${APP_EXE}" + +# compress the executable if we have upx in PATH +# UPX: http://upx.sourceforge.net/ +if hash upx 2>/dev/null; then + echo "Compressing (UPX) ${APP_EXE}..." + upx -9 "${APP_EXE}" +fi + +# ... perform any other stripping/compressing of libs and executables + +popd + +# figure out how big our DMG needs to be +# assumes our contents are at least 1M! +SIZE=`du -sh "${STAGING_DIR}" | sed 's/\([0-9\.]*\)M\(.*\)/\1/'` +SIZE=`echo "${SIZE} + 1.0" | bc | awk '{print int($1+0.5)}'` + +if [ $? -ne 0 ]; then + echo "Error: Cannot compute size of staging dir" + exit +fi + +# create the temp DMG file +hdiutil create -srcfolder "${STAGING_DIR}" -volname "${VOL_NAME}" -fs HFS+ \ + -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${SIZE}M "${DMG_TMP}" + +echo "Created DMG: ${DMG_TMP}" + +# mount it and save the device +DEVICE=$(hdiutil attach -readwrite -noverify "${DMG_TMP}" | \ + egrep '^/dev/' | sed 1q | awk '{print $1}') + +sleep 2 + +# add a link to the Applications dir +echo "Add link to /Applications" +pushd /Volumes/"${VOL_NAME}" +ln -s /Applications +popd + +# add a background image +mkdir /Volumes/"${VOL_NAME}"/.background +cp "${DMG_BACKGROUND_IMG}" /Volumes/"${VOL_NAME}"/.background/ + +# tell the Finder to resize the window, set the background, +# change the icon size, place the icons in the right position, etc. +echo ' + tell application "Finder" + tell disk "'${VOL_NAME}'" + open + set current view of container window to icon view + set toolbar visible of container window to false + set statusbar visible of container window to false + set the bounds of container window to {400, 100, 920, 440} + set viewOptions to the icon view options of container window + set arrangement of viewOptions to not arranged + set icon size of viewOptions to 72 + set background picture of viewOptions to file ".background:'${DMG_BACKGROUND_IMG}'" + set position of item "'${APP_NAME}'.app" of container window to {160, 205} + set position of item "Applications" of container window to {360, 205} + close + open + update without registering applications + delay 2 + end tell + end tell +' | osascript + +sync + +# unmount it +hdiutil detach "${DEVICE}" + +# now make the final image a compressed disk image +echo "Creating compressed image" +hdiutil convert "${DMG_TMP}" -format UDZO -imagekey zlib-level=9 -o "${DMG_FINAL}" + +# clean up +rm -rf "${DMG_TMP}" +rm -rf "${STAGING_DIR}" + +echo 'Done.' + +exit \ No newline at end of file diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 309f4507c..7be744aeb 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -8,7 +8,7 @@ darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysro darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) -darwin_release_CFLAGS=-O3 +darwin_release_CFLAGS=-O1 darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) darwin_debug_CFLAGS=-O1 diff --git a/depends/packages/libgmp.mk b/depends/packages/libgmp.mk index fece8f822..92cd95fbc 100644 --- a/depends/packages/libgmp.mk +++ b/depends/packages/libgmp.mk @@ -9,12 +9,11 @@ $(package)_git_commit=42ba95387cdfd67399f7aac52fddb8d6e1258ee6 $(package)_dependencies= $(package)_config_opts=--enable-cxx --disable-shared else ifeq ($(build_os),darwin) -$(package)_download_path=https://git.hush.is/duke/$(package)/archive -$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz -$(package)_download_file=$($(package)_git_commit).tar.gz -$(package)_sha256_hash=59b2c2b5d58fdf5943bfde1fa709e9eb53e7e072c9699d28dc1c2cbb3c8cc32c -$(package)_git_commit=aece03c7b6967f91f3efdac8c673f55adff53ab1 -$(package)_dependencies= +$(package)_version=6.1.1 +$(package)_download_path=https://git.hush.is/attachments +$(package)_file_name=d613c855-cd92-4efb-b893-658496852019 +$(package)_download_file=d613c855-cd92-4efb-b893-658496852019 +$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6 $(package)_config_opts=--enable-cxx --disable-shared else $(package)_version=6.1.1 diff --git a/src/RandomX/src/virtual_memory.cpp b/src/RandomX/src/virtual_memory.cpp index caf02922a..248d3a2c4 100644 --- a/src/RandomX/src/virtual_memory.cpp +++ b/src/RandomX/src/virtual_memory.cpp @@ -38,7 +38,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include # if TARGET_OS_OSX -# define USE_PTHREAD_JIT_WP 1 +# if TARGET_CPU_ARM64 +# define USE_PTHREAD_JIT_WP 1 +# else +# undef USE_PTHREAD_JIT_WP +# endif # include # endif #endif diff --git a/src/init.cpp b/src/init.cpp index 9cdd3a034..1dda35e1c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1137,9 +1137,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) if(fs::exists(asmap_path)) { printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); } else { - // Shit is fucked up, die an honorable death - InitError(strprintf(_("Could not find any asmap file! Please report this bug to Hush Developers"))); - return false; + // Mac SD + asmap_path = fs::path("/Applications/SilentDragon.app/Contents/MacOS/") / DEFAULT_ASMAP_FILENAME; + printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() ); + if(fs::exists(asmap_path)) { + printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() ); + } else { + // Shit is fucked up, die an honorable death + InitError(strprintf(_("Could not find any asmap file! Please report this bug to Hush Developers"))); + return false; + } } } } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 635d71d7c..f3bfc2668 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -453,8 +453,10 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp, const CPubKey& my return strHex; UniValue result(UniValue::VOBJ); + int serializeSize = GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); + result.push_back(Pair("hex", strHex)); - result.push_back(Pair("size", GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) )); + result.push_back(Pair("size", serializeSize)); TxToJSONExpanded(tx, hashBlock, result, nHeight, nConfirmations, nBlockTime); return result; } diff --git a/src/stratum.cpp b/src/stratum.cpp index 287cd609d..84aba23cd 100644 --- a/src/stratum.cpp +++ b/src/stratum.cpp @@ -1997,10 +1997,13 @@ UniValue rpc_stratum_updatework(const UniValue& params, bool fHelp, const CPubKe // throw JSONRPCError(RPC_INTERNAL_ERROR, "Something went wrong, plz try again!"); // } + uint64_t clientsSize = json_clients.size(); + uint64_t subscriptionsSize = subscriptions.size(); + obj.push_back(Pair("clients", json_clients)); - obj.push_back(Pair("updated", json_clients.size())); + obj.push_back(Pair("updated", clientsSize)); obj.push_back(Pair("skipped", skipped)); - obj.push_back(Pair("total", subscriptions.size())); + obj.push_back(Pair("total", subscriptionsSize)); return obj; } @@ -2126,9 +2129,9 @@ UniValue rpc_stratum_getclientscount (const UniValue& params, bool fHelp, const + HelpExampleCli("stratum_getclientscount", "") + HelpExampleRpc("stratum_getclientscount", "") ); - UniValue obj(UniValue::VOBJ); - obj.push_back(Pair("total", subscriptions.size())); + uint64_t subscriptionsSize = subscriptions.size(); + obj.push_back(Pair("total", subscriptionsSize)); return obj; }; diff --git a/src/util.cpp b/src/util.cpp index 47ca963b4..d90092333 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -527,7 +527,7 @@ boost::filesystem::path GetDefaultDataDir() // existing legacy directory, use that for backward compat return pathRet; } else { - // For new clones, use Hush/HUSH3 + // For new clones, use Hush/ACNAME pathRet = GetSpecialFolderPath(CSIDL_APPDATA) / "Hush" / symbol; return pathRet; } @@ -558,12 +558,12 @@ boost::filesystem::path GetDefaultDataDir() tmppath = pathRet; tmppath /= "Komodo"; //TryCreateDirectory(tmppath); - if(fs::is_directory( tmppath / symbol) { + if(fs::is_directory( tmppath / symbol)) { // Found legacy dir, use that return tmppath / symbol; } else { - // For new clones, use Hush/HUSH3 - tmppath = pathRet / "Hush" / HUSH3; + // For new clones, use Hush/ACNAME + tmppath = pathRet / "Hush" / symbol; } return tmppath; } @@ -581,7 +581,7 @@ boost::filesystem::path GetDefaultDataDir() // existing legacy directory, use that for backward compat return tmppath; } else { - // For new clones, use .hush/HUSH3 + // For new clones, use .hush/ACNAME tmppath = pathRet / ".hush" / symbol; } return tmppath; diff --git a/util/build-mac.sh b/util/build-mac.sh index c86b6cef4..4c89ef726 100755 --- a/util/build-mac.sh +++ b/util/build-mac.sh @@ -47,13 +47,25 @@ PREFIX="$(pwd)/depends/$TRIPLET" make "$@" -C ./depends/ V=1 NO_QT=1 #BUILD CCLIB - WD=$PWD cd src/cc echo $PWD ./makecustom cd $WD +# Build RandomX +cd src/RandomX +if [ -d "build" ] +then + ls -la build/librandomx* +else + mkdir build && cd build + CC="${CC} -g " CXX="${CXX} -g " cmake .. + make +fi + +cd $WD + ./autogen.sh CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \