Skip to content

Commit

Permalink
Removed duplicate definition of insert() "serialize.h".
Browse files Browse the repository at this point in the history
Corrected reference to array (boost::array) in "net.cpp".
Added makefile for OS/X 10.9 (/w Homebrew).
Added documentation on how to build for OS/X 10.9 (w/ homebrew).
  • Loading branch information
Sami Laine committed Nov 22, 2013
1 parent 154b52a commit 4cd4a80
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 13 deletions.
93 changes: 93 additions & 0 deletions doc/build-osx-mavericks.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright (c) 2012-2013 PPCoin Developers
Copyright (c) 2009-2012 Bitcoin Developers
Distributed under the MIT/X11 software license, see the accompanying file
license.txt or http://www.opensource.org/licenses/mit-license.php. This
product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic
software written by Eric Young (eay@cryptsoft.com) and UPnP software written by
Thomas Bernard.


Mac OS X bitcoind build instructions
Laszlo Hanyecz <solar@heliacal.net>
Douglas Huff <dhuff@jrbobdobbs.org>

Modified for PPCoin by Jeff Larkin <jefflarkin@gmail.com>
Modified for OS/X 10.9 (Mavericks) by Sami Laine <laine.j.sami@gmail.com>


See readme-qt.rst for instructions on building PPCoin QT, the
graphical user interface.

These recipes have been tested on 10.9 Intel only.

Typographic conventions: all commands which should be executed in
the Terminal emulator of your choice (Terminal.app is very popular
and comes with OS/X) are in single quotes or are separated by
empty lines and indented by two characters.

So, for example 'this is a command' and

so is this

Typographic conventions aside, let us move to the actual business of
building PPCoin.

1. Prerequisites

You need Apple XCode, XCode command line tools and Homebrew (see
<URL:http://brew.sh/>) to build PPCoin. Apple XCode and XCode command
line tools are mandatory, but there are other options for Homebrew
(namely Fink, <URL:http://www.finkproject.org/>, and MacPorts,
<URL:https://www.macports.org/>). However, this document and the
accompanied makefile.osx-mavericks will assume you're using Homebrew.
It shouldn't be too hard for you to modify the Makefile, in case
you don't feel like using Homebrew.

Download and install Apple XCode 5 from Apps Store. For more information
see <URL:https://developer.apple.com/xcode/>. You can also install
it by running 'xcode-select --install'.

Install Homebrew from <URL:http://brew.sh/>. I recommend that you
do this as a normal user and not root. If you want to use default
location for Homebrew ("/usr/local"), just give your normal user
account ownership of the destination directory by running
'sudo chown <my_account_here> /usr/local'.

Remember to run 'brew doctor' before moving forward.

2. Required programs and depency libraries

These come from Homebrew:

brew install berkeley-db4 boost boost-build git miniupnpc

3. Clone the Primecoin git repository

git clone git@github.com:ppcoin/ppcoin.git ppcoin

4. Build 64-bit PPCoin daemon

cd ppcoin/src && make -f makefile.osx-mavericks 64BIT=true

Leave 64BIT=true out, if you want a 32-bit binary (unless you're
absolutely sure, you probably don't).

5. Test the binary

For a list of command line options, run:

src/ppcoind --help

To start the PPCoin daemon, run:

src/ppcoind -daemon

If you've enabled RPC, to get a list of RPC commands, run:

src/ppcoind help

The last one is actually far out from the scope of this document
and most likely fails. Consult help and search engines to find out
how to make best use of PPCoin daemon RPC.

150 changes: 150 additions & 0 deletions src/makefile.osx-mavericks
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# -*- mode: Makefile; -*-
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Copyright (c) 2011-2012 The PPCoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.

# Mac OS X makefile for ppcoin
# Originally by Laszlo Hanyecz (solar@heliacal.net)

CXX=llvm-g++
BREWDIR=/usr/local

INCLUDEPATHS= -I"$(CURDIR)" \
-I"$(CURDIR)/obj" \
-I"$(BREWDIR)/opt/berkeley-db4/include" \
-I"$(BREWDIR)/opt/boost/include" \

LIBPATHS= -L"$(DEPSDIR)/lib" \
-L"$(BREWDIR)/opt/berkeley-db4/lib" \
-L"$(BREWDIR)/opt/boost/lib"

USE_UPNP:=1

LIBS= -dead_strip

TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)

ifdef STATIC
# Build STATIC if you are redistributing the bitcoind binary
TESTLIBS += \
$(DEPSDIR)/lib/libboost_unit_test_framework-mt.a
LIBS += \
$(BREWDIR)/opt/lib/db48/libdb_cxx-4.8.a \
$(BREWDIR)/lib/libboost_system-mt.a \
$(BREWDIR)/lib/libboost_filesystem-mt.a \
$(BREWDIR)/lib/libboost_program_options-mt.a \
$(BREWDIR)/lib/libboost_thread-mt.a \
$(BREWDIR)/lib/libssl.a \
$(BREWDIR)/lib/libcrypto.a \
-lz
else
TESTLIBS += \
-lboost_unit_test_framework-mt
LIBS += \
-ldb_cxx-4.8 \
-lboost_system-mt \
-lboost_filesystem-mt \
-lboost_program_options-mt \
-lboost_thread-mt \
-lssl \
-lcrypto \
-lz
TESTDEFS += -DBOOST_TEST_DYN_LINK
endif

DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE

ifdef RELEASE
CFLAGS = -mmacosx-version-min=10.9 -O3
# Compile for maximum compatibility and smallest size.
# This requires that dependencies are compiled
# the same way.
ifdef 64BIT
CFLAGS += -arch x86_64
else
CFLAGS += -arch i386
endif
else
CFLAGS = -g
endif

# ppc doesn't work because we don't support big-endian
CFLAGS += -w -Wextra -Wno-sign-compare -Wno-invalid-offsetof -Wformat-security \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)

OBJS= \
obj/version.o \
obj/checkpoints.o \
obj/netbase.o \
obj/addrman.o \
obj/crypter.o \
obj/key.o \
obj/db.o \
obj/init.o \
obj/irc.o \
obj/keystore.o \
obj/main.o \
obj/net.o \
obj/protocol.o \
obj/bitcoinrpc.o \
obj/rpcdump.o \
obj/script.o \
obj/util.o \
obj/wallet.o \
obj/walletdb.o \
obj/noui.o \
obj/kernel.o

ifdef USE_UPNP
DEFS += -DUSE_UPNP=$(USE_UPNP)
ifdef STATIC
LIBS += $(BREWDIR)/lib/libminiupnpc.a
else
LIBS += -lminiupnpc
endif
endif

all: ppcoind

# auto-generated dependencies:
-include obj/*.P
-include obj-test/*.P

obj/build.h: FORCE
/bin/sh ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO

obj/%.o: %.cpp
$(CXX) -c $(CFLAGS) -MMD -o $@ $<
# $(CXX) -c $(CFLAGS) -o $@ $<
# @cp $(@:%.o=%.d) $(@:%.o=%.P); \
# sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
# -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
# rm -f $(@:%.o=%.d)

ppcoind: $(OBJS:obj/%=obj/%)
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))

obj-test/%.o: test/%.cpp
$(CXX) -c $(TESTDEFS) $(CFLAGS) -MMD -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)

test_ppcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS)

clean:
-rm -f ppcoind test_ppcoin
-rm -f obj/*.o
-rm -f obj-test/*.o
-rm -f obj/*.P
-rm -f obj-test/*.P
-rm -f src/build.h

FORCE:
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CAddress addrLocalHost(CService("0.0.0.0", 0), nLocalServices);
CAddress addrSeenByPeer(CService("0.0.0.0", 0), nLocalServices);
static CNode* pnodeLocalHost = NULL;
uint64 nLocalHostNonce = 0;
array<int, THREAD_MAX> vnThreadsRunning;
boost::array<int, THREAD_MAX> vnThreadsRunning;
static SOCKET hListenSocket = INVALID_SOCKET;
CAddrMan addrman;

Expand Down
12 changes: 0 additions & 12 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,18 +826,6 @@ class CDataStream
vch.insert(it, first, last);
}

void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
{
if (it == vch.begin() + nReadPos && last - first <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
memcpy(&vch[nReadPos], &first[0], last - first);
}
else
vch.insert(it, first, last);
}

#if !defined(_MSC_VER) || _MSC_VER >= 1300
void insert(iterator it, const char* first, const char* last)
{
Expand Down

0 comments on commit 4cd4a80

Please sign in to comment.