#!/usr/bin/env beesh

# BEE_VERSION perl-wrapper-1.1-1

## this file was created by bee init and should be executed to build a
## bee-package. (Additional hints are located at the end of this file.)

###############################################################################
## The source URL(s) define the location of the sources that will be
## downloaded. Version variables may be used to simplify reuse of this bee-file.

SRCURL[0]=""

###############################################################################
## Add URLs/pathes to patch files to the PATCHURL array.
## The sources will be patched in the order of the array.

# PATCHURL+=()

###############################################################################
## Add filename patterns to the EXCLUDE array of files that should not
## be added to you package but may be present in the image directory.

# EXCLUDE+=()

###############################################################################
## Uncomment the next statement, if the software may not be able to be built
## outside the source directory and needs to be built inside the source
## directory.

# build_in_sourcedir

###############################################################################
## bee cannot detect buildtypes specified in subdirectories.
## Sometimes packages "hide" the real sources in a subdirectory named
## 'src' or 'cmake' or ..
## use 'sourcesubdir_append' to specify this directory if known.

# sourcesubdir_append src


###############################################################################
## Change the default (auto-detected) steps to
## extract, patch, configure/setup, build and install the software.
## Make sure the mee_install function does install everything to the
## image directory "${D}"

#mee_extract() {
#    bee_extract "${@}"
#}

#mee_patch() {
#    bee_patch "${@}"
#}

#mee_configure() {
#    bee_configure
#}

mee_build() {
    echo -e '#! /bin/bash\nprun perl-5.12.1-0 $(basename "$0") "$@"' >wrapper
    chmod +x wrapper
}

mee_install() {
    mkdir -p "$D$BINDIR"

    # list generated by
    # for cmd in $(cd /pkg/perl-5.12.1-0/bin;ls); do test -e /usr/bin/$cmd || echo $cmd;done | fmt -w 80| sed 's/.*/        & \\/'
    #
    for cmd in \
        a2p bdf2gdfont.pl bp_aacomp bp_biofetch_genbank_proxy bp_bioflat_index \
        bp_biogetseq bp_dbsplit bp_download_query_genbank bp_einfo \
        bp_extract_feature_seq bp_fastam9_to_table bp_fetch bp_filter_search \
        bp_find-blast-matches bp_flanks bp_gccalc bp_genbank2gff3 \
        bp_genbank_ref_extractor bp_index bp_local_taxonomydb_query \
        bp_make_mrna_protein bp_mask_by_search bp_mrtrans bp_mutate bp_nexus2nh \
        bp_nrdb bp_oligo_count bp_process_gadfly bp_process_sgd bp_query_entrez_taxa \
        bp_remote_blast.pl bp_revtrans-motif bp_search2alnblocks bp_search2gff \
        bp_search2table bp_search2tribe bp_seq_length bp_seqconvert bp_seqcut \
        bp_seqpart bp_seqret bp_seqretsplit bp_split_seq bp_sreformat bp_taxid4species \
        bp_taxonomy2tree bp_translate_seq bp_tree2pag bp_unflatten_seq c2ph \
        combig-script.sh combig.pl config_data corelist count.pl count2huge.pl cpan \
        cpan-mirrors cpan2dist cpanel_json_xs cpanp cpanp-run-perl crc32 db_archive \
        db_checkpoint db_deadlock db_dump db_hotbackup db_load db_printlog db_recover \
        db_sql db_stat db_upgrade db_verify dbilogstrip dbiprof dbiproxy dm_date \
        dm_zdump dprofpp enc2xs encguess extract_vba find-compounds.pl find2perl \
        findrule gedi h2ph h2xs htmltree huge-count.pl huge-delete.pl huge-merge.pl \
        huge-sort.pl huge-split.pl hypnotoad instmodsh json_pp json_xs kocos-script.sh \
        kocos.pl l4p-tmpl leo libnetcfg lwp-download lwp-dump lwp-mirror lwp-request \
        mech-dump mo-inline modemtest mojo moose-outdated morbo msgconvert net-server \
        odf2pod odf_set_fields odf_set_title odfbuild odfextract odffilesearch \
        odffindbasic odfhighlight odfmetadoc odfsearch oodoc_test oodoc_version \
        package-stash-conflicts pdl pdl2 pdldoc perl5.12.1 perlbug perlcritic perldl \
        perldoc perlivp perlsh perlthanks perltidy piconv pl2pm plackup pod2html \
        pod2latex pod2man pod2text pod2usage pod_cover podchecker podselect podspell \
        pptemplate prove psed pstruct ptar ptardiff ptargrep ptked ptksh puudecode \
        puuencode rank-script.sh rank.pl readline_usb s2p schwartzmon shasum \
        snmpkey splain stag-autoschema.pl stag-db.pl stag-diff.pl stag-drawtree.pl \
        stag-filter.pl stag-findsubtree.pl stag-flatten.pl stag-grep.pl stag-handle.pl \
        stag-itext2simple.pl stag-itext2sxpr.pl stag-itext2xml.pl stag-join.pl \
        stag-merge.pl stag-mogrify.pl stag-parse.pl stag-query.pl stag-splitter.pl \
        stag-view.pl stag-xml2itext.pl statistic.pl streamzip test-yaml text2odf \
        text2table tkjpeg tpage ttree ucalc use-devel-checklib widget xpath \
        xsubpp yamlpp5-events yamlpp5-highlight yamlpp5-load yamlpp5-load-dump \
        yamlpp5-parse-emit zipdetails \
    ; do
        ln "$B/wrapper" "$D$BINDIR/$cmd"
    done
    ln "$B/wrapper" "$D$BINDIR/perl"
    mkdir -p "$D$PREFIX/local/bin"
    ln -s "$BINDIR/perl" "$D$PREFIX/local/bin/perl"
}
## by default this may be 'make install DESTDIR="${D}"'

###############################################################################
##
## Additional hints:
##
## The name of this bee-file should follow the following naming convention:
##     pkgname-pkgversion-pkgrevision.bee
##
## You may remove all comments as long as SRCURL[0] is set.
##
## Everything in this file will be executed in a bash environment.
##
## Build the package by executing
##     './pkg-version-N.bee' or
##     'beesh ./pkg-version-N.bee'
##
## see http://beezinga.org/
##