fix bugs on building extensions
This commit is contained in:
@@ -9,10 +9,14 @@ end
|
|||||||
|
|
||||||
task build: :compile
|
task build: :compile
|
||||||
|
|
||||||
%w[decoders/native decoders/crunch].each do |dir|
|
ext_dirs = %w[decoders/native decoders/crunch]
|
||||||
|
|
||||||
|
ext_dirs.each do |dir|
|
||||||
Rake::ExtensionTask.new(dir) do |ext|
|
Rake::ExtensionTask.new(dir) do |ext|
|
||||||
ext.lib_dir = 'lib/mikunyan'
|
ext.lib_dir = 'lib/mikunyan'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task compile: ext_dirs.map{|e| "compile:#{e}".to_sym}
|
||||||
|
|
||||||
task default: %i[clobber compile spec]
|
task default: %i[clobber compile spec]
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ void Init_crunch()
|
|||||||
VALUE mMikunyan = rb_define_module("Mikunyan");
|
VALUE mMikunyan = rb_define_module("Mikunyan");
|
||||||
VALUE mDecodeHelper = rb_define_module_under(mMikunyan, "DecodeHelper");
|
VALUE mDecodeHelper = rb_define_module_under(mMikunyan, "DecodeHelper");
|
||||||
VALUE cCrunchStream = rb_define_class_under(mDecodeHelper, "CrunchStream", rb_cObject);
|
VALUE cCrunchStream = rb_define_class_under(mDecodeHelper, "CrunchStream", rb_cObject);
|
||||||
rb_attr(cCrunchStream, rb_intern("data"), TRUE, FALSE, TRUE);
|
rb_attr(cCrunchStream, rb_intern("data"), 1, 0, 1);
|
||||||
|
|
||||||
const char* stFileInfoStr[] = {"struct_size", "actual_data_size", "header_size", "total_palette_size", "tables_size", "levels", "level_compressed_size", "color_endpoint_palette_entries", "color_selector_palette_entries", "alpha_endpoint_palette_entries", "alpha_selector_palette_entries"};
|
const char* stFileInfoStr[] = {"struct_size", "actual_data_size", "header_size", "total_palette_size", "tables_size", "levels", "level_compressed_size", "color_endpoint_palette_entries", "color_selector_palette_entries", "alpha_endpoint_palette_entries", "alpha_selector_palette_entries"};
|
||||||
stFileInfo = create_rb_struct(sizeof(stFileInfoStr) / sizeof(char*), stFileInfoStr);
|
stFileInfo = create_rb_struct(sizeof(stFileInfoStr) / sizeof(char*), stFileInfoStr);
|
||||||
|
|||||||
@@ -7,11 +7,30 @@
|
|||||||
#elif !defined BYTE_ORDER
|
#elif !defined BYTE_ORDER
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef LITTLE_ENDIAN
|
|
||||||
#define LITTLE_ENDIAN __LITTLE_ENDIAN
|
#ifndef BYTE_ORDER
|
||||||
|
#if defined(__BYTE_ORDER__)
|
||||||
|
#define BYTE_ORDER __BYTE_ORDER__
|
||||||
|
#elif defined(__BYTE_ORDER)
|
||||||
|
#define BYTE_ORDER __BYTE_ORDER
|
||||||
|
#else
|
||||||
|
#error "Neither BYTE_ORDER nor __BYTE_ORDER__ is defined."
|
||||||
#endif
|
#endif
|
||||||
#ifndef BIG_ENDIAN
|
#endif
|
||||||
|
|
||||||
|
#ifndef LITTLE_ENDIAN
|
||||||
|
#if defined(__LITTLE_ENDIAN)
|
||||||
|
#define LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||||
#define BIG_ENDIAN __BIG_ENDIAN
|
#define BIG_ENDIAN __BIG_ENDIAN
|
||||||
|
#elif defined(__LITTLE_ENDIAN__)
|
||||||
|
#define LITTLE_ENDIAN __LITTLE_ENDIAN__
|
||||||
|
#define BIG_ENDIAN __BIG_ENDIAN__
|
||||||
|
#elif defined(__ORDER_LITTLE_ENDIAN__)
|
||||||
|
#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
|
||||||
|
#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||||
|
#else
|
||||||
|
#error "Neither LITTLE_ENDIAN, __LITTLE_ENDIAN, nor __ORDER_LITTLE_ENDIAN__ is defined."
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
require 'mkmf'
|
require 'mkmf'
|
||||||
|
|
||||||
append_cppflags('-std=c11')
|
append_cppflags('-std=c11')
|
||||||
append_cppflags('-O3')
|
append_cppflags('-O2')
|
||||||
append_cppflags('-Wall')
|
append_cppflags('-Wall')
|
||||||
append_cppflags('-Wextra')
|
append_cppflags('-Wextra')
|
||||||
append_cppflags('-Wvla')
|
append_cppflags('-Wvla')
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|||||||
spec.bindir = 'exe'
|
spec.bindir = 'exe'
|
||||||
spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f)}
|
spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f)}
|
||||||
spec.require_paths = ['lib']
|
spec.require_paths = ['lib']
|
||||||
spec.extensions = ['ext/decoders/native/extconf.rb']
|
spec.extensions = ['ext/decoders/native/extconf.rb', 'ext/decoders/crunch/extconf.rb']
|
||||||
|
|
||||||
spec.add_dependency 'bin_utils', '~> 0'
|
spec.add_dependency 'bin_utils', '~> 0'
|
||||||
spec.add_dependency 'chunky_png', '~> 1'
|
spec.add_dependency 'chunky_png', '~> 1'
|
||||||
|
|||||||
Reference in New Issue
Block a user