Skip to content

Commit

Permalink
add debian/rules & friends
Browse files Browse the repository at this point in the history
  • Loading branch information
tlby committed Feb 11, 2015
1 parent b39a848 commit a402a2a
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -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

18 changes: 9 additions & 9 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand All @@ -46,20 +46,20 @@ 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 $< $@
clean ::
$(MAKE) -C src clean
.PHONY : src/$(LIBHV)
realclean ::
$(MAKE) -C brew clean
.PHONY : src/$(LIBHV)
} }
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
23 changes: 23 additions & 0 deletions brew/Makefile
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libhash-v10-perl (0.02) trusty; urgency=low

* Initial Release.

-- Robert Stone <[email protected]> Tue, 10 Feb 2015 16:26:01 -0800
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
21 changes: 21 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Source: libhash-v10-perl
Section: perl
Priority: optional
Maintainer: Robert Stone <[email protected]>
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.
28 changes: 28 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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, <[email protected]>
Upstream-Name: Hash-v10

Files: *
Copyright: Robert Stone, <[email protected]>
License: Artistic or GPL-1+

Files: debian/*
Copyright: 2015, Robert Stone <[email protected]>
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'.
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/make -f

%:
dh $@
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
41 changes: 6 additions & 35 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions src/hv.map
Original file line number Diff line number Diff line change
@@ -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:
*;
};
14 changes: 0 additions & 14 deletions src/hv.version

This file was deleted.

0 comments on commit a402a2a

Please sign in to comment.