Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tidy up cmd and support DESTDIR for package installation

  • Loading branch information...
commit d33e6e13bfbf55e8eb5e52db429b1769c3c5dec3 1 parent c357dc0
Anil Madhavapeddy authored

Showing 1 changed file with 7 additions and 7 deletions. Show diff stats Hide diff stats

  1. +7 7 repos/skeleton/cmd
14 repos/skeleton/cmd
... ... @@ -1,4 +1,4 @@
1   -#!/bin/sh -ex
  1 +#!/bin/sh -e
2 2 # Script that invokes ocamlbuild commands for various targets
3 3
4 4 # source the package variables
@@ -12,20 +12,18 @@ OCAMLBUILD_FLAGS=-classic-display
12 12 # create entries in the _config/ directory
13 13 function configure {
14 14 # initialise _config directory
15   - rm -rf _config
16   - mkdir -p _config
  15 + rm -rf _config && mkdir -p _config
17 16 # _config/inc has -I flags
18 17 ocamlfind query -r -i-format ${DEPS} > _config/flags.ocaml
19 18 # _config/archives.* contains dependency archives for linking tests
20 19 ocamlfind query -r -a-format -predicates native ${DEPS} > _config/archives.native
21 20 ocamlfind query -r -a-format -predicates byte ${DEPS} > _config/archives.byte
22   - # _config/built.runtime contains the archive files
23   - echo ${RUNTIME} > _config/clibs
24 21 # _config/pp has camlp4 flags for the library and binaries
25 22 ocamlfind query -r -predicates syntax,preprocessor -format '-I %d %A' ${DEPS} > _config/syntax.deps
26 23 # _config/syntax has flags to build p4 extensions in syntax/
27 24 ocamlfind query -r -predicates syntax,preprocessor -format '-I %d %A' camlp4.quotations.o camlp4.lib camlp4.extend > _config/syntax.build
28 25 echo ${SYNTAX} > _config/syntax
  26 + echo ${RUNTIME} > _config/clibs
29 27 echo ${LIB} > _config/lib
30 28 # TODO check ocamlopt is installed
31 29 touch _config/flag.opt
@@ -43,9 +41,11 @@ function compile {
43 41 function install {
44 42 sed -e "s/@VERSION@/${VERSION}/g" < META.in > _config/META
45 43 ocamlfind remove ${NAME} || true
46   - # TODO DESTDIR and OCAMLFIND_FLAGS from environment
47 44 t=`sed -e 's,^,_build/,g' < _build/${NAME}.all`
48   - ocamlfind install ${NAME} _config/META ${t}
  45 + if [ ! -z "${DESTDIR}" ]; then
  46 + OCAMLFIND_FLAGS="${OCAMLFIND_FLAGS} -destdir ${DESTDIR}"
  47 + fi
  48 + ocamlfind install ${OCAMLFIND_FLAGS} ${NAME} _config/META ${t}
49 49 }
50 50
51 51 # tests also include the built syntax extensions (if any)

0 comments on commit d33e6e1

Please sign in to comment.
Something went wrong with that request. Please try again.