]> git.proxmox.com Git - libxdgmime-perl.git/commitdiff
update bindings
authorStoiko Ivanov <s.ivanov@proxmox.com>
Sat, 5 Jun 2021 16:02:35 +0000 (16:02 +0000)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 11 Jun 2021 11:52:21 +0000 (11:52 +0000)
by running
`h2xs -P -v 1.0 -F -DHAVE_MMAP -M '^XDG_' -Ofan Xdgmime xdgmime.h`

and selectively adding changes.

upstream xdgmime.h contains all functions also as defines
(preprocessor mangling to add XDG_PREFIX to the function name) - thus
all functions would also be added as constants, which leads to errors
in the automatically generated tests. The functions need to be in
EXPORT_OK, but not added to @names in Makefile.PL.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Xdgmime/Changes
Xdgmime/Makefile.PL
Xdgmime/README
Xdgmime/Xdgmime.xs
Xdgmime/lib/Xdgmime.pm
Xdgmime/t/Xdgmime.t

index 462f9345413d8545bb588fb230f061ea215e43db..2f43e76abcbefba66a3db56c51bae5dc2a3cec26 100644 (file)
@@ -1,5 +1,9 @@
 Revision history for Perl extension Xdgmime.
 
+1.0  Fri Jun 11 11:16:07 2021
+       - updated by running h2xs 1.23 with options
+               -P -v 1.0 -F -DHAVE_MMAP -M '^XDG_' -t PV -Ofan Xdgmime xdgmime.h
+
 0.01  Fri Jun  1 10:46:21 2012
        - original version; created by h2xs 1.23 with options
                xdgmime.h
index de596c2cfe46723327ef6fd7367bea7d6889cf09..c41c99df2b731a97f0a7008fa9ef4f325a737a63 100644 (file)
@@ -1,18 +1,19 @@
-use 5.010001;
+use 5.032001;
 use ExtUtils::MakeMaker;
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
 WriteMakefile(
     NAME              => 'Xdgmime',
-    VERSION_FROM      => 'lib/Xdgmime.pm', # finds $VERSION
+    VERSION_FROM      => 'lib/Xdgmime.pm', # finds $VERSION, requires EU::MM from perl >= 5.5
     PREREQ_PM         => {}, # e.g., Module::Name => 1.1
-    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
-      (ABSTRACT_FROM  => 'lib/Xdgmime.pm', # retrieve abstract from module
-       AUTHOR         => 'root <root@>') : ()),
+    ABSTRACT_FROM     => 'lib/Xdgmime.pm', # retrieve abstract from module
+    AUTHOR            => 'stoiko ivanov <siv@>',
+    #LICENSE           => 'perl',
+    #Value must be from legacy list of licenses here
+    #https://metacpan.org/pod/Module::Build::API
     LIBS              => [''], # e.g., '-lm'
     DEFINE            => '-DHAVE_MMAP', # e.g., '-DHAVE_SOMETHING'
     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
 );
 if  (eval {require ExtUtils::Constant; 1}) {
@@ -21,24 +22,11 @@ if  (eval {require ExtUtils::Constant; 1}) {
   # files to replace their "fallback" counterparts before distributing your
   # changes.
   my @names = (qw(XDG_MIME_TYPE_EMPTY XDG_MIME_TYPE_TEXTPLAIN
-                XDG_MIME_TYPE_UNKNOWN _xdg_mime_mime_type_equal
-                _xdg_mime_mime_type_subclass _xdg_mime_unalias_mime_type
-                xdg_mime_dump xdg_mime_get_generic_icon xdg_mime_get_icon
-                xdg_mime_get_max_buffer_extents xdg_mime_get_mime_parents
-                xdg_mime_get_mime_type_for_data
-                xdg_mime_get_mime_type_for_file
-                xdg_mime_get_mime_type_from_file_name
-                xdg_mime_get_mime_types_from_file_name
-                xdg_mime_is_valid_mime_type xdg_mime_list_mime_parents
-                xdg_mime_media_type_equal xdg_mime_mime_type_equal
-                xdg_mime_mime_type_subclass xdg_mime_register_reload_callback
-                xdg_mime_remove_callback xdg_mime_shutdown xdg_mime_type_empty
-                xdg_mime_type_textplain xdg_mime_type_unknown
-                xdg_mime_unalias_mime_type));
+                XDG_MIME_TYPE_UNKNOWN));
   ExtUtils::Constant::WriteConstants(
                                      NAME         => 'Xdgmime',
                                      NAMES        => \@names,
-                                     DEFAULT_TYPE => 'IV',
+                                     DEFAULT_TYPE => 'PV',
                                      C_FILE       => 'const-c.inc',
                                      XS_FILE      => 'const-xs.inc',
                                   );
index 018c20638895c0868f3323739b324e8afd543417..7e4d0b1e7d85e15ee34043fc29bdcd915cd61e36 100644 (file)
@@ -1,5 +1,5 @@
-Xdgmime version 0.01
-====================
+Xdgmime version 1.0
+===================
 
 The README is used to introduce the module and provide instructions on
 how to install the module, any machine dependencies it may have (for
@@ -31,10 +31,10 @@ COPYRIGHT AND LICENCE
 
 Put the correct copyright and licence information here.
 
-Copyright (C) 2012 by root
+Copyright (C) 2021 by stoiko ivanov
 
 This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.10.1 or,
+it under the same terms as Perl itself, either Perl version 5.32.1 or,
 at your option, any later version of Perl 5 you may have available.
 
 
index edd09bf6a4c8ec33a52f7ded96969c1439d5c145..c474442c67aeab4b4ef0096dcaa162af78f5b1e4 100644 (file)
@@ -1,3 +1,4 @@
+#define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
index eba6889f45d1218f0a96db74da1227b000466cfa..b37e88327a56ed301fda1de0135cf7e820303b40 100644 (file)
@@ -1,6 +1,6 @@
 package Xdgmime;
 
-use 5.010001;
+use 5.032001;
 use strict;
 use warnings;
 use Carp;
@@ -21,30 +21,17 @@ our %EXPORT_TAGS = ( 'all' => [ qw(
        XDG_MIME_TYPE_EMPTY
        XDG_MIME_TYPE_TEXTPLAIN
        XDG_MIME_TYPE_UNKNOWN
-       _xdg_mime_mime_type_equal
-       _xdg_mime_mime_type_subclass
-       _xdg_mime_unalias_mime_type
        xdg_mime_dump
-       xdg_mime_get_generic_icon
-       xdg_mime_get_icon
        xdg_mime_get_max_buffer_extents
-       xdg_mime_get_mime_parents
        xdg_mime_get_mime_type_for_data
        xdg_mime_get_mime_type_for_file
        xdg_mime_get_mime_type_from_file_name
-       xdg_mime_get_mime_types_from_file_name
        xdg_mime_is_valid_mime_type
        xdg_mime_list_mime_parents
        xdg_mime_media_type_equal
        xdg_mime_mime_type_equal
        xdg_mime_mime_type_subclass
-       xdg_mime_register_reload_callback
-       xdg_mime_remove_callback
        xdg_mime_shutdown
-       xdg_mime_type_empty
-       xdg_mime_type_textplain
-       xdg_mime_type_unknown
-       xdg_mime_unalias_mime_type
 ) ] );
 
 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@@ -53,33 +40,20 @@ our @EXPORT = qw(
        XDG_MIME_TYPE_EMPTY
        XDG_MIME_TYPE_TEXTPLAIN
        XDG_MIME_TYPE_UNKNOWN
-       _xdg_mime_mime_type_equal
-       _xdg_mime_mime_type_subclass
-       _xdg_mime_unalias_mime_type
        xdg_mime_dump
-       xdg_mime_get_generic_icon
-       xdg_mime_get_icon
        xdg_mime_get_max_buffer_extents
-       xdg_mime_get_mime_parents
        xdg_mime_get_mime_type_for_data
        xdg_mime_get_mime_type_for_file
        xdg_mime_get_mime_type_from_file_name
-       xdg_mime_get_mime_types_from_file_name
        xdg_mime_is_valid_mime_type
        xdg_mime_list_mime_parents
        xdg_mime_media_type_equal
        xdg_mime_mime_type_equal
        xdg_mime_mime_type_subclass
-       xdg_mime_register_reload_callback
-       xdg_mime_remove_callback
        xdg_mime_shutdown
-       xdg_mime_type_empty
-       xdg_mime_type_textplain
-       xdg_mime_type_unknown
-       xdg_mime_unalias_mime_type
 );
 
-our $VERSION = '0.01';
+our $VERSION = '1.0';
 
 sub AUTOLOAD {
     # This AUTOLOAD is used to 'autoload' constants from the constant()
@@ -109,87 +83,7 @@ XSLoader::load('Xdgmime', $VERSION);
 
 # Preloaded methods go here.
 
-# Autoload methods go after =cut, and are processed by the autosplit program.
+# Autoload methods go after __END__, and are processed by the autosplit program.
 
 1;
 __END__
-# Below is stub documentation for your module. You'd better edit it!
-
-=head1 NAME
-
-Xdgmime - Perl extension for blah blah blah
-
-=head1 SYNOPSIS
-
-  use Xdgmime;
-  blah blah blah
-
-=head1 DESCRIPTION
-
-Stub documentation for Xdgmime, created by h2xs. It looks like the
-author of the extension was negligent enough to leave the stub
-unedited.
-
-Blah blah blah.
-
-=head2 EXPORT
-
-None by default.
-
-=head2 Exportable constants
-
-  XDG_MIME_TYPE_EMPTY
-  XDG_MIME_TYPE_TEXTPLAIN
-  XDG_MIME_TYPE_UNKNOWN
-  _xdg_mime_mime_type_equal
-  _xdg_mime_mime_type_subclass
-  _xdg_mime_unalias_mime_type
-  xdg_mime_dump
-  xdg_mime_get_generic_icon
-  xdg_mime_get_icon
-  xdg_mime_get_max_buffer_extents
-  xdg_mime_get_mime_parents
-  xdg_mime_get_mime_type_for_data
-  xdg_mime_get_mime_type_for_file
-  xdg_mime_get_mime_type_from_file_name
-  xdg_mime_get_mime_types_from_file_name
-  xdg_mime_is_valid_mime_type
-  xdg_mime_list_mime_parents
-  xdg_mime_media_type_equal
-  xdg_mime_mime_type_equal
-  xdg_mime_mime_type_subclass
-  xdg_mime_register_reload_callback
-  xdg_mime_remove_callback
-  xdg_mime_shutdown
-  xdg_mime_type_empty
-  xdg_mime_type_textplain
-  xdg_mime_type_unknown
-  xdg_mime_unalias_mime_type
-
-
-
-=head1 SEE ALSO
-
-Mention other useful documentation such as the documentation of
-related modules or operating system documentation (such as man pages
-in UNIX), or any relevant external documentation such as RFCs or
-standards.
-
-If you have a mailing list set up for your module, mention it here.
-
-If you have a web site set up for your module, mention it here.
-
-=head1 AUTHOR
-
-root, E<lt>root@E<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (C) 2012 by root
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.10.1 or,
-at your option, any later version of Perl 5 you may have available.
-
-
-=cut
index 7af5bac87e3c7dce759ff9b3465c7980fd5bb0ab..b8a799769898f083aa160504677ad2e1a2de927b 100644 (file)
@@ -1,14 +1,33 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl Xdgmime.t'
+# Before 'make install' is performed this script should be runnable with
+# 'make test'. After 'make install' it should work as 'perl Xdgmime.t'
 
 #########################
 
 # change 'tests => 2' to 'tests => last_test_to_print';
 
-use Test::More tests => 1;
+use strict;
+use warnings;
 
+use Test::More tests => 2;
 BEGIN { use_ok('Xdgmime') };
 
+
+my $fail = 0;
+foreach my $constname (qw(
+       XDG_MIME_TYPE_EMPTY XDG_MIME_TYPE_TEXTPLAIN XDG_MIME_TYPE_UNKNOWN)) {
+  next if (eval "my \$a = $constname; 1");
+  if ($@ =~ /^Your vendor has not defined Xdgmime macro $constname/) {
+    print "# pass: $@";
+  } else {
+    print "# fail: $@";
+    $fail = 1;
+  }
+
+}
+
+ok( $fail == 0 , 'Constants' );
+#########################
+
 # Insert your test code below, the Test::More module is use()ed here so read
 # its man page ( perldoc Test::More ) for help writing this test script.