impl / libcurvecpr

A portable implementation of CurveCP
40 stars 10 forks source link

Make libcurvecpr 'tappable' #6

Closed tarcieri closed 11 years ago

tarcieri commented 11 years ago

The brew tap feature would allow OS X users to install libcurvecpr through homebrew:

https://github.com/mxcl/homebrew/wiki/brew-tap

If someone else hasn't done it already, I'd be happy to contribute a recipe for this.

impl commented 11 years ago

Neat idea.

I don't have much experience with OS X or homebrew, but I'd be happy to accept a patch to support this. Would you prefer to host the repository for it? I'll create one otherwise and give you access to it.

tarcieri commented 11 years ago

Whatever works. I'll try to put it together and we can go from there ;)

tarcieri commented 11 years ago

Well, if you can get an initial beta release out (#7) I'll look into making libcurvecpr tappable. Right now I would have to loop in a complete autoconf toolchain.

tarcieri commented 11 years ago

Okay, now that libcurvecpr 0.1.1 is out, I spent a little more time trying to make it "tappable". Here is my current formula:

require 'formula'

class Libcurvecpr < Formula
  homepage 'https://github.com/impl/libcurvecpr'
  version '0.1.1'
  url 'https://github.com/impl/libcurvecpr/releases/download/v0.1.1/libcurvecpr-0.1.1.tar.bz2'
  sha256 '00eb9f7bea20ce1b191de41a2394ccbc59bdf751abe3dae7509c132e5518cfe0'

  depends_on 'libsodium'
  depends_on 'check'

  def install
    system "./configure", "--prefix=#{prefix}"
    system "make check"
    system "make install"
  end
end

But I'm getting this error on build:

$ brew install -v libcurvecpr
==> Downloading https://github.com/impl/libcurvecpr/releases/download/v0.1.1/libcurvecpr-0.1.1.tar.bz2
/usr/bin/curl -f#LA Homebrew 0.9.4 (Ruby 1.8.7-358; Mac OS X 10.8.5) https://github.com/impl/libcurvecpr/releases/download/v0.1.1/libcurvecpr-0.1.1.tar.bz2 -C 0 -o /Library/Caches/Homebrew/libcurvecpr-0.1.1.tar.bz2.incomplete
######################################################################## 100.0%
tar xf /Library/Caches/Homebrew/libcurvecpr-0.1.1.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/libcurvecpr/0.1.1
./configure --prefix=/usr/local/Cellar/libcurvecpr/0.1.1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether cc understands -c and -o together... yes
checking dependency style of cc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking for gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking whether cc understands -c and -o together... (cached) yes
checking dependency style of cc... (cached) gcc3
checking how to run the C preprocessor... cc -E
checking build system type... x86_64-apple-darwin12.5.0
checking host system type... x86_64-apple-darwin12.5.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/Library/ENV/4.3/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin12.5.0 file names to x86_64-apple-darwin12.5.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin12.5.0 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from cc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common -DPIC
checking if cc PIC flag -fno-common -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.5.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for pkg-config... no
checking for CHECK... no
configure: error: in `/private/tmp/libcurvecpr-jWD0/libcurvecpr-0.1.1':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables CHECK_CFLAGS
and CHECK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
==> Configuration
HOMEBREW_VERSION: 0.9.4
HEAD: 08c70fd3414fc5f60dd4f0c2880378c060bfe1bc
CPU: 8-core 64-bit sandybridge
OS X: 10.8.5-x86_64
Xcode: 5.0
CLT: 4.6.0.0.1.1365549073
GCC-4.2: build 5666
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: 2.7.4 => /opt/X11
==> ENV
HOMEBREW_CC: clang
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /usr/local/opt/check/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.8
ACLOCAL_PATH: /usr/local/share/aclocal
OBJC: cc
PATH: /usr/local/Library/ENV/4.3:/usr/local/opt/check/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: libcurvecpr did not build
Logs:       /Users/tony/Library/Logs/Homebrew/libcurvecpr/config.log

It looks like some problem related to the environment, because if I run the same command from a shell then continue the installation is successful:

$ ./configure --prefix=/usr/local/Cellar/libcurvecpr/0.1.1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether cc understands -c and -o together... yes
checking dependency style of cc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking for gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking whether cc understands -c and -o together... (cached) yes
checking dependency style of cc... (cached) gcc3
checking how to run the C preprocessor... cc -E
checking build system type... x86_64-apple-darwin12.5.0
checking host system type... x86_64-apple-darwin12.5.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin12.5.0 file names to x86_64-apple-darwin12.5.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin12.5.0 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from cc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common -DPIC
checking if cc PIC flag -fno-common -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.5.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for CHECK... yes
checking for library containing clock_gettime... no
checking for sodium_init in -lsodium... yes
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking for ssize_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for struct timespec... yes
checking for clock_gettime... no
checking for host_get_clock_service... yes
checking whether C compiler accepts -Werror=unknown-warning-option... yes
checking whether C compiler accepts -Werror=unused-command-line-argument... yes
checking whether C compiler accepts -fno-strict-aliasing... yes
checking whether C compiler accepts -fno-strict-overflow... yes
checking whether the linker accepts -fstack-protector... yes
checking whether C compiler accepts -fstack-protector... yes
checking whether the linker accepts -fstack-protector-all... yes
checking whether C compiler accepts -fstack-protector-all... yes
checking whether C compiler accepts -Wall... yes
checking whether C compiler accepts -Wextra... yes
checking whether C compiler accepts -Wcast-qual... yes
checking whether C compiler accepts -Wcast-align... yes
checking whether C compiler accepts -Winline... yes
checking whether C compiler accepts -Wmissing-prototypes... yes
checking whether C compiler accepts -Wmissing-declarations... yes
checking whether C compiler accepts -Wwrite-strings... yes
checking whether C compiler accepts -Wredundant-decls... yes
checking whether C compiler accepts -Wpointer-arith... yes
checking whether C compiler accepts -Wchar-subscripts... yes
checking whether C compiler accepts -Wshadow... yes
checking whether C compiler accepts -Wstrict-prototypes... yes
checking whether C compiler accepts -Wvariable-decl... no
checking whether C compiler accepts -Winit-self... yes
checking whether C compiler accepts -Wdiv-by-zero... yes
checking whether C compiler accepts -Wsometimes-uninitialized... yes
checking whether C compiler accepts -Wbad-function-cast... yes
checking whether C compiler accepts -Wcomment... yes
checking whether C compiler accepts -Wfloat-equal... yes
checking whether C compiler accepts -Wformat=2... yes
checking whether C compiler accepts -Wimplicit... yes
checking whether C compiler accepts -Wnormalized=id... no
checking whether C compiler accepts -Woverride-init... no
checking whether C compiler accepts -Wparentheses... yes
checking whether C compiler accepts -Wswitch-enum... yes
checking whether C compiler accepts -Wno-unused-parameter... yes
checking whether the linker accepts -Wl,-z,relro... no
checking whether the linker accepts -Wl,-z,now... no
checking whether the linker accepts -Wl,-z,noexecstack... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libcurvecpr/include/Makefile
config.status: creating libcurvecpr/lib/Makefile
config.status: creating libcurvecpr/test/Makefile
config.status: creating libcurvecpr/Makefile
config.status: creating libcurvecpr/libcurvecpr.pc
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
╭─tony@vertex  /private/tmp/libcurvecpr-cR7p/libcurvecpr-0.1.1  ‹master*›
╰─$
1. raise
2. ignore
3. backtrace
4. irb
5. shell
Choose an action: 2
==> make check
==> make install
Fixing /usr/local/Cellar/libcurvecpr/0.1.1/lib/pkgconfig/libcurvecpr.pc permissions from 100644 to 444
Fixing /usr/local/Cellar/libcurvecpr/0.1.1/lib/libcurvecpr.a permissions from 100644 to 444
Fixing /usr/local/Cellar/libcurvecpr/0.1.1/lib/libcurvecpr.1.dylib permissions from 100755 to 444
/usr/local/Cellar/libcurvecpr/0.1.1: 14 files, 108K, built in 32 seconds
impl commented 11 years ago

It looks like it's not finding pkg-config, so I'm guessing you need to add a build dependency (actually, check should also be a build dependency as well). Maybe like this?

depends_on 'check' => :build
depends_on 'pkg-config' => :build
tarcieri commented 11 years ago

Nice, that works for me! Here's a formula that should be tappable:

require 'formula'

class Libcurvecpr < Formula
  homepage 'https://github.com/impl/libcurvecpr'
  version '0.1.1'
  url 'https://github.com/impl/libcurvecpr/releases/download/v0.1.1/libcurvecpr-0.1.1.tar.bz2'
  sha256 '00eb9f7bea20ce1b191de41a2394ccbc59bdf751abe3dae7509c132e5518cfe0'

  depends_on 'libsodium'
  depends_on 'check' => :build
  depends_on 'pkg-config' => :build

  def install
    system "./configure", "--prefix=#{prefix}"
    system "make check"
    system "make install"
  end
end

Not sure how you want to distribute it. You could just place it into the root directory of the repo as libcurvecpr.rb, in which case it'd be available via:

brew tap impl/libcurvecpr

Or maybe you want to make a separate repository for it?

impl commented 11 years ago

The Homebrew documentation seems to stipulate that tappable repositories must begin with 'homebrew-', so I went ahead and put it here: https://github.com/impl/homebrew-libcurvecpr

I don't have easy access to a Mac right now -- want to give it a try and let me know if it works?

Thanks!

tarcieri commented 11 years ago

@impl yeah that's fine, and works for me! Just tapped it and installed it successfully.

Might want to note it in the README for this repo

impl commented 11 years ago

Fantastic. Will do. I'm adding you as a contributor to the repo as well, so feel free to fix anything there that might come up.

Thanks so much for the help!

tarcieri commented 11 years ago

np, thanks for the commit bit ;)