[Debian-astro-commits] [cspice] 21/48: Replace upstream's build sequence with a Makefile

Rock Storm rockstorm-guest at moszumanska.debian.org
Thu Dec 15 21:32:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

rockstorm-guest pushed a commit to branch debian
in repository cspice.

commit 2bc5062f31e73368bf5bc8bb5aefc51a1b72a4c2
Author: Rock Storm <rockstorm at gmx.com>
Date:   Wed Nov 16 19:32:58 2016 +0100

    Replace upstream's build sequence with a Makefile
---
 debian/Makefile                                    |  77 +++++++++++++++
 .../add-support-for-amd64-architecture.patch       |  74 ---------------
 .../create-and-link-to-shared-libraries.patch      | 105 ---------------------
 .../create-lib-and-exe-missing-directories.patch   |  32 -------
 debian/patches/series                              |   1 -
 debian/rules                                       |  22 +++--
 6 files changed, 89 insertions(+), 222 deletions(-)

diff --git a/debian/Makefile b/debian/Makefile
new file mode 100644
index 0000000..144c1f8
--- /dev/null
+++ b/debian/Makefile
@@ -0,0 +1,77 @@
+#! /bin/sh
+# This makefile "only" invokes the upstream building sequence. It does not
+# install anything itself.
+CC=gcc
+
+### Upstream File Structure ###
+# This Makefile was intended to be placed in the debian folder, which in turn 
+# is placed under the upstream's tree root.
+ROOT_DIR=$(shell cd .; pwd)
+# Build directories are hardcoded by upstream. Therefore the following
+# variables shouldn't be changed nor customised.
+INCLUDE_DIR=$(ROOT_DIR)/include
+LIB_DIR=$(ROOT_DIR)/lib
+EXE_DIR=$(ROOT_DIR)/exe
+SOURCES_DIR=$(ROOT_DIR)/src
+EXE_SRCS=brief chrnos ckbref commnt frmdif inspkt mkspk msopck spacit \
+         spkdif spkmrg tobin toxfr versn
+LIB_SRCS=cspice csupport
+# Upstream ships individual build scripts for each executable. However, a
+# common file is used in case modifing upstream's script is needed.
+COMMON_EXE=$(SOURCES_DIR)/brief_c/mkprodct.csh
+EXECUTABLES=brief chronos ckbrief commnt frmdiff inspekt mkspk msopck \
+            spacit spkdiff spkmerge tobin toxfr version
+COOK=simple states subpt tictoc
+LIBRARIES=cspice.a csupport.a
+
+### Compiler Flags ###
+# Compiler flags are harcoded by upstream. This Makefile allows for some
+# custimization and accepts standard CC and CFLAGS
+COMMON_CFLAGS=-ansi -DNON_UNIX_STDIO -I$(INCLUDE_DIR) $(CFLAGS) $(CPPFLAGS)
+COMMON_LFLAGS=-lm $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+
+build: build-exe build-cook
+build-lib: builddirs $(addprefix $(LIB_DIR)/,$(LIBRARIES))
+build-exe: build-lib $(addprefix $(EXE_DIR)/,$(EXECUTABLES))
+build-cook: build-lib $(addprefix $(EXE_DIR)/,$(COOK))
+
+$(addprefix $(LIB_DIR)/,$(LIBRARIES)):
+	@for idir in $(LIB_SRCS) ; do \
+		export TKCOMPILER="$(CC)"; \
+		export TKCOMPILEOPTIONS="-c -O2 -fPIC $(COMMON_CFLAGS)"; \
+		export TKLINKOPTIONS="$(COMMON_LFLAGS)"; \
+		cd $(SOURCES_DIR)/$$idir; \
+		csh mkprodct.csh; \
+	done 
+
+$(addprefix $(EXE_DIR)/,$(EXECUTABLES)):
+	@for idir in $(EXE_SRCS) ; do \
+		export TKCOMPILER="$(CC)"; \
+		export TKCOMPILEOPTIONS="-c -O2 $(COMMON_CFLAGS)"; \
+		export TKLINKOPTIONS="$(COMMON_LFLAGS)"; \
+		echo "$(SOURCES_DIR)/"$$idir"_c"; \
+		cd "$(SOURCES_DIR)/"$$idir"_c"; \
+		csh $(COMMON_EXE); \
+	done 
+
+$(addprefix $(EXE_DIR)/,$(COOK)):
+	@for idir in cook ; do \
+		export TKCOMPILER="$(CC)"; \
+		export TKCOMPILEOPTIONS="-c -O2 $(COMMON_CFLAGS)"; \
+		export TKLINKOPTIONS="$(COMMON_LFLAGS)"; \
+		echo "$(SOURCES_DIR)/"$$idir"_c"; \
+		cd "$(SOURCES_DIR)/"$$idir"_c"; \
+		csh mkprodct.csh; \
+	done 
+
+builddirs:
+	@if [ ! -d $(EXE_DIR) ] ; then \
+		mkdir $(EXE_DIR); \
+	fi
+	@if [ ! -d $(LIB_DIR) ] ; then \
+		mkdir $(LIB_DIR); \
+	fi
+
+distclean:
+	@rm -f $(EXE_DIR)/*
+	@rm -f $(LIB_DIR)/*
diff --git a/debian/patches/add-support-for-amd64-architecture.patch b/debian/patches/add-support-for-amd64-architecture.patch
index 9ce7659..33dc2f3 100644
--- a/debian/patches/add-support-for-amd64-architecture.patch
+++ b/debian/patches/add-support-for-amd64-architecture.patch
@@ -17,77 +17,3 @@ Author: Rock Storm <rockstorm at gmx.com>
   
  #endif
   
---- a/makeall.csh
-+++ b/makeall.csh
-@@ -5,6 +5,19 @@
- \echo cspice directory.
- \echo
- cd src
-+
-+#
-+#  Set common compiler and linker options for libraries.
-+#
-+if ( `getconf LONG_BIT` == "64" ) then
-+
-+    setenv TKCOMPILEOPTIONS "-c -ansi -m64 -O2 -DNON_UNIX_STDIO -I../../include -fPIC"
-+    setenv TKLINKOPTIONS "-lm -m64"
-+else
-+    setenv TKCOMPILEOPTIONS "-c -ansi -m32 -O2 -DNON_UNIX_STDIO -I../../include -fPIC"
-+    setenv TKLINKOPTIONS "-lm -m32"
-+endif
-+
- \echo
- \echo Creating cspice
- \echo
-@@ -17,6 +30,18 @@
- cd csupport
- chmod u+x mkprodct.csh; ./mkprodct.csh
- cd ..
-+
-+#
-+#  Set common compiler and linker options for binaries.
-+if ( `getconf LONG_BIT` == "64" ) then
-+
-+    setenv TKCOMPILEOPTIONS "-c -ansi -m64 -O2 -DNON_UNIX_STDIO -I../../include"
-+    setenv TKLINKOPTIONS "-lm -m64"
-+else
-+    setenv TKCOMPILEOPTIONS "-c -ansi -m32 -DNON_UNIX_STDIO -I../../include"
-+    setenv TKLINKOPTIONS "-lm -m32"
-+endif
-+
- \echo
- \echo Creating brief_c
- \echo
-@@ -42,12 +67,6 @@
- chmod u+x mkprodct.csh; ./mkprodct.csh
- cd ..
- \echo
--\echo Creating cook_c
--\echo
--cd cook_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
--cd ..
--\echo
- \echo Creating frmdif_c
- \echo
- cd frmdif_c
-@@ -107,5 +126,19 @@
- cd versn_c
- chmod u+x mkprodct.csh; ./mkprodct.csh
- cd ..
-+
-+#
-+#  Bring back the -O2 option for compiling in i386.
-+#
-+if ( `getconf LONG_BIT` == "32" ) then
-+    setenv TKCOMPILEOPTIONS "-c -ansi -m32 -O2 -DNON_UNIX_STDIO -I../../include"
-+endif
-+
-+\echo
-+\echo Creating cook_c
-+\echo
-+cd cook_c
-+chmod u+x mkprodct.csh; ./mkprodct.csh
-+cd ..
- cd ..
- \echo Toolkit Build Complete
diff --git a/debian/patches/create-and-link-to-shared-libraries.patch b/debian/patches/create-and-link-to-shared-libraries.patch
index 98954b6..e19f175 100644
--- a/debian/patches/create-and-link-to-shared-libraries.patch
+++ b/debian/patches/create-and-link-to-shared-libraries.patch
@@ -3,111 +3,6 @@ Subject: Add creation and linking to shared libraries
  the static ones and link the executables to them.
 From: Rock Storm <rockstorm at gmx.com>
 
---- a/makeall.csh
-+++ b/makeall.csh
-@@ -48,83 +48,89 @@
- cd brief_c
- chmod u+x mkprodct.csh; ./mkprodct.csh
- cd ..
-+
-+#
-+#  Set common executable.
-+#
-+setenv COMEXE "./../brief_c/mkprodct.csh"
-+
- \echo
- \echo Creating chrnos_c
- \echo
- cd chrnos_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating ckbref_c
- \echo
- cd ckbref_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating commnt_c
- \echo
- cd commnt_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating frmdif_c
- \echo
- cd frmdif_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating inspkt_c
- \echo
- cd inspkt_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating mkspk_c
- \echo
- cd mkspk_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating msopck_c
- \echo
- cd msopck_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating spacit_c
- \echo
- cd spacit_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating spkdif_c
- \echo
- cd spkdif_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating spkmrg_c
- \echo
- cd spkmrg_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating tobin_c
- \echo
- cd tobin_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating toxfr_c
- \echo
- cd toxfr_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- \echo
- \echo Creating versn_c
- \echo
- cd versn_c
--chmod u+x mkprodct.csh; ./mkprodct.csh
-+$COMEXE
- cd ..
- 
- #
 --- a/src/brief_c/mkprodct.csh
 +++ b/src/brief_c/mkprodct.csh
 @@ -255,7 +255,8 @@
diff --git a/debian/patches/create-lib-and-exe-missing-directories.patch b/debian/patches/create-lib-and-exe-missing-directories.patch
deleted file mode 100644
index 646912c..0000000
--- a/debian/patches/create-lib-and-exe-missing-directories.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Subject: Create lib and exe missing directories
- The installation takes for granted the existence of this two
- directories, so if missing, they must be created.
-From: Rock Storm <rockstorm at gmx.com>
-
---- a/makeall.csh
-+++ b/makeall.csh
-@@ -4,7 +4,15 @@
- \echo The script must be executed from the
- \echo cspice directory.
- \echo
--cd src
-+#
-+#  Create empty directories lib and exe.
-+#
-+if ( ! -d lib ) then
-+    mkdir lib
-+endif
-+if ( ! -d exe ) then
-+    mkdir exe
-+endif
-
- #
- #  Set common compiler and linker options for libraries.
-@@ -18,6 +26,7 @@
-     setenv TKLINKOPTIONS "-lm -m32"
- endif
- 
-+cd src
- \echo
- \echo Creating cspice
- \echo
diff --git a/debian/patches/series b/debian/patches/series
index 3c95261..931a4f6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,2 @@
 add-support-for-amd64-architecture.patch
 create-and-link-to-shared-libraries.patch
-create-lib-and-exe-missing-directories.patch
diff --git a/debian/rules b/debian/rules
index de1a060..06b442f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,19 +38,21 @@ exes=brief \
 #override_dh_auto_configure:
 #	dh_auto_configure -- #	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
 
+override_dh_auto_build:
+	make -f debian/Makefile build
+	dh_auto_build
+
 override_dh_install:
-	csh makeall.csh
-	for exe in $(exes) ; do \
+	# rename cspice binaries from % to cspice-%
+	@for exe in $(exes) ; do \
 		mv exe/$$exe exe/cspice-$$exe ; \
 	done
-	mv lib/cspice.a lib/libcspice.a
-	dh_install
-
-override_dh_clean:
-	rm -f exe/*
-	rm -f lib/*
-	dh_clean
-	
+	# rename static library with a more library-like name
+	@mv lib/cspice.a lib/libcspice.a
+	# whats.new is actually the upstream's changelog. It is excluded here to
+	# keep it from being installed with cspice-doc
+	dh_install --exclude=whats.new
+
 override_dh_installchangelogs:
 	dh_installchangelogs doc/whats.new
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/cspice.git



More information about the Debian-astro-commits mailing list