2 # Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
15 use lib "$FindBin::Bin/perl";
17 use OpenSSL::Util::Pod;
19 if ($#ARGV + 1 != 5 || $ARGV[0] !~ /^(un)?install$/) {
20 print "Usage: write-man-symlinks [install|uninstall] src-dir build-dir man-page-name target-dir\n";
24 my $action = $ARGV[0];
25 my $srcdir = $ARGV[1];
26 my $builddir = $ARGV[2];
27 my $manname = $ARGV[3];
28 my $targetdir = $ARGV[4];
30 $manname =~ m|(.+)\.(.+)|;
33 die "Bad src file" if !defined $mainf;
34 my $podfile = "$srcdir/$mainf.pod";
35 #Some pod files are generated and are in the build dir
36 unless (-e $podfile) {
37 $podfile = "$builddir/$mainf.pod";
39 my %podinfo = extract_pod_info($podfile);
41 for my $name (@{$podinfo{names}}) {
42 next if $name eq $mainf;
43 if ($action eq "install") {
44 symlink "$targetdir/$manname", "$targetdir/$name.$section";
46 unlink "$targetdir/$name.$section";