Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yaml #397

Merged
merged 3 commits into from
Jun 2, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions recipes/yaml/CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git CMakeLists.txt CMakeLists.txt
index e84c28c..eab70b2 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -3,6 +3,13 @@
cmake_minimum_required (VERSION 2.8)
project (yaml C)

+# Allow the developer to select if Dynamic or Static libraries are built
+OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
+SET (LIB_TYPE STATIC)
+IF (BUILD_SHARED_LIBS)
+ SET (LIB_TYPE SHARED)
+ENDIF (BUILD_SHARED_LIBS)
+
set (YAML_VERSION_MAJOR 0)
set (YAML_VERSION_MINOR 1)
set (YAML_VERSION_PATCH 6)
@@ -12,5 +19,4 @@ file (GLOB SRC src/*.c)

include_directories (include win32)
add_definitions (-DHAVE_CONFIG_H -DYAML_DECLARE_STATIC)
-add_library (yaml STATIC ${SRC})
-
+add_library (yaml ${LIB_TYPE} ${SRC})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going by the CMake file by @gillins on the jpeg recipe, I think you can achieve the same effect by adding two libraries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, adding 2 different ones is the right approach

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, you should prefer it, as it gives you both a static lib and a dynamic lib. Might need to change the name of the static lib, though, so they don't overlap.

maybe yaml_s

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with doing this is this breaks with existing yaml package in defaults. If you could share what you guys are doing to build it there, I would be happy to update this even if it is shared verbally, but I don't think it is a good idea to rename this library and break with the defaults yaml package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like someone created or copied a custom VS solution and projects. This is "land before time" stuff - no history in our repo on it. File modification times between 2010 and 2012.

Suffice to say, the DLL is the one that everyone uses. It should have the default name. The static one can safely have some other name, IMHO (and the defaults channel package does not include it, anyway).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be a way to have both libraries have the same name and only do one build? I initially tried to find something like this, but was unable to get anything like that to work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Windows has 2 different things both with .lib, and you need both of
them. One filename has to change to have both in one package.

On Thu, Apr 21, 2016, 20:04 jakirkham notifications@github.com wrote:

In recipes/yaml/CMakeLists.txt.patch
#397 (comment)
:

++OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
++SET (LIB_TYPE STATIC)
++IF (BUILD_SHARED_LIBS)
++ SET (LIB_TYPE SHARED)
++ENDIF (BUILD_SHARED_LIBS)
++

  • set (YAML_VERSION_MAJOR 0)
  • set (YAML_VERSION_MINOR 1)
  • set (YAML_VERSION_PATCH 6)
    +@@ -12,5 +19,4 @@ file (GLOB SRC src/*.c)
    +
  • include_directories (include win32)
  • add_definitions (-DHAVE_CONFIG_H -DYAML_DECLARE_STATIC)
    +-add_library (yaml STATIC ${SRC})
    +-
    ++add_library (yaml ${LIB_TYPE} ${SRC})

Would there be a way to have both libraries have the same name and only do
one build? I initially tried to find something like this, but was unable to
get anything like that to work.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/conda-forge/staged-recipes/pull/397/files/20da14e8df6aa1519d098c524871ea2191674708#r60678605

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to make sure the import lib for the DLL doesn't get overwritten by your static lib so probably safest to have different names. I was also unable to work out how to do one build for static/shared with cmake for jpeg. This might be because on Linux (and some other OS's) static and shared builds need different compile flags.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit ( 9295684 ) from @msarahan should resolve it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be necromancing an ancient topic, but this static lib name change did indeed break a number of things (as some of the downstream consumers of libyaml are very stable and not often updated, it's taken awhile to discover the issues). We've changed the default back, but made it configurable from cmake (see yaml/libyaml#136) so anyone that might need the new name can at least get it back if they want.

37 changes: 37 additions & 0 deletions recipes/yaml/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
mkdir build
if errorlevel 1 exit 1

cd build
if errorlevel 1 exit 1


for %%X in (
"on"
"off"
) do (
cmake -G ^
"NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DBUILD_SHARED_LIBS=%%X ^
..
if errorlevel 1 exit 1

nmake
if errorlevel 1 exit 1

:: No tests included in the cmake build.
::
:: ctest
:: if errorlevel 1 exit 1
)

copy ..\include\yaml.h %LIBRARY_INC%
if errorlevel 1 exit 1

copy yaml.dll %LIBRARY_BIN%
if errorlevel 1 exit 1

copy yaml.lib %LIBRARY_LIB%
if errorlevel 1 exit 1
7 changes: 7 additions & 0 deletions recipes/yaml/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

./configure \
--prefix="${PREFIX}"
make
make check
make install
53 changes: 53 additions & 0 deletions recipes/yaml/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% set version = "0.1.6" %}

package:
name: yaml
version: {{ version }}

source:
fn: yaml-{{ version }}.tar.gz
url: http://pyyaml.org/download/libyaml/yaml-{{ version }}.tar.gz
md5: 5fe00cda18ca5daeb43762b80c38e06e
patches:
# Change CMakeLists so that we can build static and shared libraries.
# See this PR ( https://github.com/yaml/libyaml/pull/10 ) for details.
- CMakeLists.txt.patch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch ( yaml/libyaml#10 ) let's us build DLLs and LIBs. It was the simplest thing I could come up with. Though improvements are certainly welcome.


build:
number: 0
features:
- vc9 # [win and py27]
- vc10 # [win and py34]
- vc14 # [win and py35]

requirements:
build:
- cmake # [win]
- python # [win]
- pkg-config # [unix]
- libtool # [unix]

test:
requires:
- python {{ environ['PY_VER'] + '*' }} # [win]

commands:
# Check headers.
- test -f "${PREFIX}/include/yaml.h" # [unix]
- if not exist %LIBRARY_INC%\\yaml.h exit 1 # [win]

# Check libraries.
- test -f "${PREFIX}/lib/libyaml.a" # [unix]
- test -f "${PREFIX}/lib/libyaml.dylib" # [osx]
- test -f "${PREFIX}/lib/libyaml.so" # [linux]
- if not exist %LIBRARY_LIB%\\yaml.lib exit 1 # [win]
- if not exist %LIBRARY_BIN%\\yaml.dll exit 1 # [win]

about:
home: http://pyyaml.org/wiki/LibYAML'
license: MIT
summary: A C library for parsing and emitting YAML.

extra:
recipe-maintainers:
- jakirkham