Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Implement a definitive czmq build for cygwin targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaiyuHurst committed Dec 30, 2014
1 parent 702a00d commit 2fedfe5
Show file tree
Hide file tree
Showing 13 changed files with 137 additions and 0 deletions.
13 changes: 13 additions & 0 deletions INSTALL.cygwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Cygwin users note: To do a complete build, you'll need to get iMatix' gsl and build
it first; see https://github.com/imatix/gsl.

After building and installing gsl, issue these commands in the czmq directory:

cd ./model
./generate
cd ..
./autogen.sh
./configure
cmake .
make
6 changes: 6 additions & 0 deletions ISSUES.cygwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Known issues:

czmq_selftest segfaults in zsock_test when sending a message with a binary picture type
when it first calls zmsg_addmem which next invokes zframe_new, which invokes zmq_msg_data
to get a pointer to the message content; zmq_msg_data returns a bad address and then
memcpy segfaults.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ EXTRA_DIST = \
builds/android/clean.sh \
builds/mingw32/Makefile.mingw32 \
builds/mingw32/platform.h \
builds/cygwin/Makefile.cygwin \
examples/security/grasslands.c \
examples/security/strawhouse.c \
examples/security/woodhouse.c \
Expand Down
23 changes: 23 additions & 0 deletions README.cygwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
czmq-cygwin
=============

Implement a definitive build for cygwin targets.

What's changed:
./Makefile.am Add cygwin-specific target mostly the same as mingw
./configure.ac Add cygwin-specific target mostly the same as mingw
./model/build-autoconf.gsl Make changes for cygwin-specific targets
./model/build-cmake.gsl Make changes for cygwin-specific targets
./model/generate Make changes for cygwin-specific targets
./model/generate.bat Make changes for cygwin-specific targets
./model/project.gsl Make changes for cygwin-specific targets
./model/Makemodule.am Make changes for cygwin-specific targets

What's new:
./README.cygwin This file
./INSTALL.cygwin Notes on installing for cygwin
./builds/cygwin Folder for cygwin-specific build files
./builds/cygwin/Makefile.cygwin Makefile for cygwin targets
./model/build-cygwin.gsl Add cygwin-specific target mostly the same as mingw


32 changes: 32 additions & 0 deletions builds/cygwin/Makefile.cygwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Please read the README.txt file in the model directory. #
#################################################################

CC=gcc
# replace the following with wherever you have installed libzmq
PREFIX=/usr/local
INCDIR=-I$(PREFIX)/include -I.
LIBDIR=-L$(PREFIX)/lib
CFLAGS=-Wall -Os -g -DLIBCZMQ_EXPORTS $(INCDIR)

OBJS = zactor.o zauth.o zarmour.o zbeacon.o zcert.o zcertstore.o zchunk.o zclock.o zconfig.o zdigest.o zdir.o zdir_patch.o zfile.o zframe.o zgossip.o zhashx.o ziflist.o zlistx.o zloop.o zmonitor.o zmsg.o zpoller.o zproxy.o zrex.o zsock.o zsock_option.o zstr.o zsys.o zuuid.o zgossip_msg.o zauth_v2.o zbeacon_v2.o zctx.o zhash.o zlist.o zmonitor_v2.o zmutex.o zproxy_v2.o zsocket.o zsockopt.o zthread.o
%.o: ../../src/%.c
$(CC) -c -o $@ $< $(CFLAGS)

all: libczmq.dll # czmq_selftest.exe

libczmq.dll: $(OBJS)
$(CC) -shared -o $@ $(OBJS) -Wl,--out-implib,[email protected] $(LIBDIR) -lzmq -luuid

# the test functions are not exported into the DLL
czmq_selftest.exe: czmq_selftest.o $(OBJS)
$(CC) -o $@ $^ $(LIBDIR) -lzmq -luuid

clean:
del *.o *.a *.dll *.exe

#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Please read the README.txt file in the model directory. #
#################################################################
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ PKG_CHECK_MODULES([zmq], [libzmq])

# Platform specific checks
czmq_on_mingw32="no"
czmq_on_cygwin="no"
czmq_on_android="no"

# Host speciffic checks
Expand Down Expand Up @@ -174,6 +175,7 @@ case "${host_os}" in
# Define on Cygwin to enable all library features
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
AC_DEFINE(CZMQ_HAVE_CYGWIN, 1, [Have Cygwin])
czmq_on_mingw32="yes"
;;
*)
AC_MSG_ERROR([unsupported system: ${host_os}.])
Expand Down Expand Up @@ -209,6 +211,7 @@ if test "x$GCC" = "xyes"; then
fi

AM_CONDITIONAL(ON_MINGW, test "x$czmq_on_mingw32" = "xyes")
AM_CONDITIONAL(ON_CYGWIN, test "x$czmq_on_cygwin" = "xyes")
AM_CONDITIONAL(ON_ANDROID, test "x$czmq_on_android" = "xyes")
AM_CONDITIONAL(INSTALL_MAN, test "x$czmq_install_man" = "xyes")
AM_CONDITIONAL(BUILD_DOC, test "x$czmq_build_doc" = "xyes")
Expand Down
1 change: 1 addition & 0 deletions model/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist_bin_SCRIPTS = \
model/build-autoconf.gsl \
model/build-cmake.gsl \
model/build-mingw32.gsl \
model/build-cygwin.gsl \
model/build-vs2008.gsl \
model/build-vs2010.gsl \
model/build-vs2012.gsl \
Expand Down
6 changes: 6 additions & 0 deletions model/build-autoconf.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ src_lib$(project.name)_la_LDFLAGS += \\
-avoid-version
endif

if ON_CYGWIN
src_lib$(project.name)_la_LDFLAGS += \\
-no-undefined \\
-avoid-version
endif

.if count(package_dependency, defined(package_dependency.for_lib) | defined (package_dependency.for_all)) > 0
src_lib$(project.name)_la_LIBADD = \\
.for package_dependency where defined (package_dependency.for_lib) | defined (package_dependency.for_all)
Expand Down
5 changes: 5 additions & 0 deletions model/build-cmake.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ if (MINGW)
set(MORE_LIBRARIES -lws2_32 -lrpcrt4 -liphlpapi)
endif()

# required libraries for cygwin
if (CYGWIN)
set(MORE_LIBRARIES -luuid)
endif()

########################################################################
# ZeroMQ depedency
########################################################################
Expand Down
44 changes: 44 additions & 0 deletions model/build-cygwin.gsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.# Generate cygwin makefile for project
.#
.# This is a code generator built using the iMatix GSL code generation
.# language. See https://github.com/imatix/gsl for details. This script
.# is licensed under MIT/X11.
.#
.echo "Generating builds/cygwin/Makefile.cygwin..."
.output "../builds/cygwin/Makefile.cygwin"
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Please read the README.txt file in the model directory. #
#################################################################

CC=gcc
# replace the following with wherever you have installed libzmq
PREFIX=/usr/local
INCDIR=-I$\(PREFIX)/include -I.
LIBDIR=-L$\(PREFIX)/lib
CFLAGS=-Wall -Os -g -DLIB$(PROJECT.NAME)_EXPORTS $\(INCDIR)

OBJS =\
.for class
$(name).o\
.endfor

%.o: ../../src/%.c
$\(CC) -c -o $@ $< $\(CFLAGS)

all: lib$(project.name).dll # $(project.name)_selftest.exe

lib$(project.name).dll: $\(OBJS)
$\(CC) -shared -o $@ $\(OBJS) -Wl,--out-implib,[email protected] $\(LIBDIR) -lzmq -luuid

# the test functions are not exported into the DLL
$(project.name)_selftest.exe: $(project.name)_selftest.o $\(OBJS)
$\(CC) -o $@ $^ $\(LIBDIR) -lzmq -luuid

clean:
del *.o *.a *.dll *.exe

#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Please read the README.txt file in the model directory. #
#################################################################
1 change: 1 addition & 0 deletions model/generate
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# - add a new project class (project.xml)

mkdir -p ../builds/mingw32
mkdir -p ../builds/cygwin
mkdir -p ../builds/android
mkdir -p ../builds/msvc/vs2008/czmq
mkdir -p ../builds/msvc/vs2008/czmq_selftest
Expand Down
1 change: 1 addition & 0 deletions model/generate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REM - add a new project class (project.xml)
REM - modify one of the referenced gsl templates (*.gsl)

mkdir ..\builds\mingw32
mkdir ..\builds\cygwin
mkdir ..\builds\android
mkdir ..\builds\msvc\vs2008\czmq
mkdir ..\builds\msvc\vs2008\czmq_selftest
Expand Down
1 change: 1 addition & 0 deletions model/project.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.include "build-cmake.gsl"
.include "build-android.gsl"
.include "build-mingw32.gsl"
.include "build-cygwin.gsl"
.include "build-vs2008.gsl"
.include "build-vs2010.gsl"
.include "build-vs2012.gsl"
Expand Down

0 comments on commit 2fedfe5

Please sign in to comment.