[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

need help for the ocaml-native-compilers split ...



Hello, ...

I have a problem with the dbeina/rule i am using right now, and would like to
ask for advice on how to best solve this. I should really go looking into the
makefiles doc and/or the shell docs, to solve it, but am low on time right now
...

Basically , it goes like that :

I want to set a variable $(OPT_BUILT) to yes when i built the opt.opt target,
and to no if i didn't build them. So i can later copy the files to the
ocaml-native-compilers package if it is yes, and have ocaml provide
ocaml-bnest-compilers if it is no.

I did it like that :

...
OPT_BUILT=no                                                                    
...
build:
...
        if test -z `grep "ARCH=none" config/Makefile`;          \
                then $(MAKE) opt;                               \
                if test -z `grep "ARCH=ia64" config/Makefile`; then     \
                        echo "Building native compilers";       \
                        $(MAKE) opt.opt;                        \
                        export OPT_BUILT=yes;                   \
                fi;                                             \
        fi                                                                      
...
install:
...
        if [ $(OPT_BUILT) = yes ]; then                                 \
                dh_movefiles -pocaml-native-compilers                   \
                        --sourcedir=debian/ocaml;                       \
        fi                                    
...
binary:
...
        if [ $(OPT_BUILT) = no ]; then                          \
          dh_gencontrol -pocaml                                 \
                -u-VF:BestProvides="ocaml-best-compilers,";     \
          dh_gencontrol -pocaml-base;                           \
        else dh_gencontrol -s;                                  \
        fi                                                                      
...

It would work well, but naturally, you cannot set a Makefile variable from a
shell script, and as thus, OPT_BUILT don't get set correctly.

I could solve this by setting a list of arches to build in a makefile
variable, and test if we are on such an arch, and set the OPT_BUILT variable
acordyingly, but, well, it would be nice to have this done automatically.

I could also generate the arch file of the ocaml-native-compilers from this
list with a substvar, and maybe this is what i will do, so the arch list for
opt.opt is stored at only one place.

Friendly,

Sven Luther



Reply to: