Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project #7

Closed
bioinfornatics opened this issue Nov 13, 2011 · 7 comments
Closed

Project #7

bioinfornatics opened this issue Nov 13, 2011 · 7 comments

Comments

@bioinfornatics
Copy link

Dear,
i would like package your project to my D fedora repo.
but which name i could give to this project ?
On which License your project is released?

@adamdruppe
Copy link
Owner

On Sun, Nov 13, 2011 at 07:07:28AM -0800, jonathan MERCIER wrote:

On which License your project is released.

Most of it is Boost.

@bioinfornatics
Copy link
Author

and what is the project name?
i do a rpm with this name: misc-stuff-including-D-programming-language-web-stuff.rpm ?

and his possible to add a script for build ?

like this one ( i assume project name is DWeb):

#!/usr/bin/env bash

# This file is part of DWeb.
#
#    Foobar 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 3 of the License, or
#    (at your option) any later version.
#
#    Foobar is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

function fail(){
    local position=$1
    echo "Build fail during: ${position}"
    exit 1
}

function usage(){
cat << EOF
usage: $0 options

This script install DWeb library over a machine.

OPTIONS:
    -h      Show this message
    -v      Verbose could be use twice time as -v -v for increase verbosity
    -q      No verbosity
    -f      Add flag to DFLAGS
    -s      Build static lib instead shared lib
    -c      Set compiler default ldc2
    -l      Set lib dir default lib
    -p      Set prefix default /usr/local
EOF
}
PROJECTNAME="DWeb"
DC=ldc2
COMPILER="ldc2"
VERBOSE=0
SHARED_LIB=1
PREFIX="/usr/local"
LIBDIR="lib"
DESTDIR="../install"
LIBDIR_PATH=""
DFLAGS="-w -g -op -c -od../build"

while getopts “hvqscf:l:p:” OPTION
do
    case $OPTION in
        c)
            DC=$OPTARG
            ;;
        h)
            usage
            exit 1
            ;;
        f)
            DFLAGS="${DFLAGS} $OPTARG"
            ;;
        l)
            LIBDIR=$OPTARG
            ;;
        p)
            PREFIX=$OPTARG
            ;;
        q)
            VERBOSE=0
            ;;
        s)
            SHARED_LIB=0
            ;;
        v)
            let VERBOSE++
            ;;
        ?)
            usage
            exit 1
            ;;
    esac
done

LIBDIR_PATH="${DESTDIR}/${PREFIX}/${LIBDIR}"
DOCDIR_PATH="${DESTDIR}/${PREFIX}/share/doc/DWeb"
INCLUDEDIR="${DESTDIR}/${PREFIX}/include/d/DWeb"
DFLAGS="${DFLAGS} -Dd${DOCDIR_PATH} -Hd${INCLUDEDIR}"

if [[ $VERBOSE -ge 1 ]]; then
    echo -e "\033[31mEntering is source directory\033[0;0m"
fi
cd src
#############################################################
if [[ $VERBOSE -ge 1 ]]; then
    echo -e "\033[31mSet DFLAGS\033[0;0m"
fi
case ${DC} in
    ldc | ldc2)
        COMPILER="ldc"
        DFLAGS="${DFLAGS} --output-o"
        if [[ $SHARED_LIB -eq 1 ]]; then
            DFLAGS="${DFLAGS} --output-bc -relocation-model=pic"
        fi
        ;;
    gdmd | gdc)
        COMPILER="gdc"
        DC="gdmd"
        ;;
    dmd)
        COMPILER="dmd"
        if [[ $SHARED_LIB -eq 1 ]]; then
            #DFLAGS="${DFLAGS} -fPIC"
            echo "Currently dmd do not support shared lib!"
            echo "Only ldc support it. So use ldc or use flag -s"
            usage
            exit 1
        fi
        ;;
    ?)
        echo "Unknow compiler: ${DC}"
        echo "Supported compiler ldc, ldc2, gdc, dmd"
        ;;
esac
#############################################################
if [[ $VERBOSE -ge 1 ]]; then
    echo -e "\033[31mCompile ...\033[0;0m"
fi
if [[ $VERBOSE -ge 2 ]]; then
    echo -e "\033[33m${DC} ${DFLAGS} *.d\033[0;0m"
fi
${DC} ${DFLAGS} $(find . -name "*.d")
if [[ $? -ge 1 ]]; then
    fail "Build"
fi
#############################################################
if [[ $VERBOSE -ge 1 ]]; then
    echo -e "\033[31mEntering is build directory\033[0;0m"
fi
cd ../build
#############################################################
if [[ $VERBOSE -ge 1 ]]; then
    echo -e "\033[31mLinking ...\033[0;0m"
fi
if [ ! -e "${LIBDIR_PATH}" ]; then
    mkdir -p ${LIBDIR_PATH}
fi
if [[ $? -ge 1 ]]; then
    fail "mkdir ${LIBDIR_PATH}"
fi
case ${DC} in
    ldc | ldc2)
        if [[ $SHARED_LIB -eq 1 ]]; then
            if [[ $VERBOSE -ge 2 ]]; then
                echo -e "\033[33mllvm-ld -link-as-library -o libDWeb.bc -lm -ldl -lrt -soname=DWeb *.bc\033[0;0m"
            fi
            llvm-ld -link-as-library -o libDWeb.bc -lm -ldl -lrt -soname=DWeb  $(find . -name "*.bc")
            if [[ $? -ge 1 ]]; then
                fail "llvm-ld"
            fi
            if [[ $VERBOSE -ge 2 ]]; then
                echo -e "\033[33mllc -relocation-model=pic libDWeb.bc\033[0;0m"
            fi
            llc -relocation-model=pic libDWeb.bc
            if [[ $? -ge 1 ]]; then
                fail "llc"
            fi
            if [[ $VERBOSE -ge 2 ]]; then
                echo -e "\033[33mgcc -shared libDSQLite.s -o ${LIBDIR_PATH}/libDWeb-${COMPILER}.so\033[0;0m"
            fi
            gcc -shared -Wl,-soname,libDWeb-${COMPILER}.so libDWeb.s -o ${LIBDIR_PATH}/libDWeb-${COMPILER}.so
            if [[ $? -ge 1 ]]; then
                fail "gcc"
            fi
            if [ -e libDWeb.bc ]; then
                rm *.bc
            fi
            if [[ $? -ge 1 ]]; then
                fail "rm *.bc"
            fi
        else
            if [[ $VERBOSE -ge 2 ]]; then
                echo -e "ar rcs ${LIBDIR_PATH}/libDWeb-${COMPILER}.a *.o"
            fi
            ar rcs ${LIBDIR_PATH}/libDWeb-${COMPILER}.a  $(find . -name "*.o")
            if [[ $? -ge 1 ]]; then
                fail "ar"
            fi
            if [[ $VERBOSE -ge 2 ]]; then
                echo -e "{LIBDIR_PATH}/libDWeb-${COMPILER}.a"
            fi
            ranlib ${LIBDIR_PATH}/libDSQLite-${COMPILER}.a
            if [[ $? -ge 1 ]]; then
                fail "ranlib"
            fi
        fi
        ;;
    gdmd | dmd)
        if [[ $SHARED_LIB -eq 1 ]]; then
            echo "not supported"
        else
            if [[ $VERBOSE -ge 2 ]]; then
                echo -e "${DC} -link *.o -of ${LIBDIR_PATH}/libDWeb-${COMPILER}.a"
            fi
            ${DC} -link  $(find . -name "*.o") -of ${LIBDIR_PATH}/libDSQLite-${COMPILER}.a
            if [[ $? -ge 1 ]]; then
                fail "${DC} -link"
            fi
        fi
        ;;
    ?)
        echo "Unknow compiler: ${DC}"
        echo "Supported compiler ldc, ldc2, gdc, dmd"
        ;;
esac

@adamdruppe
Copy link
Owner

On Sun, Nov 13, 2011 at 07:32:00AM -0800, jonathan MERCIER wrote:

and what is the project name?

Eh, I don't have one. It's just a collection of modules to me.

Does it have to be a separate package? The way I'd do it is to
simply copy the modules into a project that uses it.

@bioinfornatics
Copy link
Author

yes i can do separate package but which name i need give for each subproject ?

@adamdruppe
Copy link
Owner

On Sun, Nov 13, 2011 at 07:44:32AM -0800, jonathan MERCIER wrote:

yes i can separate package but which name i need give ?

I don't know.

@bioinfornatics
Copy link
Author

:-)

@adamdruppe
Copy link
Owner

On Sun, Nov 13, 2011 at 08:00:34AM -0800, jonathan MERCIER wrote:

for each package i need named it

Just don't package it. Copy the files into your app's source tree.

That's the sane way to handle dependencies anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants