Skip to content

Instantly share code, notes, and snippets.

@claws
Created July 12, 2014 12:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claws/57e66cbb4858cbd20b8e to your computer and use it in GitHub Desktop.
Save claws/57e66cbb4858cbd20b8e to your computer and use it in GitHub Desktop.
This gist shows a method for using Saltstack to automate the build and install of libsodium, libzmq, czmq and pyzmq. This state can be used to keep the ZMQ stack up to date.
#
# Author: Chris Laws
#
# This saltstack state automates the build and install of the
# current version of the Github master branch for libsodium,
# libzmq, czmq and pyzmq (for both python2 and python3).
#
# This state is part of a suite of states I use to recreate my
# development machine and keep it up to date. It contains some
# configuration instructions that slightly beyond the common
# content in many saltstack examples and may be useful to someone
# else.
#
#
# This state depends on the normal build tools required to
# build and install the ZMQ stack such as build-essential,
# libtool, automake, autoconf, python2, python3, etc. These
# dependencies are not included in this state but could be
# constructed similar to this:
#
# build-tools-pkgs:
# pkg.installed:
# - names:
# - build-essential
# - libtool
# - automake
# - autoconf
#
# This state depends on the user 'saltuser' being present
# on the system and declared in the pillar's users state file.
# You can strip this dependency out - its just how my state
# setup is structured.
#
{% if 'saltuser' in pillar['users'] %}
project_directory:
file.directory:
- name: /srv/projects
- user: saltuser
- group: saltuser
- makedirs: True
- mode: 744
https://github.com/jedisct1/libsodium:
git.latest:
- rev: master
- force: True
- target: /srv/projects/libsodium
- user: saltuser
- require:
- file: project_directory
cmd.wait:
- name: |
git clean -xdf
NPROCS=`grep -c ^processor /proc/cpuinfo`
./autogen.sh
./configure
make -j$NPROCS
make install
- cwd: /srv/projects/libsodium
- watch:
- git: https://github.com/jedisct1/libsodium
https://github.com/zeromq/libzmq:
git.latest:
- rev: master
- force: True
- target: /srv/projects/libzmq
- user: saltuser
- require:
- file: project_directory
cmd.wait:
- name: |
git clean -xdf
NPROCS=`grep -c ^processor /proc/cpuinfo`
./autogen.sh
./configure --with-pgm --with-libsodium
make -j$NPROCS
make install
- cwd: /srv/projects/libzmq
- watch:
- git: https://github.com/zeromq/libzmq
https://github.com/zeromq/czmq:
git.latest:
- rev: master
- force: True
- target: /srv/projects/czmq
- user: saltuser
- require:
- file: project_directory
cmd.wait:
- name: |
git clean -xdf
NPROCS=`grep -c ^processor /proc/cpuinfo`
./autogen.sh
./configure
make -j$NPROCS
make install
- cwd: /srv/projects/czmq
- watch:
- git: https://github.com/zeromq/czmq
# pyzmq depends on python and Cython. These are already installed
# as part of other states.
#
https://github.com/zeromq/pyzmq:
git.latest:
- rev: master
- force: True
- target: /srv/projects/pyzmq
- user: saltuser
- require:
- file: project_directory
cmd.wait:
- name: |
git clean -xdf
python setup.py configure --zmq=/usr/local
python setup.py install
git clean -xdf
python3 setup.py configure --zmq=/usr/local
python3 setup.py install
- env:
- LD_LIBRARY_PATH: /usr/local/lib
- cwd: /srv/projects/pyzmq
- watch:
- git: https://github.com/zeromq/pyzmq
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment