diff options
Diffstat (limited to 'media-libs/rply')
-rw-r--r-- | media-libs/rply/Manifest | 8 | ||||
-rw-r--r-- | media-libs/rply/files/rply-1.01-lc_numeric.patch | 86 | ||||
-rw-r--r-- | media-libs/rply/files/rply-1.01-stdint.h.patch | 185 | ||||
-rw-r--r-- | media-libs/rply/files/rply_CMakeLists.txt | 39 | ||||
-rw-r--r-- | media-libs/rply/metadata.xml | 8 | ||||
-rw-r--r-- | media-libs/rply/rply-1.01-r1.ebuild | 40 |
6 files changed, 366 insertions, 0 deletions
diff --git a/media-libs/rply/Manifest b/media-libs/rply/Manifest new file mode 100644 index 000000000000..447f4a776d11 --- /dev/null +++ b/media-libs/rply/Manifest @@ -0,0 +1,8 @@ +AUX rply-1.01-lc_numeric.patch 2868 SHA256 801a3f777e058df09526dce248ce6d2928f92039ec250590b414a34840f57366 SHA512 f17c4a5c7106f860c68d9eb4ff9bd6f1daa0abf674f8a6130dd80e7744ee800fd74a65e7f563bd70f826b6b9af3aeb5e3f23dd37e3aea3710b6e023e9330d4a3 WHIRLPOOL d123e1ac5cfc4f99db3922533c75da4a44436f331ca4a184acbd8f5ccf7baffe88a978c4e14e298fd4f5d84b7920f284414d7a7f2f4a0e839c0b31a6c636e0f0 +AUX rply-1.01-stdint.h.patch 6326 SHA256 1c64f9118f373a21de38004f9108ce4a18a5c0973b27f3b415ca14943b55aa2c SHA512 a3611eeccd37a18ffa30ba8b9093d29386fb20169bfbb45a581f079580731e431f98a455b2f9c1433f751d77ed5cda7b7a09ef43c5561268345cb8737b7fa834 WHIRLPOOL d6188a0779a7e641c5605b83b9f128394b6234eca1fd78d3c44b5248a391eb66e48ccf0f75d11b24e3315413e07de08bf36a93f185b756c0bd05e20ece65eaa0 +AUX rply_CMakeLists.txt 1256 SHA256 199c2ce955deb05f7c5d3e63a29aa6b3cb12524f96f1a1ee758f878b1683ca00 SHA512 071e58199b832b371211f6b9de8ad517fca8dd5eda2850eef50d9166fa7f3f4ba8f579b7c82afdca34f57246a795957c800449ca8ded8c3af2217a86be634e59 WHIRLPOOL 5e279cffe34cea67b3bb6ecdaf5c26a49800bc4224831f969952c856dd9eeff6d3ea49707f25b48947fe784d08960f04d25f631e720d337c6f571746f84ebb34 +DIST rply-1.01.tar.gz 28903 SHA256 5fb87562ff47a440e43c035f99c20c1e83b409d2b73a7dafea60fa805bb75d7c SHA512 c5d9b8b031bff24ad6ae71a0b3b2fc265cdf9db4386389d48dbe05eac48d2db289d7ca86aa4e7379f8596cf08909c647e74714775b2c699bee31d987ad355474 WHIRLPOOL ae2c24459c6bad8f15f04c17ae267c6521f717d3f78ddfe6e5839528566390a98e3dec2c9e130ad0ae19fbcad1315e0faf3ace6ecce8a5bc79c7dce69898a905 +EBUILD rply-1.01-r1.ebuild 1073 SHA256 9da4e6217d7842c473dfdc259db5ce25916076ba4d084ea619abfaefc3c999b7 SHA512 e87489bd5fc108f1a1fc6be7af9f96102ee0b1643e81ffc4b7387c31efad62462444940c7b561b6638a056306b084fb5824b6809b489f52834f961b17acdb746 WHIRLPOOL dc2cd79468aed1032b49117b7b9d34997bea82cb829976b576a21cc6983896c0c53adebf9424f9c980dd431e35616eff49719721680e813519116da6bb76d667 +MISC ChangeLog 2294 SHA256 cca27dcd2522b875438431c4dd9c0d3bc83467980f6446d83c096f0994b306ea SHA512 0e7096b9619f684f54b3870076f89380be2a393851bf3290e0484b142066fd4be38bac743691db61858aae7ecfb7190c4940bbcfb771d6a237bcb5a20043b3f0 WHIRLPOOL 63efd8fc61e8102a5397cbf6147f2a4a026fd95aa9cd0c96bcd75ea14b8fe82074f7f65d4cb14f9a53aa747b418f2deaaf44306eca578b3f269d8c4b18c9f879 +MISC ChangeLog-2015 761 SHA256 39f0dc1e9f2a26ba98d07315b06157082eb7fb19178c7bcf5f2b19c05c315c1d SHA512 55b8f7c2c44972c4e158b5167bf7d7b7c92dc8d7417076e5a08f54d059fc7ced149414cfff5146abf49330eabb099d7c801766defdc2f905f00dfb9fb590e2ee WHIRLPOOL abf8d163377d21e934ae6a58d0ac69818a999469df93cb1f981db1a58fc328ac5f780425ceac8fee911ee95337ed9b81434a6ad914520a17aec78135124c1498 +MISC metadata.xml 250 SHA256 77ee9703ecb2c8b8d29d1257e52dd65df98daf53d0a4eaec14872a180aa5311b SHA512 fc12ea8d7a62e7510122a1a79230ec6871e157c955e37810adc8441e0a1588cec6bcca80aaa727c43c391275cd9c62fa650ed9bdf0c9c1945f0e159858767cc0 WHIRLPOOL 52eeb936d2bdd3e96dc3b22e276d228a72dbe07320a574a1a4f857c035b58321d724eb542511a1971ad55ffd5cb54664e6a4479e54df2e7e3d687753d0356750 diff --git a/media-libs/rply/files/rply-1.01-lc_numeric.patch b/media-libs/rply/files/rply-1.01-lc_numeric.patch new file mode 100644 index 000000000000..6d98abd95d57 --- /dev/null +++ b/media-libs/rply/files/rply-1.01-lc_numeric.patch @@ -0,0 +1,86 @@ +From 8a7a76b7dcc94e8e71725e26a146330c73377ebd Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gmail.com> +Date: Mon, 26 Sep 2011 04:46:44 -0400 +Subject: [PATCH 2/2] Switch LC_NUMERIC locale to "C" for decimal point + separator safety + +Make sure to switch the LC_NUMERIC locale to "C" when using strtod() and +fpritnf("%g",...) to ensure that '.' is used as the decimal point +separator when reading and writing .ply files. +--- + rply.c | 31 +++++++++++++++++++++++++++---- + 1 files changed, 27 insertions(+), 4 deletions(-) + +diff --git a/rply.c b/rply.c +index 9eaa77f..789c002 100644 +--- a/rply.c ++++ b/rply.c +@@ -12,6 +12,7 @@ + #include <string.h> + #include <limits.h> + #include <float.h> ++#include <locale.h> + #include <stdarg.h> + #include <stdlib.h> + #include <stddef.h> +@@ -1229,13 +1230,27 @@ static int oascii_uint32(p_ply ply, double value) { + } + + static int oascii_float32(p_ply ply, double value) { ++ char *curr_locale; ++ int ret; + if (value < -FLT_MAX || value > FLT_MAX) return 0; +- return fprintf(ply->fp, "%g ", (float) value) > 0; ++ /* Switch locale to C to use '.' as the decimal point separator */ ++ curr_locale = setlocale(LC_NUMERIC, NULL); ++ setlocale(LC_NUMERIC, "C"); ++ ret = fprintf(ply->fp, "%g ", (float) value); ++ setlocale(LC_NUMERIC, curr_locale); ++ return ret > 0; + } + + static int oascii_float64(p_ply ply, double value) { ++ char *curr_locale; ++ int ret; + if (value < -DBL_MAX || value > DBL_MAX) return 0; +- return fprintf(ply->fp, "%g ", value) > 0; ++ /* Switch locale to C to use '.' as the decimal point separator */ ++ curr_locale = setlocale(LC_NUMERIC, NULL); ++ setlocale(LC_NUMERIC, "C"); ++ ret = fprintf(ply->fp, "%g ", value); ++ setlocale(LC_NUMERIC, curr_locale); ++ return ret > 0; + } + + static int obinary_int8(p_ply ply, double value) { +@@ -1336,17 +1351,25 @@ static int iascii_uint32(p_ply ply, double *value) { + } + + static int iascii_float32(p_ply ply, double *value) { +- char *end; ++ char *end, *curr_locale; + if (!ply_read_word(ply)) return 0; ++ /* Switch locale to C to use '.' as the decimal point separator */ ++ curr_locale = setlocale(LC_NUMERIC, NULL); ++ setlocale(LC_NUMERIC, "C"); + *value = strtod(BWORD(ply), &end); ++ setlocale(LC_NUMERIC, curr_locale); + if (*end || *value < -FLT_MAX || *value > FLT_MAX) return 0; + return 1; + } + + static int iascii_float64(p_ply ply, double *value) { +- char *end; ++ char *end, *curr_locale; + if (!ply_read_word(ply)) return 0; ++ /* Switch locale to C to use '.' as the decimal point separator */ ++ curr_locale = setlocale(LC_NUMERIC, NULL); ++ setlocale(LC_NUMERIC, "C"); + *value = strtod(BWORD(ply), &end); ++ setlocale(LC_NUMERIC, curr_locale); + if (*end || *value < -DBL_MAX || *value > DBL_MAX) return 0; + return 1; + } +-- +1.7.6.1 + diff --git a/media-libs/rply/files/rply-1.01-stdint.h.patch b/media-libs/rply/files/rply-1.01-stdint.h.patch new file mode 100644 index 000000000000..45c911643bcb --- /dev/null +++ b/media-libs/rply/files/rply-1.01-stdint.h.patch @@ -0,0 +1,185 @@ +From eeb09032068baed6d81cff01cdfcccd6d55a8152 Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gmail.com> +Date: Mon, 26 Sep 2011 04:45:49 -0400 +Subject: [PATCH 1/2] Use stdint.h types + +Use stdint.h types (int16_t and int32_t) instead of assuming that short +and long must always a specific number of bytes. Also, use strtoul for +reading uint32_t values. +--- + rply.c | 61 ++++++++++++++++++++++++++++--------------------------------- + 1 files changed, 28 insertions(+), 33 deletions(-) + +diff --git a/rply.c b/rply.c +index 042244f..9eaa77f 100644 +--- a/rply.c ++++ b/rply.c +@@ -15,6 +15,7 @@ + #include <stdarg.h> + #include <stdlib.h> + #include <stddef.h> ++#include <stdint.h> + + #include "rply.h" + +@@ -1183,18 +1184,12 @@ static e_ply_storage_mode ply_arch_endian(void) { + static int ply_type_check(void) { + assert(sizeof(char) == 1); + assert(sizeof(unsigned char) == 1); +- assert(sizeof(short) == 2); +- assert(sizeof(unsigned short) == 2); +- assert(sizeof(long) == 4); +- assert(sizeof(unsigned long) == 4); ++ assert(sizeof(long) >= 4); + assert(sizeof(float) == 4); + assert(sizeof(double) == 8); + if (sizeof(char) != 1) return 0; + if (sizeof(unsigned char) != 1) return 0; +- if (sizeof(short) != 2) return 0; +- if (sizeof(unsigned short) != 2) return 0; +- if (sizeof(long) != 4) return 0; +- if (sizeof(unsigned long) != 4) return 0; ++ if (sizeof(long) < 4) return 0; + if (sizeof(float) != 4) return 0; + if (sizeof(double) != 8) return 0; + return 1; +@@ -1214,23 +1209,23 @@ static int oascii_uint8(p_ply ply, double value) { + } + + static int oascii_int16(p_ply ply, double value) { +- if (value > SHRT_MAX || value < SHRT_MIN) return 0; +- return fprintf(ply->fp, "%d ", (short) value) > 0; ++ if (value > INT16_MAX || value < INT16_MIN) return 0; ++ return fprintf(ply->fp, "%d ", (int16_t) value) > 0; + } + + static int oascii_uint16(p_ply ply, double value) { +- if (value > USHRT_MAX || value < 0) return 0; +- return fprintf(ply->fp, "%d ", (unsigned short) value) > 0; ++ if (value > UINT16_MAX || value < 0) return 0; ++ return fprintf(ply->fp, "%d ", (uint16_t) value) > 0; + } + + static int oascii_int32(p_ply ply, double value) { +- if (value > LONG_MAX || value < LONG_MIN) return 0; +- return fprintf(ply->fp, "%d ", (int) value) > 0; ++ if (value > INT32_MAX || value < INT32_MIN) return 0; ++ return fprintf(ply->fp, "%d ", (int32_t) value) > 0; + } + + static int oascii_uint32(p_ply ply, double value) { +- if (value > ULONG_MAX || value < 0) return 0; +- return fprintf(ply->fp, "%d ", (unsigned int) value) > 0; ++ if (value > UINT32_MAX || value < 0) return 0; ++ return fprintf(ply->fp, "%d ", (uint32_t) value) > 0; + } + + static int oascii_float32(p_ply ply, double value) { +@@ -1256,26 +1251,26 @@ static int obinary_uint8(p_ply ply, double value) { + } + + static int obinary_int16(p_ply ply, double value) { +- short int16 = (short) value; +- if (value > SHRT_MAX || value < SHRT_MIN) return 0; ++ int16_t int16 = value; ++ if (value > INT16_MAX || value < INT16_MIN) return 0; + return ply->odriver->ochunk(ply, &int16, sizeof(int16)); + } + + static int obinary_uint16(p_ply ply, double value) { +- unsigned short uint16 = (unsigned short) value; +- if (value > USHRT_MAX || value < 0) return 0; ++ uint16_t uint16 = value; ++ if (value > UINT16_MAX || value < 0) return 0; + return ply->odriver->ochunk(ply, &uint16, sizeof(uint16)); + } + + static int obinary_int32(p_ply ply, double value) { +- long int32 = (long) value; +- if (value > LONG_MAX || value < LONG_MIN) return 0; ++ int32_t int32 = value; ++ if (value > INT32_MAX || value < INT32_MIN) return 0; + return ply->odriver->ochunk(ply, &int32, sizeof(int32)); + } + + static int obinary_uint32(p_ply ply, double value) { +- unsigned long uint32 = (unsigned long) value; +- if (value > ULONG_MAX || value < 0) return 0; ++ uint32_t uint32 = value; ++ if (value > UINT32_MAX || value < 0) return 0; + return ply->odriver->ochunk(ply, &uint32, sizeof(uint32)); + } + +@@ -1312,7 +1307,7 @@ static int iascii_int16(p_ply ply, double *value) { + char *end; + if (!ply_read_word(ply)) return 0; + *value = strtol(BWORD(ply), &end, 10); +- if (*end || *value > SHRT_MAX || *value < SHRT_MIN) return 0; ++ if (*end || *value > INT16_MAX || *value < INT16_MIN) return 0; + return 1; + } + +@@ -1320,7 +1315,7 @@ static int iascii_uint16(p_ply ply, double *value) { + char *end; + if (!ply_read_word(ply)) return 0; + *value = strtol(BWORD(ply), &end, 10); +- if (*end || *value > USHRT_MAX || *value < 0) return 0; ++ if (*end || *value > UINT16_MAX || *value < 0) return 0; + return 1; + } + +@@ -1328,15 +1323,15 @@ static int iascii_int32(p_ply ply, double *value) { + char *end; + if (!ply_read_word(ply)) return 0; + *value = strtol(BWORD(ply), &end, 10); +- if (*end || *value > LONG_MAX || *value < LONG_MIN) return 0; ++ if (*end || *value > INT32_MAX || *value < INT32_MIN) return 0; + return 1; + } + + static int iascii_uint32(p_ply ply, double *value) { + char *end; + if (!ply_read_word(ply)) return 0; +- *value = strtol(BWORD(ply), &end, 10); +- if (*end || *value < 0) return 0; ++ *value = strtoul(BWORD(ply), &end, 10); ++ if (*end || *value > UINT32_MAX || *value < 0) return 0; + return 1; + } + +@@ -1371,28 +1366,28 @@ static int ibinary_uint8(p_ply ply, double *value) { + } + + static int ibinary_int16(p_ply ply, double *value) { +- short int16; ++ int16_t int16; + if (!ply->idriver->ichunk(ply, &int16, sizeof(int16))) return 0; + *value = int16; + return 1; + } + + static int ibinary_uint16(p_ply ply, double *value) { +- unsigned short uint16; ++ uint16_t uint16; + if (!ply->idriver->ichunk(ply, &uint16, sizeof(uint16))) return 0; + *value = uint16; + return 1; + } + + static int ibinary_int32(p_ply ply, double *value) { +- long int32; ++ int32_t int32; + if (!ply->idriver->ichunk(ply, &int32, sizeof(int32))) return 0; + *value = int32; + return 1; + } + + static int ibinary_uint32(p_ply ply, double *value) { +- unsigned long uint32; ++ uint32_t uint32; + if (!ply->idriver->ichunk(ply, &uint32, sizeof(uint32))) return 0; + *value = uint32; + return 1; +-- +1.7.6.1 + diff --git a/media-libs/rply/files/rply_CMakeLists.txt b/media-libs/rply/files/rply_CMakeLists.txt new file mode 100644 index 000000000000..5497fffb225f --- /dev/null +++ b/media-libs/rply/files/rply_CMakeLists.txt @@ -0,0 +1,39 @@ +# Fedora's cmake file for rply +# http://pkgs.fedoraproject.org/gitweb/?p=rply.git;a=blob;f=rply_CMakeLists.txt +PROJECT(rply) +cmake_minimum_required(VERSION 2.6) + +SET(RPLY_LIB_MAJOR_VERSION 1) +SET(RPLY_LIB_MINOR_VERSION 01) + +SET(RPLY_CMAKE_DIR ${CMAKE_SOURCE_DIR}/CMake/ ) +SET(RPLY_LIBRARY librply.so ) + +add_library(rply SHARED rply.c ) +set_target_properties( rply PROPERTIES + VERSION ${RPLY_LIB_MAJOR_VERSION}.${RPLY_LIB_MINOR_VERSION} + SOVERSION ${RPLY_LIB_MAJOR_VERSION} + ) + +include_directories( ${CMAKE_SOURCE_DIR} ) +add_executable(rply_convert etc/convert.c ) +add_executable(rply_dump etc/dump.c ) +add_executable(rply_sconvert etc/sconvert.c ) +target_link_libraries (rply_convert rply) +target_link_libraries (rply_dump rply) +target_link_libraries (rply_sconvert rply) + +# Installs the header files +install(FILES rply.h DESTINATION include/rply) + +# Installs the target file +install(TARGETS rply LIBRARY DESTINATION lib${LIB_SUFFIX}) +install(TARGETS rply_convert RUNTIME DESTINATION bin) +install(TARGETS rply_dump RUNTIME DESTINATION bin) +install(TARGETS rply_sconvert RUNTIME DESTINATION bin) + +#This should be the last line of the project +SUBDIRS( CMake/export ) + + + diff --git a/media-libs/rply/metadata.xml b/media-libs/rply/metadata.xml new file mode 100644 index 000000000000..d18cf05fe0a8 --- /dev/null +++ b/media-libs/rply/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="person"> +<email>tetromino@gentoo.org</email> +<name>Alexandre Rostovtsev</name> +</maintainer> +</pkgmetadata> diff --git a/media-libs/rply/rply-1.01-r1.ebuild b/media-libs/rply/rply-1.01-r1.ebuild new file mode 100644 index 000000000000..b2874323bdd1 --- /dev/null +++ b/media-libs/rply/rply-1.01-r1.ebuild @@ -0,0 +1,40 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit cmake-utils + +DESCRIPTION="A library to read and write PLY files" +HOMEPAGE="http://w3.impa.br/~diego/software/rply/" +# SRC_URI="http://w3.impa.br/~diego/software/rply/${P}.tar.gz" +# Tarball no longer available from upstream website +SRC_URI="https://dev.gentoo.org/~tetromino/distfiles/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc" + +DEPEND="" +RDEPEND="${DEPEND}" + +PATCHES=( + # Use int16_t and int32_t instead of assuming e.g. that sizeof(long) == 4 + "${FILESDIR}/${P}-stdint.h.patch" + # Switch LC_NUMERIC locale to "C" to ensure "." is the decimal separator + "${FILESDIR}/${P}-lc_numeric.patch" +) + +pkg_setup() { + use doc && HTML_DOCS="manual/*" +} + +src_prepare() { + # rply doesn't have *any* build system - not even a Makefile! + # For simplicity, use the cmake file that Fedora maintainers have created + cp "${FILESDIR}/rply_CMakeLists.txt" CMakeLists.txt || die + mkdir -p CMake/export || die + + cmake-utils_src_prepare +} |