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

Freebsd comptibility patch #227

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 12 additions & 3 deletions ArmoryQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,9 @@ def getExtraEntropyForKeyGen(self):
elif OS_LINUX:
tempDir = '/var/log'
extraFiles = ['/var/log/Xorg.0.log']
elif OS_FREEBSD:
tempDir = '/var/log'
extraFiles = ['/var/log/Xorg.0.log']
elif OS_MACOSX:
tempDir = '/var/log'
extraFiles = ['/var/log/system.log']
Expand Down Expand Up @@ -1369,7 +1372,7 @@ def setupUriRegistration(self, justDoIt=False):
if USE_TESTNET:
return

if OS_LINUX:
if OS_LINUX or OS_FREEBSD:
out,err = execAndWait('gconftool-2 --get /desktop/gnome/url-handlers/bitcoin/command')
out2,err = execAndWait('xdg-mime query default x-scheme-handler/bitcoin')

Expand Down Expand Up @@ -1890,6 +1893,8 @@ def getVersionNotifyLongDescr(self, verStr, testing=False):
shortOS = 'windows'
elif OS_LINUX:
shortOS = 'ubuntu'
elif OS_FREEBSD:
shortOS = 'freebsd'
elif OS_MACOSX:
shortOS = 'mac'

Expand Down Expand Up @@ -4708,6 +4713,8 @@ def openInstruct():
'Will download and Bitcoin software and cryptographically verify it"""))
elif OS_MACOSX:
pass
elif OS_FREEBSD:
pass
else:
LOGERROR('Unrecognized OS!')

Expand Down Expand Up @@ -5101,8 +5108,10 @@ def explicitCheckAnnouncements(self, waitTime=3):
#############################################################################
def closeExistingBitcoin(self):
for proc in psutil.process_iter():
if proc.name.lower() in ['bitcoind.exe','bitcoin-qt.exe',\
'bitcoind','bitcoin-qt']:
if (not OS_WINDOWS and proc.name() in ['bitcoind','bitcoin-qt']) \
or \
(OS_WINDOWS and proc.name.lower() in ['bitcoind.exe', \
'bitcoin-qt.exe']):
killProcess(proc.pid)
time.sleep(2)
return
Expand Down
2 changes: 2 additions & 0 deletions announcefetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def getDecoratedURL(self, url, verbose=False):
argsMap['os'] = 'win'
elif OS_LINUX:
argsMap['os'] = 'lin'
elif OS_FREEBSD:
argsMap['os'] = 'bsd'
elif OS_MACOSX:
argsMap['os'] = 'mac'
else:
Expand Down
21 changes: 18 additions & 3 deletions armoryengine/ArmoryUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class P2SHNotSupportedError(Exception): pass
opsys = platform.system()
OS_WINDOWS = 'win32' in opsys.lower() or 'windows' in opsys.lower()
OS_LINUX = 'nix' in opsys.lower() or 'nux' in opsys.lower()
OS_FREEBSD = 'freebsd' in opsys.lower()
OS_MACOSX = 'darwin' in opsys.lower() or 'osx' in opsys.lower()


Expand Down Expand Up @@ -276,6 +277,14 @@ class P2SHNotSupportedError(Exception): pass
ARMORY_HOME_DIR = os.path.join(USER_HOME_DIR, '.armory', SUBDIR)
BLKFILE_DIR = os.path.join(BTC_HOME_DIR, 'blocks')
BLKFILE_1stFILE = os.path.join(BLKFILE_DIR, 'blk00000.dat')
elif OS_FREEBSD:
OS_NAME = 'FreeBSD'
OS_VARIANT = ('FreeBSD',platform.release(), '') # tuple (platform,version,id)
USER_HOME_DIR = os.getenv('HOME')
BTC_HOME_DIR = os.path.join(USER_HOME_DIR, '.bitcoin', SUBDIR)
ARMORY_HOME_DIR = os.path.join(USER_HOME_DIR, '.armory', SUBDIR)
BLKFILE_DIR = os.path.join(BTC_HOME_DIR, 'blocks')
BLKFILE_1stFILE = os.path.join(BLKFILE_DIR, 'blk00000.dat')
elif OS_MACOSX:
platform.mac_ver()
OS_NAME = 'MacOSX'
Expand All @@ -293,6 +302,7 @@ class P2SHNotSupportedError(Exception): pass
opsys = platform.system()
OS_WINDOWS = 'win32' in opsys.lower() or 'windows' in opsys.lower()
OS_LINUX = 'nix' in opsys.lower() or 'nux' in opsys.lower()
OS_FREEBSD = 'freebsd' in opsys.lower()
OS_MACOSX = 'darwin' in opsys.lower() or 'osx' in opsys.lower()

BLOCKCHAINS = {}
Expand Down Expand Up @@ -631,7 +641,7 @@ def killProcessTree(pid):
# call, because have bundled a recent version of psutil. Linux, however,
# does not have that function call in earlier versions.
from subprocess import Popen, PIPE
if not OS_LINUX:
if not OS_LINUX and not OS_FREEBSD:
for child in psutil.Process(pid).get_children():
killProcess(child.pid)
else:
Expand Down Expand Up @@ -1007,7 +1017,7 @@ def readWalletFiles(inWltList=None):
LOGCRIT(' in the current directory (or added to the PATH)')
LOGCRIT(' Specifically, you need:')
LOGCRIT(' CppBlockUtils.py and')
if OS_LINUX or OS_MACOSX:
if OS_LINUX or OS_FREEBSD or OS_MACOSX:
LOGCRIT(' _CppBlockUtils.so')
elif OS_WINDOWS:
LOGCRIT(' _CppBlockUtils.pyd')
Expand Down Expand Up @@ -1041,6 +1051,11 @@ def GetSystemDetails():
out.CpuStr = line.split(':')[1].strip()
break

elif OS_FREEBSD:
# Get total RAM
out.Memory = long(subprocess_check_output(['sysctl','-n','hw.physmem']))
# Get CPU name
out.CpuStr = subprocess_check_output(['sysctl','-n','hw.model'])

elif OS_WINDOWS:
import ctypes
Expand Down Expand Up @@ -1542,7 +1557,7 @@ def addrStr_to_script(addrStr):
LOGCRIT(' in the current directory (or added to the PATH)')
LOGCRIT(' Specifically, you need:')
LOGCRIT(' CppBlockUtils.py and')
if OS_LINUX or OS_MACOSX:
if OS_LINUX or OS_FREEBSD or OS_MACOSX:
LOGCRIT(' _CppBlockUtils.so')
elif OS_WINDOWS:
LOGCRIT(' _CppBlockUtils.pyd')
Expand Down
13 changes: 13 additions & 0 deletions cppForSwig/cryptopp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ LDLIBS += -lnsl -lsocket
M32OR64 = -m$(shell isainfo -b)
endif

ifeq ($(UNAME),FreeBSD)
AR = ar
ARFLAGS = cr
CXX ?= c++
IS_GCC2 = $(shell $(CXX) -v 2>&1 | $(EGREP) -c gcc-932)
ifeq ($(IS_GCC2),1)
CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables
LDLIBS += -lstdc++
LDFLAGS += -flat_namespace -undefined suppress -m
endif
endif


ifneq ($(IS_SUN_CC),0) # override flags for CC Sun C++ compiler
CXXFLAGS = -DNDEBUG -O -g0 -native -template=no%extdef $(M32OR64)
LDFLAGS =
Expand Down