diff --git a/Changes b/Changes index 20f10e3..a3b65ea 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,6 @@ Revision history for Perl extension Hash::v10. -0.01 Wed Feb 4 15:39:00 2015 +0.02 Wed Feb 4 15:39:00 2015 - original version; created by h2xs 1.23 with options -n Hash::v10 diff --git a/Makefile.PL b/Makefile.PL index 8217043..47f5fef 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -17,10 +17,10 @@ WriteMakefile( INC => '-I.', # e.g., '-I. -I/usr/include/other' # Un-comment this if you add C files to link with later: #OBJECT => '$(O_FILES)', # link all the C files too - dynamic_lib => { + macro => { LIBHV => 'libhv.so' }, + dynamic_lib => { INST_DYNAMIC_DEP => '$(INST_ARCHAUTODIR)/libhv.$(DLEXT)', - OTHERLDFLAGS => '-L$(INST_ARCHAUTODIR) -Wl,-rpath=$(INST_ARCHAUTODIR):'. - '$(PERL_ARCHLIB)/auto/$(FULLEXT) -lhv ', + OTHERLDFLAGS => q{-L$(INST_ARCHAUTODIR) -Wl,-rpath='$${ORIGIN}' -lhv}, }, ); if (eval {require ExtUtils::Constant; 1}) { @@ -46,13 +46,11 @@ else { copy ($fallback, $file) or die "Can't copy $fallback to $file: $!"; } } -sub MY::postamble { q{ - -LIBHV = libhv.so +sub MY::postamble { q{ src/$(LIBHV): - $(MAKE) -C src brew $(PASSTHRU) - $(MAKE) -C src $(LIBHV) $(PASSTHRU) + $(MAKE) -C brew perl-5.10.1 + $(MAKE) -C src PERL=$(CURDIR)/brew/perl-5.10.1 $(LIBHV) $(INST_DYNAMIC_DEP): src/$(LIBHV) install -m 755 $< $@ @@ -60,6 +58,8 @@ $(INST_DYNAMIC_DEP): src/$(LIBHV) clean :: $(MAKE) -C src clean -.PHONY : src/$(LIBHV) +realclean :: + $(MAKE) -C brew clean +.PHONY : src/$(LIBHV) } } diff --git a/README b/README index 998d7ca..865e81e 100644 --- a/README +++ b/README @@ -7,6 +7,9 @@ in perl v5.18 and above. It achieves this by embedding a perl v5.10 interpeters HV implementation, and allowing you to tie() specific hashes back to having earlier hash semantics. +The source code for this project may also serve as a starting point for +other reverse compatibility solutions via interpreter embedding. + INSTALLATION To install this module type the following: diff --git a/brew/Makefile b/brew/Makefile new file mode 100644 index 0000000..39ac40b --- /dev/null +++ b/brew/Makefile @@ -0,0 +1,23 @@ +TARGET ?= perl-5.10.1 +export PERLBREW_ROOT = $(CURDIR)/root +export PERLBREW_HOME = $(CURDIR)/home +export PERLBREW_CONFIGURE_FLAGS = -de -A ccflags=-fPIC + +target : $(TARGET) + +$(PERLBREW_ROOT) : + perlbrew init + +$(PERLBREW_ROOT)/perls/$(TARGET) : $(PERLBREW_ROOT) + perlbrew --notest install $(TARGET) + +$(TARGET) : $(PERLBREW_ROOT)/perls/$(TARGET) + echo '#!/bin/bash' > $@ + echo 'export PERLBREW_HOME=$(CURDIR)/home' >> $@ + echo 'export PERLBREW_ROOT=$(CURDIR)/root' >> $@ + echo 'source $(PERLBREW_ROOT)/etc/bashrc' >> $@ + echo 'exec perlbrew --quiet exec --with $(TARGET) perl "$$@"' >> $@ + chmod +x $@ + +clean : + rm -rf perl-* $(PERLBREW_ROOT) $(PERLBREW_HOME) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f5831f6 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +libhash-v10-perl (0.02) trusty; urgency=low + + * Initial Release. + + -- Robert Stone Tue, 10 Feb 2015 16:26:01 -0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..1be1909 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: libhash-v10-perl +Section: perl +Priority: optional +Maintainer: Robert Stone +Build-Depends: debhelper (>= 9.20120312), + perl +Standards-Version: 3.9.5 +Homepage: https://metacpan.org/release/Hash-v10 + +Package: libhash-v10-perl +Architecture: any +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Perl extension for perl v5.10 compatible hashes + This provides a perl v5.10 compatible hash. It is intended as a last resort + for porting stubborn code across the "Hash randomization" feature in perl + v5.18 and above. It achieves this by embedding a perl v5.10 interpeters HV + implementation, and allowing you to tie() specific hashes back to having + earlier hash semantics. + . + The source code for this project may also serve as a starting point for other + reverse compatibility solutions via interpreter embedding. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..33c1a16 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,28 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Source: https://metacpan.org/release/Hash-v10 +Upstream-Contact: Robert Stone, +Upstream-Name: Hash-v10 + +Files: * +Copyright: Robert Stone, +License: Artistic or GPL-1+ + +Files: debian/* +Copyright: 2015, Robert Stone +License: Artistic or GPL-1+ + +License: Artistic + This program is free software; you can redistribute it and/or modify + it under the terms of the Artistic License, which comes with Perl. + . + On Debian systems, the complete text of the Artistic License can be + found in `/usr/share/common-licenses/Artistic'. + +License: GPL-1+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + . + On Debian systems, the complete text of version 1 of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL-1'. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2d33f6a --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/src/Makefile b/src/Makefile index da02ce4..9c8b726 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,50 +1,21 @@ -PERLVER = perl-5.10.1 -export PERLBREW_ROOT = $(CURDIR)/root - -target: brew libhv.so -brew: $(PERLBREW_ROOT)/perls/$(PERLVER) - -#### Rules to bootstrap perlbrew -PERL = env PERLBREW_ROOT=$(PERLBREW_ROOT) \ - perlbrew --quiet exec --with $(PERLVER) perl - -$(PERLBREW_ROOT): export PERLBREW_HOME = $(CURDIR)/home -$(PERLBREW_ROOT): - perlbrew init - -$(PERLBREW_ROOT)/perls/$(PERLVER): export PERLBREW_CONFIGURE_FLAGS = -de -A ccflags=-fPIC -$(PERLBREW_ROOT)/perls/$(PERLVER): $(PERLBREW_ROOT) - perlbrew --notest install $(PERLVER) - -#### Rules to build the envelope .so around around libperl.a - +PERL ?= $(CURDIR)/../brew/perl-5.10.1 ARCHLIB = $(shell $(PERL) -MConfig -e 'print $$Config{archlib}') LIBS = $(shell $(PERL) -MConfig -e 'print $$Config{libs}') CFLAGS = -fPIC -Wall -O2 -I$(ARCHLIB)/CORE LDFLAGS = $(LIBS) LIBPERL = $(ARCHLIB)/CORE/libperl.a -$(LIBPERL): $(PERLBREW_ROOT)/perls/$(PERLVER) - # using HePV() emits a strict-aliasing warning hv.o: CFLAGS += -Wno-strict-aliasing -libhv.so :: hv.version +libhv.so :: hv.map libhv.so :: hv.o $(LIBPERL) - cc -shared -o $@ -Wl,--version-script=hv.version $^ $(LDFLAGS) - -libhv.o :: $(LIBPERL) -libhv.o :: hv.o - $(LD) --relocatable -o $@ $^ --exclude-libs ALL -L$(ARCHLIB)/CORE -lperl - -try: try.o libhv.o - cc -o try try.o libhv.o $(LDFLAGS) - #cc -o $@ $< -L. -lhv + cc -shared -o $@ -Wl,--version-script=hv.map $^ $(LDFLAGS) -clean: +clean : -rm try *.o *.so *.a -distclean: clean - -rm -r $(PERLBREW_ROOT) +distclean : clean + -rm -rf $(PERLBREW_ROOT) .PHONY: target clean distclean brew diff --git a/src/hv.map b/src/hv.map new file mode 100644 index 0000000..6679409 --- /dev/null +++ b/src/hv.map @@ -0,0 +1,15 @@ +LIBHV_0.02 { + global: + hash_new; + hash_free; + hash_fetch; + hash_store; + hash_exists; + hash_delete; + hash_clear; + hash_scalar; + hash_firstkey; + hash_nextkey; + local: + *; +}; diff --git a/src/hv.version b/src/hv.version deleted file mode 100644 index 0d553fa..0000000 --- a/src/hv.version +++ /dev/null @@ -1,14 +0,0 @@ -libhv { - global: - hash_new; - hash_free; - hash_fetch; - hash_store; - hash_exists; - hash_delete; - hash_clear; - hash_scalar; - hash_firstkey; - hash_nextkey; - local: *; -};