Browse Source

Packaging for Arch

Bob Mottram 4 years ago
parent
commit
7d423f139d
5 changed files with 75 additions and 12 deletions
  1. 19 6
      Makefile
  2. 34 0
      PKGBUILD
  3. 16 0
      README.md
  4. BIN
      man/fin.1.gz
  5. 6 6
      src/conversions.c

+ 19 - 6
Makefile

@@ -1,8 +1,10 @@
 APP=fin
 VERSION=1.51
 RELEASE=1
-ARCH_TYPE=`uname -m`
+ARCH_TYPE=$(shell uname -m)
 PREFIX?=/usr/local
+ARCH_BUILD_DIR=${HOME}/abs/${APP}
+CURR_DIR=$(shell pwd)
 
 all:
 	gcc -Wall -std=gnu99 -pedantic -O3 -o ${APP} src/*.c -Isrc -lsqlite3
@@ -11,6 +13,21 @@ debug:
 source:
 	tar -cvf ../${APP}_${VERSION}.orig.tar ../${APP}-${VERSION} --exclude-vcs
 	gzip -f9n ../${APP}_${VERSION}.orig.tar
+arch:
+	rm -f ${APP} *.xz *.sig
+	@if [ ! -d ${ARCH_BUILD_DIR} ]; then\
+		mkdir -p ${ARCH_BUILD_DIR};\
+	fi
+	rm -rf ${ARCH_BUILD_DIR}/*
+	tar -pczf ${ARCH_BUILD_DIR}/${APP}-${VERSION}.tar.gz . --exclude-vcs
+	cp PKGBUILD ${ARCH_BUILD_DIR}
+	gpg -ba ${ARCH_BUILD_DIR}/${APP}-${VERSION}.tar.gz
+	sed -i "s|arch=()|arch=('${ARCH_TYPE}')|g" ${ARCH_BUILD_DIR}/PKGBUILD
+	cd ${ARCH_BUILD_DIR}; updpkgsums; makepkg -f -c -s
+	unxz ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar.xz
+	tar -vf ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar --delete .BUILDINFO
+	xz ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar
+	gpg -ba ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar.xz
 install:
 	mkdir -p ${DESTDIR}/usr
 	mkdir -p ${DESTDIR}${PREFIX}
@@ -25,8 +42,4 @@ uninstall:
 	rm -rf ${PREFIX}/share/${APP}
 	rm -f ${PREFIX}/bin/${APP}
 clean:
-	rm -f ${APP} \#* \.#* gnuplot* *.png debian/*.substvars debian/*.log
-	rm -fr deb.* debian/${APP} rpmpackage/${ARCH_TYPE}
-	rm -f ../${APP}*.deb ../${APP}*.changes ../${APP}*.asc ../${APP}*.dsc
-	rm -f rpmpackage/*.src.rpm archpackage/*.gz archpackage/*.xz
-	rm -f puppypackage/*.gz puppypackage/*.pet slackpackage/*.txz
+	rm -f ${APP} *.xz *.sig \#* \.#* gnuplot* *.png

+ 34 - 0
PKGBUILD

@@ -0,0 +1,34 @@
+# Maintainer: Bob Mottram <bob@freedombone.net>
+pkgname=fin
+pkgver=1.51
+pkgrel=1
+epoch=
+pkgdesc="The command line personal finances manager"
+arch=()
+url="https://github.com/bashrc/fin"
+license=('GPL3')
+groups=()
+depends=('sqlite' 'gnuplot')
+makedepends=('sqlite')
+checkdepends=()
+optdepends=()
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+changelog=
+source=("$pkgname-$pkgver.tar.gz" "$pkgname-$pkgver.tar.gz.asc")
+noextract=()
+md5sums=()
+sha512sums=()
+validpgpkeys=()
+
+build() {
+    make
+}
+
+package() {
+    make DESTDIR="$pkgdir" install
+}

+ 16 - 0
README.md

@@ -17,6 +17,12 @@ on Debian, Ubuntu or Linux Mint:
     make
     sudo make install
 
+or on Arch/Parabola:
+
+    sudo pacman -S base-devel sqlite gnuplot
+    make
+    sudo make install
+
 or on Fedora:
 
     sudo yum groupinstall "Development Tools"
@@ -594,3 +600,13 @@ To subsequently restore from a backup:
     fin restore <filename>
 
 If the backup file has a .bfe extension indicating that it is encrypted then you will be asked for a password to decrypt the data.
+
+
+Packaging for Arch GNU/Linux
+============================
+
+If you are running Arch and want to create a package:
+
+    make arch
+
+The resulting files will then appear within the directory *~/abs/fin*.

BIN
man/fin.1.gz


+ 6 - 6
src/conversions.c

@@ -56,7 +56,7 @@ static void value_to_integer(char * money, char * integer,
     i++;
   }
   decval[ctr]=0;
-  
+
   ctr=0;
   for (i=0;i<strlen(intval);i++) {
     integer[ctr++] = intval[i];
@@ -327,7 +327,7 @@ int reverse_file(char * filename)
           sprintf((char*)header,"%s",line);
         }
         rows++;
-      }      
+      }
     }
     fclose(fp);
   }
@@ -345,7 +345,7 @@ int reverse_file(char * filename)
       while ((!feof(fp)) && (row<i)) {
         if (fgets(line , 255 , fp) != NULL ) {
           row++;
-        }      
+        }
       }
       fclose(fp);
     }
@@ -354,7 +354,7 @@ int reverse_file(char * filename)
     if (fp!=0) {
       fprintf(fp,"%s",line);
       fclose(fp);
-    }    
+    }
   }
 
   if (rows>0) {
@@ -384,11 +384,11 @@ void trim_file_header(char * filename, char * trimmed)
             fprintf(fp_trimmed,"%s",line);
           }
           row++;
-        }       
+        }
       }
 
       fclose(fp_trimmed);
-    }   
+    }
     fclose(fp);
   }
 }