Wine has quite a few dependencies we have to fulfil before attempting to build. The first one is Xcode - if you don't have that already installed, get it from the App Store. Note that after installing Xcode you need to run it once to accept the license agreement before being able to use it in the build scripts later.
The other dependencies are easiest to get via brew - get it from brew.sh if you haven't already. Wine already exists as a brew recipe, and we can use that to pull down the dependencies.
First, though, we need to get XQuartz:
brew install Caskroom/cask/xquartz
Then to get Wine and its dependencies:
brew install --devel wine
git clone https://github.com/ccpgames/wine.git
Before building, you need to configure Wine. This is the command I use:
./configure CC="clang" CXX="clang++" CFLAGS="-std=gnu89 -g" prefix=<destination>
And finally you can build:
You can run Wine from the folder it just built in, or use make install to install it to the destination you gave when configuring (the prefix argument).
For more detailed information on building Wine, see http://wiki.winehq.org/MacOSX/Building and https://wiki.winehq.org/Building_Wine.