[liblinear/el5] Initial import (#995864)

Björn Esser besser82 at fedoraproject.org
Fri Aug 16 17:56:32 UTC 2013


commit 827ed3733670a3446779a455f7ede3d4f861323a
Author: Björn Esser <bjoern.esser at gmail.com>
Date:   Fri Aug 16 19:46:16 2013 +0200

    Initial import (#995864)

 .gitignore                            |    5 +
 FAQ.html                              |  514 +++++++++++++++++++++++++++++++++
 exp.html                              |  277 ++++++++++++++++++
 index.html                            |  325 +++++++++++++++++++++
 liblinear-adapt_makefile.patch        |   56 ++++
 liblinear-fix_compiler_warnings.patch |   76 +++++
 liblinear.pc.in                       |   14 +
 liblinear.spec                        |  208 +++++++++++++
 sources                               |    2 +
 9 files changed, 1477 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..28acc45 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*~
+*.rpm
+*.tar*
+results_*/
+/liblinear.pdf
diff --git a/FAQ.html b/FAQ.html
new file mode 100644
index 0000000..0c0663a
--- /dev/null
+++ b/FAQ.html
@@ -0,0 +1,514 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>LIBLINEAR FAQ</title>
+  </head>
+<body text="#000000" bgcolor="#FFEFD5" link="#FF0000" vlink="#0000FF">
+
+  <body>
+    <h1><a href=http://www.csie.ntu.edu.tw/~cjlin/liblinear>LIBLINEAR</a> FAQ</h1>
+
+Last modified:
+<script>
+document.write(document.lastModified);
+</script>
+
+<p>
+Some questions are listed in <a href=../libsvm/faq.html>LIBSVM FAQ</a>. 
+<hr>
+<h3>Table of Contents</h3>
+<a href="#introduction_installation_and_documents"> Introduction, Installation, and Documents <br>
+<a href="#data"> Data <br>
+<a href="#training_and_prediction"> Training and Prediction <br>
+<a href="#python_interface"> Python Interface <br>
+<a href="#l1_regularized_classification"> L1-regularized Classification <br>
+<a href="#l2_regularized_support_vector_regression"> L2-regularized Support Vector Regression <br>
+<p><hr>
+
+<a name="introduction_installation_and_documents"> <h3>Introduction, Installation, and Documents</h3>
+
+<b>Q: When to use LIBLINEAR but not LIBSVM?</b>
+
+<p>
+Please check our explanation on the <a href=./index.html>LIBLINEAR</a> webpage. Also see 
+appendix C of our 
+<a href=../papers/guide/guide.pdf>SVM guide</a>.
+<hr>
+
+<b>Q: Where can I find documents of LIBLINEAR?</b>
+
+<p>
+Please see <a href=index.html#document>the descriptions</a>
+at LIBLINEAR page.
+
+<hr>
+
+<b>Q: I would like to cite LIBLINEAR. Which paper should I cite?</b>
+<p>
+Please cite the following paper:
+<p>
+R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin.
+LIBLINEAR: A Library for Large Linear Classification, Journal of
+Machine Learning Research 9(2008), 1871-1874. Software available at
+http://www.csie.ntu.edu.tw/~cjlin/liblinear
+
+<p>
+The bibtex format is 
+<pre>
+ at Article{REF08a,
+  author = 	 {Rong-En Fan and Kai-Wei Chang and Cho-Jui Hsieh and Xiang-Rui Wang and Chih-Jen Lin},
+  title = 	 {{LIBLINEAR}: A Library for Large Linear Classification},
+  journal = 	 {Journal of Machine Learning Research},
+  year = 	 {2008},
+  volume =	 {9},
+  pages =	 {1871--1874}
+}
+</pre>
+
+<hr>
+
+
+<b>Q: Where are change log and earlier versions?
+</b>
+
+<p>
+
+See the change <a href=log>log</a> and <a href=oldfiles>directory
+for earlier/current versions</a>.
+
+
+<hr>
+<b>Q: How do I choose the solver? Should I use logistic regression or linear SVM? How about L1/L2 regularization?</b>
+
+<p>
+Generally we recommend linear SVM as its training is faster and the accuracy is competitive.
+However, if you would like to have
+probability outputs, you may consider
+logistic regression.
+
+<p> Moreover, try L2 regularization first unless
+you need a sparse model. 
+For most cases, L1 regularization does not give 
+higher accuracy but may be slightly slower in training.
+
+<p> Among L2-regularized SVM solvers, try the 
+default one (L2-loss SVC dual) first. If it
+is too slow, 
+use the option -s 2 to solve the primal problem.
+
+<hr>
+
+<a name="data"> <h3>Data</h3>
+
+<b>Q: Is it important to normalize each instance?</b>
+
+<p>
+For document classification,
+our experience indicates that if you normalize each document to unit length, then not only the training time is shorter, but also the performance is better.
+
+<hr>
+
+<b>Q: How could I use MATLAB/OCTAVE interface for fast dataload?</b>
+
+<p>
+If you need to read the same data set several
+times, saving data in MATLAB/OCTAVE binary
+formats can significantly reduce the loading time.
+The following
+MATLAB code generates a
+binary file rcv1_test.mat:
+<pre>
+[rcv1_test_labels,rcv1_test_inst] = libsvmread('../rcv1_test.binary');
+save rcv1_test.mat rcv1_test_labels rcv1_test_inst;
+</pre>
+For OCTAVE user, use
+<pre>
+save -mat7-binary rcv1_test.mat rcv1_test_labels rcv1_test_inst;
+</pre>
+to save rcv1_test.mat in MATLAB 7 binary format.
+(Or you can use -binary to save in OCTAVE binary format)
+Then, type
+<pre>
+load rcv1_test.mat
+</pre>
+to read data.
+A simple experiment shows that read_sparse takes 88 seconds to read a
+data set rcv1 with half million instances,
+but it costs only 7 seconds to load the MATLAB binary file.
+Please type
+<pre>
+help save
+</pre>
+in MATLAB/OCTAVE for further information.
+
+<hr>
+
+<a name="training_and_prediction"> <h3>Training and Prediction</h3>
+
+<b>Q: LIBLINEAR is slow for my data (reaching the maximal number of iterations)?
+</b>
+
+<p>
+Very likely you use a large C or don't scale data.
+If your number of features is small, you may
+use the option <pre>-s 2</pre>by solving the primal
+problem. More examples are in 
+the appendix C of our 
+<a href=../papers/guide/guide.pdf>SVM guide</a>.
+
+
+<hr>
+<b>Q: Is LIBLINEAR gives the same result as LIBSVM with linear kernel?
+</b>
+
+<p>
+They should be very similar. However, sometimes
+the difference may not be small.
+Note that LIBLINEAR does not use the bias term
+b by default. If you observe very different
+results, try to set -B 1 for LIBLINEAR.
+This will add the bias term to the loss function
+as well as the regularization term (w^Tw + b^2).
+Then, results should be closer.
+
+<hr>
+<b>Q: How to select the regularization parameter C?</b>
+
+<p>
+You can use grid.py of LIBSVM (after version 3.16) to check
+cross validation accuracy of different C.
+Two options must be specified.
+
+<ol>
+<li>
+`-svmtrain train': use the command `train' of LIBLINEAR
+</li>
+<li>
+`-log2g null': do not grid with `g'
+</li>
+</ol>
+For example, you can run
+<pre>
+> python grid.py -log2c -3,0,1 -log2g null -svmtrain ./train heart_scale
+</pre>
+to check CV values at C=2^-3, 2^-2, 2^-1, and 2^0.
+<hr>
+<b>Q: Why in some situations the software seems to be slower than that used  in the JMLR paper (logistic regression)?</b>
+
+<p>
+We guess that you are comparing 
+<pre>
+> time ./train -s 0 -v 5 -e 0.001 data
+</pre>
+with the environment used in our paper,
+and find that LIBLINEAR is slower.
+Two reasons may cause the diffierence.
+<ol>
+<li>
+The above timeing of LIBLINEAR includes time
+for reading data, but in the paper
+we exclude that part.
+</li>
+<li>
+In the paper, to conduct
+5-fold (or 2-fold) CV we group folds used
+for training as a separate matrix, but LIBLINEAR
+simply uses pointers of the corresponding
+instances.
+Therefore, in doing matrix-vector 
+multiplications, the former sequentially 
+uses rows in a continuous segment of the memory,
+but the latter does not. Thus, LIBLINEAR may
+be slower but it saves the memory.
+</li>
+</ol>
+
+<hr>
+<b>Q: Why in linear.cpp you don't call log1p for log(1+...)? Also gradient/Hessian calculation may involve catastrophic cancellations?</b>
+
+<p>
+We carefully studied such issues, and decided
+to use the current setting. For data classification,
+one doesn't need very accurate solution, so
+numerical issues are less important. Moreover,
+log1p is not available on all platforms.
+Please let us know if you observe any
+numerical problems.
+
+
+<hr>
+<b>Q: Can you explain more about the model file?</b>
+
+<p>
+Assume k is the total number of classes
+and n is the number of features.
+In the model file,
+after the parameters, there is an n*k matrix W,
+whose columns are obtained
+from solving 
+two-class problems:
+1 vs rest, 2 vs rest, 3 vs rest, ...., k vs rest.
+For example, if there are 4 classes, the file looks like:
+<pre>
++-------+-------+-------+-------+
+| w_1vR | w_2vR | w_3vR | w_4vR |
++-------+-------+-------+-------+
+</pre>
+<hr>
+
+<b>Q: Why the sign of predicted labels and decision values are sometimes reversed?</b>
+
+<p>
+Please see the answer in LIBSVM faq.
+
+<p> To correctly obtain decision values, you
+need to check the array <pre>label</pre> in the
+model. 
+
+<hr>
+<b>Q: Why you support probability outputs for logistic regression only?</b>
+
+<p>
+LIBSVM uses more advanced techniques for
+SVM probability outputs. The code is a bit complicated
+so we haven't decided if including it is suitable or not.
+
+<p> If you really would like to have 
+probability outputs for SVM in LIBLINEAR, you
+can consider using the simple probability model
+of logistic regression. Simply modify
+the following subrutine 
+in linear.cpp.
+<pre>
+int check_probability_model(const struct model *model_)
+{
+	return (model_->param.solver_type==L2R_LR ||
+</pre>
+to
+<pre>
+int check_probability_model(const struct model *model_)
+{
+	return 1;
+</pre>
+
+<hr>
+<b>Q: How could I know which training instances are support vectors?</b>
+
+<p>
+Some LIBLINEAR solvers consider the primal problem, so support
+vectors are not obtained during the training procedure.
+For dual solvers, we output only the primal weight vector w,
+so support vectors are not stored in the model. This is 
+different from LIBSVM.
+
+<p> To know support vectors, you can modify
+the following loop in solve_l2r_l1l2_svc() of linear.cpp
+to print out indices:
+<pre>
+	for(i=0; i&lt;l; i++)
+	{
+		v += alpha[i]*(alpha[i]*diag[GETI(i)] - 2);
+		if(alpha[i] > 0)
+			++nSV;
+	}
+</pre>
+Note that we group data in the same class together before
+calling this subroutine. Thus the order of your training 
+instances has been changed. You can sort your data 
+(e.g., positive instances before negative ones) before
+using liblinear. Then indices will be the same.
+
+
+<hr>
+<b>Q: How to speedup LIBLINEAR using OpenMP for primal solvers?</b>
+
+<p>
+This FAQ is for solvers. For multiclass classification, please check 
+<a href='#how_to_speedup_multiclass_classification_using_openmp'>How to
+speedup multiclass classification using OpenMP</a>
+instead.
+
+<p>
+Because of the design of LIBLINEAR's solvers,
+it is not easy to achieve good speedup using OpenMP.
+However, by the following steps, we can still achieve
+some speedup for 
+<b>primal solvers (-s 0, 2, 11)</b>.
+
+<ol>
+<li>
+In Makefile, add -fopenmp to CFLAGS.
+</li>
+
+<li>
+In classes l2r_lr_fun and l2r_l2_svc_fun of linear.cpp, 
+modify the for loop Xv to:
+<pre>
+#pragma omp parallel for private (i)
+	for(i=0;i&lt;l;i++)
+</pre>
+In l2r_l2_svc_fun, modify the 
+for loop in subXv to:
+<pre>
+#pragma omp parallel for private (i)
+	for(i=0;i&lt;sizeI;i++)
+</pre>
+</li>
+
+<li>
+Using 8 cores on the sets <a href=../libsvmtools/datasets/binary/rcv1_test.binary.bz2>rcv1_test.binary</a> and <a href=../libsvmtools/datasets/multiclass/mnist8m.scale.bz2>mnist8m.scale</a>.
+<pre>
+%export OMP_NUM_THREADS=8
+%time ./train -s 2 rcv1_test.binary
+0m45.250s
+%time ./train -s 2 mnist8m.scale
+59m41.300s
+</pre>
+Using standard LIBLINEAR
+<pre>
+%time ./train -s 2 rcv1_test.binary
+0m55.657s
+%time ./train -s 2 mnist8m.scale
+78m59.452s
+</pre>
+
+</li>
+
+</ol>
+
+<hr>
+
+<a name='how_to_speedup_multiclass_classification_using_openmp'><b>Q: How to speedup multiclass classification using OpenMP?</b></a>
+
+<p>
+Please take the following steps. <b>Note that it works only for
+-s 0, 1, 2, 3, 5, 7.</b>
+
+<p>
+In Makefile, add -fopenmp to CFLAGS.
+
+<p>
+In linear.cpp, replace the following segment of code
+
+<pre>
+				model_->w=Malloc(double, w_size*nr_class);
+				double *w=Malloc(double, w_size);
+				for(i=0;i&lt;nr_class;i++)
+				{
+					int si = start[i];
+					int ei = si+count[i];
+
+					k=0;
+					for(; k&lt;si; k++)
+						sub_prob.y[k] = -1;
+					for(; k&lt;ei; k++)
+						sub_prob.y[k] = +1;
+					for(; k&lt;sub_prob.l; k++)
+						sub_prob.y[k] = -1;
+
+					train_one(&sub_prob, param, w, weighted_C[i], param->C);
+
+					for(int j=0;j&lt;w_size;j++)
+						model_->w[j*nr_class+i] = w[j];
+				}
+				free(w);
+</pre>
+with
+<pre>
+				model_->w=Malloc(double, w_size*nr_class);
+#pragma omp parallel for private(i) 
+				for(i=0;i&lt;nr_class;i++)
+				{
+					problem sub_prob_omp;
+					sub_prob_omp.l = l;
+					sub_prob_omp.n = n;
+					sub_prob_omp.x = x;
+					sub_prob_omp.y = Malloc(double,l);
+
+					int si = start[i];
+					int ei = si+count[i];
+
+					double *w=Malloc(double, w_size);
+
+					int t=0;
+					for(; t&lt;si; t++)
+						sub_prob_omp.y[t] = -1;
+					for(; t&lt;ei; t++)
+						sub_prob_omp.y[t] = +1;
+					for(; t&lt;sub_prob_omp.l; t++)
+						sub_prob_omp.y[t] = -1;
+
+					train_one(&sub_prob_omp, param, w, weighted_C[i], param->C);
+
+					for(int j=0;j&lt;w_size;j++)
+						model_->w[j*nr_class+i] = w[j];
+					free(sub_prob_omp.y);
+					free(w);
+				}
+</pre>
+Using 8 cores on the set <a href=../libsvmtools/datasets/multiclass/rcv1_test.multiclass.bz2>rcv1_test.multiclass.bz2</a>.
+
+<pre>
+%export OMP_NUM_THREADS=8
+%time ./train -s 2 rcv1_test.multiclass
+2m4.019s
+%time ./train -s 1 rcv1_test.multiclass
+0m45.349s
+</pre>
+Using standard LIBLINEAR
+<pre>
+%time ./train -s 2 rcv1_test.multiclass
+6m52.237s
+%time ./train -s 1 rcv1_test.multiclass
+1m51.739s
+</pre>
+
+<hr>
+<a name="python_interface"> <h3>Python Interface</h3>
+
+<b>Q: While using the Python interface, I have memory efficiency issue on storing instances in the required data structure. What should I do?</b>
+
+<p>
+Please check <a href=faqfiles/python_datastructures.html>this page</a>
+
+<hr>
+<a name="l1_regularized_classification"> <h3>L1-regularized Classification</h3>
+
+<b>Q: When should I use L1-regularized classifiers?</b>
+
+<p>
+If you would like to identify important features.
+For most cases, L1 regularization does not give 
+higher accuracy but may be slower in training.
+
+<p> We hope to know situations where L1 is useful.
+Please contact us if you have some success
+stories.
+
+
+<hr>
+
+<b>Q: Why you don't save a sparse weight vector
+in the model file?
+</b>
+
+<p>
+We don't have any application which really needs
+this setting. However, please email us if
+your application must use a sparse weight
+vector.
+
+<hr>
+<a name="l2_regularized_support_vector_regression"> <h3>L2-regularized Support Vector Regression</h3>
+
+<b>Q: Does LIBLINEAR supports least-square regression?</b>
+
+<p>
+Yes. L2-loss SVR with epsilon = 0 (i.e., -p 0) reduces to regularized
+least-square regression (ridge regression).
+
+<hr>
+Please contact <a href="http://www.csie.ntu.edu.tw/~cjlin">Chih-Jen Lin</a> for any question.
+
+  </body>
+</html>
diff --git a/exp.html b/exp.html
new file mode 100644
index 0000000..4d742ef
--- /dev/null
+++ b/exp.html
@@ -0,0 +1,277 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+   <meta name="description" content="logistic regression, support vector machines, linear classification, document classification">
+   <title>LIBLINEAR Experiments
+</title>
+</head>
+<body text="#000000" bgcolor="#FFEFD5" link="#FF0000" vlink="#0000FF">
+
+<h2>
+LIBLINEAR Experiments
+</h2>
+
+<h3>
+<a href="http://www.csie.ntu.edu.tw/~cjlin/mlgroup">Machine Learning Group</a> at
+National Taiwan University
+<br>
+</h3>
+
+<p>
+This page provides the source codes for the papers related to <b>LIBLINEAR</b>.
+<hr>
+
+<h3>
+<a name=linear_ranksvm>
+Experiments on linear rankSVM</h3>
+
+Programs used to generate experiment results
+in the paper
+C.-P. Lee and
+C.-J. Lin.
+<a href=../papers/ranksvm/ranksvml2.pdf>
+Large-scale Linear RankSVM</a>.
+Technical report, 2013.
+<p>
+can be found in this
+
+<a href=../papers/ranksvm/ranksvml2_exp-1.2.tar.gz>tar.gz file</a>.
+<p>
+Use files here only if you are interested in redoing our
+experiments. To apply the method
+for your applications, all
+you need is a LIBLINEAR extension. Check "Large-scale linear rankSVM" at
+<a href=../libsvmtools>LIBSVM Tools</a>.
+<hr>
+
+
+<h3>
+<a name=linear_svr>
+Experiments on linear support vector regression</h3>
+
+Programs used to generate experiment results
+in the paper
+C.-H. Ho, and
+C.-J. Lin.
+<a href=../papers/linear-svr.pdf>
+Large-scale Linear Support Vector Regression</a>.
+JMLR, 2012.
+<p>
+can be found in this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/exps/svr/linear_svr_exp-1.2.zip">zip file</a>.
+<hr>
+
+
+<h3>
+<a name=disk_decomposition>
+Experiments on linear classification when data cannot fit in memory</h3>
+
+An algorithm in
+<p>
+H.-F. Yu, 
+C.-J. Hsieh,
+K.-W. Chang,
+and
+C.-J. Lin</b>,
+<A HREF="../papers/disk_decomposition/tkdd_disk_decomposition.pdf">
+Large linear classification when data cannot fit in memory</a>. ACM KDD 2010 (Best research paper award). Extended version appeared
+in <a href=http://portal.acm.org/tkdd/>ACM Transactions on Knowledge Discovery from Data</a>, 5:23:1--23:23, 2012.
+
+<p>
+has been implemented as 
+an extension of LIBLINEAR. It aims to handle data
+larger than your memory capacity.
+It can be found in 
+<a href=../libsvmtools>LIBSVM Tools</a>. 
+
+<p> To repeat experiments in our paper, check
+this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/exps/cdblock/cdblock_exp-2.0.tgz">tgz file</a>.
+Don't use it unlesse you want to regenerate
+figures.
+For you own experiments, you should use the LIBLINEAR extension at 
+LIBSVM tools.
+
+<hr>
+
+<h3>
+<a name=maxent_dual_exp>
+Experiments on Dual Logistic Regression and Maximum Entropy</h3>
+
+Programs used to generate experiment results
+in the paper
+<p>
+Hsiang-Fu Yu, Fang-Lan Huang, and Chih-Jen Lin.
+<a href=../papers/maxent_dual.pdf>
+Dual Coordinate Descent Methods for Logistic Regression
+and Maximum Entropy Models
+</a>. <I><A HREF=
+"http://www.springer.com/computer/ai/journal/10994">
+Machine Learning</A></I>, 85(2011), 41-75.
+<p>
+can be found in this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/maxent/maxent_dual_exp-1.0.zip">zip file</a>.
+<hr>
+
+<h3>
+<a name=l1_exp>
+Comparing
+Large-scale L1-regularized Linear Classifiers
+</h3>
+
+<ul>
+<li>
+The following paper compares various L1-regularized 
+solvers for logistic regression and SVM.
+The algorithm CDN used in <b>LIBLINEAR</b> now for L1-regularized
+SVM was proposed here.
+<p>
+Guo-Xun Yuan, Kai-Wei Chang, Cho-Jui Hsieh, and Chih-Jen Lin.
+<a href=../papers/l1.pdf>
+A Comparison of Optimization Methods for Large-scale
+L1-regularized Linear Classification.</a>
+JMLR 2010.
+
+<p>
+Programs for generating experimental results 
+can be found in this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/l1paper/l1_exp-1.2.zip">zip file</a>.
+</li>
+
+<li>
+For L1-regularized logistic regression, the 
+following paper proposes an algorithm (newGLMNET)
+to succeed CDN in <b>LIBLINEAR</b>.
+<p>
+Guo-Xun Yuan, Chia-Hua Ho, and Chih-Jen Lin.
+<a href=../papers/long-glmnet.pdf>
+An Improved GLMNET for L1-regularized Logistic Regression
+and Support Vector Machines.
+</a> JMLR, 2012
+<p>
+Programs for generating experimental results
+can be found in this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/l1paper/newGLMNET_exp-1.0.zip">zip file</a>.
+</li>
+</ul>
+
+<p>
+You can directly use LIBLINEAR for efficient L1-regularized
+classification.
+Use code here <b>only</b> if you are interested in redoing our
+experiments. The running time is long because we run each solver to accurately
+solve optimization problems.
+<hr>
+
+
+<h3>
+<a name=lowpoly_exp>
+Experiments on Degree-2 Polynomial Mappings of Data</h3>
+
+Programs used to generate experiment results
+in Section 5 of the paper
+<p>
+Yin-Wen Chang, Cho-Jui Hsieh, Kai-Wei Chang, 
+Michael Ringgaard and Chih-Jen Lin.
+<a href=../papers/lowpoly_journal.pdf>
+Low-Degree Polynomial Mapping of Data for SVM</a>,
+JMLR 2010,
+<p>
+can be found in this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/lowpoly/lowpoly_exp-1.1.zip">zip file</a>.
+
+<p>
+Use files here only if you are interested in redoing our
+experiments. To apply the method
+for your applications, all
+you need is a LIBLINEAR extension. Check "fast training/testing of
+degree-2 polynomial mappings of data" at
+<a href=../libsvmtools>LIBSVM Tools</a>.
+<hr>
+
+
+<h3>
+<a name=maxent_exp>
+Experiments on Maximum Entropy models</h3>
+
+Programs used to generate experiment results
+in the paper
+<p>
+Fang-Lan Huang, Cho-Jui Hsieh, Kai-Wei Chang, and Chih-Jen Lin.
+<a href=../papers/maxent_journal.pdf>
+Iterative Scaling and Coordinate Descent Methods for
+Maximum Entropy Models</a>, JMLR 2010,
+<p>
+can be found in this
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/maxent/maxent_exp-1.0.zip">zip file</a>.
+
+<hr>
+
+<h3>
+<a name=dual_exp>
+Comparing various methods for large-scale linear SVM</h3>
+
+Programs used to generate experiment results
+in the paper
+<p>
+C.-J. Hsieh, K.-W. Chang, C.-J. Lin, S. Sundararajan, and
+S. Sathiya Keerthi. 
+<a href=../papers/cddual.pdf>
+A Dual Coordinate Descent Method for Large-scale Linear SVM</a>, ICML 2008,
+<p>
+can be found in this 
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/dualpaper/dual_exp-1.0.zip">zip file</a>.
+
+<hr>
+
+<h3>
+<a name=cdl2_exp>
+Comparing various methods for large-scale linear SVM</h3>
+
+Programs used to generate experiment results
+in the paper
+<p>
+K.-W. Chang, C.-J. Hsieh, and C.-J. Lin,
+<a href=../papers/cdl2.pdf>
+Coordinate Descent Method for Large-scale L2-loss Linear SVM
+</a>, JMLR 2008,
+<p>
+can be found in this 
+<a href="liblinear/cdl2paper">zip file</a>.
+
+<hr>
+
+<h3>
+<a name=lrpaper>
+Comparing various methods
+for logistic regression</h3>
+
+Programs used to generate experiment results
+in the paper
+<p>
+C.-J. Lin, R. C. Weng, and S. S. Keerthi.
+<a href=../papers/logistic.pdf>
+Trust region Newton method for large-scale logistic
+regression</a>, JMLR 2008, 
+<p>
+can be found in this 
+<a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/lrpaper/lrpaper-1.04.zip">zip file</a>.
+
+<p>
+
+We include 
+<a href="http://www.ece.northwestern.edu/~nocedal/lbfgs.html">LBFGS</a>
+and 
+<a href="http://people.cs.uchicago.edu/~vikass/svmlin.html">SVMlin</a>
+(a <b>modified</b> version) 
+for experiments. Please check their respective
+COPYRIGHT notices.
+
+<hr>
+Please send comments and suggestions to <a href="../index.html">Chih-Jen
+Lin</a>.
+
+</body>
+</html>
+
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..7bf08a9
--- /dev/null
+++ b/index.html
@@ -0,0 +1,325 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+   <meta name="description" content="logistic regression, support vector machines, linear classification, document classification">
+   <title>LIBLINEAR -- A Library for Large Linear Classification
+</title>
+</head>
+<body text="#000000" bgcolor="#FFEFD5" link="#FF0000" vlink="#0000FF">
+
+<h2>
+LIBLINEAR -- A Library for Large Linear Classification
+</h2>
+
+<h3>
+<a href="http://www.csie.ntu.edu.tw/~cjlin/mlgroup">Machine Learning Group</a> at
+National Taiwan University
+<br>
+<a href=contributors.html>Contributors</a>
+</h3>
+
+<hr WIDTH="100%">
+
+<img SRC="../images/new.gif" >
+We recently released <a href=../libshorttext>LibShortText</a>,
+a library for short-text classification and analysis.
+It's built upon LIBLINEAR.
+<p>
+<img SRC="../images/new.gif" >
+Version 1.93 released on January 27, 2013. We fixed some
+minor issues in this version.
+<p> An experimental version using 64-bit int is in 
+<a href=../libsvmtools>LIBSVM tools</a>. It 
+in theory can handle up to 
+2^64 instances/features if memory is enough.
+<p>
+We are interested in <b>large sparse</b> regression data.
+Please let use know if you have some. Thank you.
+
+<p>
+
+<img SRC="../images/new.gif" >
+<b>A practical guide to LIBLINEAR</b> is now available in the end of
+<A HREF="../papers/liblinear.pdf">LIBLINEAR</a> paper.
+<br>
+
+
+<p>
+Some extensions of LIBLINEAR are at LIBSVM Tools</a>. 
+<br>
+
+<p>
+LIBLINEAR is the winner of
+<a href=http://largescale.first.fraunhofer.de/summary/>
+ICML 2008 large-scale learning challenge</a>
+(linear SVM track). It is also used for winning
+KDD Cup 2010.
+
+<hr>
+<h3>
+Introduction</h3>
+<p><b>LIBLINEAR </b> is a <b>linear</b> classifier
+for data with <b>millions</b> of 
+instances and features.
+It 
+supports 
+<ul>
+<li>
+L2-regularized classifiers
+<br>
+L2-loss linear SVM,
+L1-loss linear SVM, and
+logistic regression (LR)
+
+</li>
+<li>
+L1-regularized classifiers (after version 1.4)
+<br>
+L2-loss linear SVM and
+logistic regression (LR) 
+</li>
+<li>
+L2-regularized support vector regression (after version 1.9)
+<br>
+L2-loss linear SVR and
+L1-loss linear SVR.
+</li>
+</ul>
+
+
+<p>
+Main features of <b>LIBLINEAR</b> include
+<ul>
+<li> Same data format as 
+<a href=../libsvm><b>LIBSVM</b></a>, our general-purpose
+SVM solver, and also similar usage
+<li>Multi-class classification: 1) one-vs-the rest, 2)
+Crammer & Singer</li>
+<li>Cross validation for model selection</li>
+<li>Probability estimates (logistic regression only)</li>
+<li>Weights for unbalanced data</li>
+<li>MATLAB/Octave, Java, Python, Ruby interfaces</li>
+</ul>
+
+<a href="#document">Documentation</a>
+<p>
+<a href=FAQ.html>FAQ is here</a>
+<hr>
+<h3>
+When to use LIBLINEAR but not <a href=../libsvm>LIBSVM</a></h3>
+
+There are some large data
+for which with/without nonlinear
+mappings gives similar performances.
+<b>Without using kernels</b>, one can quickly train
+a much larger set via a linear classifier.
+<b>Document classification</b> is one such application.
+In the following example (20,242 instances and 47,236 features; available on 
+<a href=../libsvmtools/datasets>LIBSVM data sets</a>), the cross-validation time is significantly
+reduced by using LIBLINEAR:
+<pre>
+% time libsvm-2.85/svm-train -c 4 -t 0 -e 0.1 -m 800 -v 5 rcv1_train.binary
+Cross Validation Accuracy = 96.8136%
+345.569s
+% time liblinear-1.21/train -c 4 -e 0.1 -v 5 rcv1_train.binary
+Cross Validation Accuracy = 97.0161%
+2.944s
+</pre>
+<b>Warning:</b>While LIBLINEAR's default solver
+is very fast for document classification,
+it may be <b>slow</b> in other situations.
+See Appendix C of our
+<a href=../papers/guide/guide.pdf>SVM guide</a>
+about using other solvers in LIBLINEAR.
+
+<p>
+<b>Warning:</b>If you are a beginner and your
+data sets are not large, you should
+consider LIBSVM first.
+
+<hr>
+<h3>
+<a NAME="download">
+Download LIBLINEAR</h3>
+The current release (Version 1.93, January 2013) of <b>LIBLINEAR </b>can be obtained by downloading
+the
+<a href="http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/liblinear.cgi?+http://www.csie.ntu.edu.tw/~cjlin/liblinear+zip">
+zip
+file
+</a>
+or
+<a href="http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/liblinear.cgi?+http://www.csie.ntu.edu.tw/~cjlin/liblinear+tar.gz">
+tar.gz
+</a>
+file.
+
+<p>The package includes the source code in C/C++.
+A README file with detailed explanation is 
+provided. For <b>MS Windows</b> users, there is a subdirectory in the zip
+file containing binary executable files. 
+<p>Please read the <a href="http://www.csie.ntu.edu.tw/~cjlin/liblinear/COPYRIGHT">COPYRIGHT</a>
+notice before using
+<b>LIBLINEAR</b>.&nbsp;
+
+<hr>
+<h3>
+<a NAME="document"></a>
+Documentation and Codes used for experiments in our papers</h3>
+
+<p>
+R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and
+<b>C.-J. Lin</b>.
+<A HREF="../papers/liblinear.pdf">
+LIBLINEAR: A library for large linear classification
+</a> 
+<i><a href=http://www.jmlr.org>Journal
+of Machine Learning Research</a></I> 
+9(2008), 1871-1874. 
+
+<p> The appendices of this paper give all <b>implementation details</b>
+of LIBLINEAR. 
+
+<p> In the end of this paper there is a 
+<b>practical guide</b> to LIBLINEAR
+
+<p>See also some examples in Appendix C of the
+<a href=../papers/guide/guide.pdf>SVM guide</a>.
+
+<p>
+<a href="exp.html">Code used for experiments in our
+LIBLINEAR 
+papers can be found here</a>. 
+<hr>
+<h3>
+Interfaces to LIBLINEAR</h3>
+
+<center>
+
+<table border=1>
+<tr>
+	<th>Language</th>
+	<th>Description</th>
+	<th>Maintainers and Their Affiliation</th>
+	<th>Supported LIBLINEAR version</th>
+	<th>Link</th>
+</tr>
+<tr>
+	<td> <a NAME="matlab">MATLAB</td>
+	<td> A simple MATLAB interface</td>
+	<td>
+		LIBLINEAR authors at National
+		Taiwan University.
+	</td>
+	<td> The latest</td>
+	<td> <a href=#download>Included in LIBLINEAR package</a></td>
+</tr>
+<tr>
+	<td> <a NAME="octave">Octave</td>
+	<td> A simple Octave interface</td>
+	<td>
+		LIBLINEAR authors at National
+		Taiwan University.
+	</td>
+	<td> The latest</td>
+	<td> <a href=#download>Included in LIBLINEAR package</a></td>
+</tr>
+<tr>
+	<td> <a NAME="java">Java</td>
+	<td> Java version of LIBLINEAR</td>
+	<td>Benedikt Waldvogel
+	</td>
+	<td> 1.92</td>
+	<td> <a href="http://www.bwaldvogel.de/liblinear-java/">Java LIBLINEAR</a></td>
+</tr>
+<tr>
+	<td> <a name=python> Python </a></td>
+	<td> A python interface has been included in LIBLINEAR since version 1.6.</td>
+	<td> LIBLINEAR authors at National
+		Taiwan University.</td>
+	<td> The latest</td>
+	<td> <a href=#download>Included in LIBLINEAR package</a></td>
+</tr>
+<tr>
+	<td> <a NAME="java">Python</td>
+	<td> Python wrapper of LIBLINEAR</td>
+	<td> Uwe Schmitt
+	</td>
+	<td> 1.32</td>
+	<td> <a href="http://public.procoders.net/liblinear2scipy/src/dist/">Zip/tar.gz file</a></td>
+</tr>
+<tr>
+	<td> <a NAME="ruby">Ruby</td>
+	<td> A Ruby interface via SWIG</td>
+	<td> 
+		Tom Zeng
+	</td>
+	<td> 1.51</td>
+	<td> <a href=http://github.com/tomz/liblinear-ruby-swig/tree/master>liblinear-ruby-swig</a></td>
+</tr>
+
+<tr>
+	<td> <a NAME="perl">Perl</td>
+	<td> A Perl interface</td>
+	<td> 
+		Koichi Satoh
+	</td>
+	<td> 1.93</td>
+	<td> <a href=https://github.com/sekia/Algorithm-LibLinear>perl module</a></td>
+</tr>
+
+<tr>
+	<td> <a name=weka>Weka</a></td>
+	<td> Weka wrapper</td>
+	<td> Benedikt Waldvogel</td>
+	<td> 1.5</td>
+	<td> 
+		<a href=http://wiki.pentaho.com/display/DATAMINING/LibLINEAR>Weka LIBLINEAR</a>
+	</td>
+</tr>
+
+<tr>
+	<td> <a name=R>R</a></td>
+	<td> R interface to LIBLINEAR</td>
+	<td> <a href=http://www.thibaulthelleputte.be>Thibault Helleputte</a></td>
+	<td> 1.8</td>
+	<td> 
+		<a href=http://cran.r-project.org/web/packages/LiblineaR>R LIBLINEAR</a>
+	</td>
+</tr>
+
+<tr>
+	<td> <a name="lisp">Common LISP</a></td>
+	<td> Common Lisp wrapper of LIBLINEAR</td>
+	<td>
+            <a href="http://quotenil.com">Gábor Melis</a>
+	</td>
+
+	<td> 1.92</td>
+	<td>
+		<a href="http://quotenil.com/git/?p=cl-libsvm.git;a=summary">Common LISP wrapper</a>
+	</td>
+</tr>
+
+<tr>
+	<td> <a name=scilab>Scilab</a></td>
+	<td> &nbsp;</td>
+	<td> 
+	    Holger Nahrstaedt from the Technical University of Berlin
+	</td>
+	<td> 1.8</td>
+	<td> 
+		<a href=http://atoms.scilab.org/toolboxes/libsvm>Scilab interface</a>
+	</td>
+</tr>
+
+</table>
+</center>
+<p>
+
+<hr>
+Please send comments and suggestions to <a href="../index.html">Chih-Jen
+Lin</a>.
+
+</body>
+</html>
diff --git a/liblinear-adapt_makefile.patch b/liblinear-adapt_makefile.patch
new file mode 100644
index 0000000..78668e0
--- /dev/null
+++ b/liblinear-adapt_makefile.patch
@@ -0,0 +1,56 @@
+Index: liblinear-1.93/Makefile
+===================================================================
+--- liblinear-1.93.orig/Makefile
++++ liblinear-1.93/Makefile
+@@ -1,37 +1,29 @@
+ CXX ?= g++
+ CC ?= gcc
+-CFLAGS = -Wall -Wconversion -O3 -fPIC
+-LIBS = blas/blas.a
++CFLAGS_ADD = -Wall -Wconversion -O3 -fPIC
++#LDFLAGS += -Wl,--as-needed
++LIBS = -lblas
+ SHVER = 1
++SHARED_LIB_FLAGS= -shared -Wl,-soname,liblinear.so.$(SHVER)
+ OS = $(shell uname)
+-#LIBS = -lblas
+ 
+ all: train predict
+ 
+-lib: linear.o tron.o blas/blas.a
+-	if [ "$(OS)" = "Darwin" ]; then \
+-		SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,liblinear.so.$(SHVER)"; \
+-	else \
+-		SHARED_LIB_FLAG="-shared -Wl,-soname,liblinear.so.$(SHVER)"; \
+-	fi; \
+-	$(CXX) $${SHARED_LIB_FLAG} linear.o tron.o blas/blas.a -o liblinear.so.$(SHVER)
++lib: linear.o tron.o
++	$(CXX) $(SHARED_LIB_FLAGS) $(LDFLAGS) $(LIBS) linear.o tron.o -o liblinear.so.$(SHVER)
++	ln -fs liblinear.so.$(SHVER) liblinear.so
+ 
+-train: tron.o linear.o train.c blas/blas.a
+-	$(CXX) $(CFLAGS) -o train train.c tron.o linear.o $(LIBS)
++train: lib train.c
++	$(CXX) $(CFLAGS_ADD) $(CFLAGS) -o train train.c -L. -llinear
+ 
+-predict: tron.o linear.o predict.c blas/blas.a
+-	$(CXX) $(CFLAGS) -o predict predict.c tron.o linear.o $(LIBS)
++predict: lib predict.c
++	$(CXX) $(CFLAGS_ADD) $(CFLAGS) -o predict predict.c -L. -llinear
+ 
+ tron.o: tron.cpp tron.h
+-	$(CXX) $(CFLAGS) -c -o tron.o tron.cpp
++	$(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o tron.o tron.cpp
+ 
+ linear.o: linear.cpp linear.h
+-	$(CXX) $(CFLAGS) -c -o linear.o linear.cpp
+-
+-blas/blas.a: blas/*.c blas/*.h
+-	make -C blas OPTFLAGS='$(CFLAGS)' CC='$(CC)';
++	$(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o linear.o linear.cpp
+ 
+ clean:
+-	make -C blas clean
+-	make -C matlab clean
+-	rm -f *~ tron.o linear.o train predict liblinear.so.$(SHVER)
++	rm -f *~ tron.o linear.o train predict liblinear.so*
diff --git a/liblinear-fix_compiler_warnings.patch b/liblinear-fix_compiler_warnings.patch
new file mode 100644
index 0000000..25ee5c1
--- /dev/null
+++ b/liblinear-fix_compiler_warnings.patch
@@ -0,0 +1,76 @@
+Index: liblinear-1.93/linear.cpp
+===================================================================
+--- liblinear-1.93.orig/linear.cpp
++++ liblinear-1.93/linear.cpp
+@@ -1010,7 +1010,7 @@ static void solve_l2r_l1l2_svr(
+ 	double d, G, H;
+ 	double Gmax_old = INF;
+ 	double Gmax_new, Gnorm1_new;
+-	double Gnorm1_init;
++	double Gnorm1_init = 0.0;
+ 	double *beta = new double[l];
+ 	double *QD = new double[l];
+ 	double *y = prob->y;
+@@ -1409,7 +1409,7 @@ static void solve_l1r_l2_svc(
+ 	double d, G_loss, G, H;
+ 	double Gmax_old = INF;
+ 	double Gmax_new, Gnorm1_new;
+-	double Gnorm1_init;
++	double Gnorm1_init = 0.0;
+ 	double d_old, d_diff;
+ 	double loss_old, loss_new;
+ 	double appxcond, cond;
+@@ -2634,10 +2634,10 @@ struct model *load_model(const char *mod
+ 	char cmd[81];
+ 	while(1)
+ 	{
+-		fscanf(fp,"%80s",cmd);
++		(void)!fscanf(fp,"%80s",cmd);
+ 		if(strcmp(cmd,"solver_type")==0)
+ 		{
+-			fscanf(fp,"%80s",cmd);
++			(void)!fscanf(fp,"%80s",cmd);
+ 			int i;
+ 			for(i=0;solver_type_table[i];i++)
+ 			{
+@@ -2660,17 +2660,17 @@ struct model *load_model(const char *mod
+ 		}
+ 		else if(strcmp(cmd,"nr_class")==0)
+ 		{
+-			fscanf(fp,"%d",&nr_class);
++			(void)!fscanf(fp,"%d",&nr_class);
+ 			model_->nr_class=nr_class;
+ 		}
+ 		else if(strcmp(cmd,"nr_feature")==0)
+ 		{
+-			fscanf(fp,"%d",&nr_feature);
++			(void)!fscanf(fp,"%d",&nr_feature);
+ 			model_->nr_feature=nr_feature;
+ 		}
+ 		else if(strcmp(cmd,"bias")==0)
+ 		{
+-			fscanf(fp,"%lf",&bias);
++			(void)!fscanf(fp,"%lf",&bias);
+ 			model_->bias=bias;
+ 		}
+ 		else if(strcmp(cmd,"w")==0)
+@@ -2682,7 +2682,7 @@ struct model *load_model(const char *mod
+ 			int nr_class = model_->nr_class;
+ 			model_->label = Malloc(int,nr_class);
+ 			for(int i=0;i<nr_class;i++)
+-				fscanf(fp,"%d",&model_->label[i]);
++				(void)!fscanf(fp,"%d",&model_->label[i]);
+ 		}
+ 		else
+ 		{
+@@ -2712,8 +2712,8 @@ struct model *load_model(const char *mod
+ 	{
+ 		int j;
+ 		for(j=0; j<nr_w; j++)
+-			fscanf(fp, "%lf ", &model_->w[i*nr_w+j]);
+-		fscanf(fp, "\n");
++			(void)!fscanf(fp, "%lf ", &model_->w[i*nr_w+j]);
++		(void)!fscanf(fp, "\n");
+ 	}
+ 
+ 	setlocale(LC_ALL, old_locale);
diff --git a/liblinear.pc.in b/liblinear.pc.in
new file mode 100644
index 0000000..e6e45c5
--- /dev/null
+++ b/liblinear.pc.in
@@ -0,0 +1,14 @@
+#################################
+# Pkg-Config file for liblinear #
+#################################
+
+Name: liblinear
+Description: Library for Large Linear Classification
+URL: @url@
+Version: @version@
+
+prefix=@prefix@
+includedir=@includedir@
+
+Cflags: -I${includedir}/liblinear
+Libs: -llinear
diff --git a/liblinear.spec b/liblinear.spec
new file mode 100644
index 0000000..c5780c5
--- /dev/null
+++ b/liblinear.spec
@@ -0,0 +1,208 @@
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+
+Name:		liblinear
+Version:	1.93
+Release:	2%{?dist}
+Summary:	Library for Large Linear Classification
+%{?el5:Group:	System Environment/Libraries}
+
+License:	BSD
+URL:		http://www.csie.ntu.edu.tw/~cjlin/%{name}
+Source0:	%{url}/%{name}-%{version}.tar.gz
+Source1:	%{name}.pc.in
+Source2:	%{url}/index.html
+Source3:	%{url}/FAQ.html
+Source4:	%{url}/exp.html
+Source5:	http://www.csie.ntu.edu.tw/~cjlin/papers/%{name}.pdf
+
+# simple fixes, not needed by upstream
+Patch0:		liblinear-adapt_makefile.patch
+Patch1:		liblinear-fix_compiler_warnings.patch
+
+%{?el5:BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)}
+BuildRequires:	blas-devel
+BuildRequires:	python2-devel
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+BuildRequires:	python3-devel
+%endif
+
+
+%description
+%{name} is an open source library for large-scale linear classification.
+It supports logistic regression and linear support vector machines.  It
+provides easy-to-use command-line tools and library calls for users and
+developers.  Comprehensive documents are available for both beginners
+and advanced users.
+
+Experiments demonstrate that %{name} is very efficient on large sparse
+data sets.  %{name} is the winner of ICML 2008 large-scale learning
+challenge (linear SVM track).  It is also used for winning KDD Cup 2010.
+
+
+%package cli
+Summary:	CLI-tools for %{name}
+%{?el5:Group:	Applications/Engineering}
+
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+
+%description cli
+This package contains cli-tools for use with %{name}.
+
+For further information read "3.1 Practical Usage" from the pdf included
+in the %{name}-doc package.
+
+
+%package devel
+Summary:	Development files for %{name}
+%{?el5:Group:	Development/Libraries}
+
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+The %{name}-devel package contains libraries and header files for developing
+applications that use %{name}.
+
+
+%package doc
+Summary:	Documentation files for %{name}
+%{?el5:Group:	Documentation}
+
+%{?!el5:BuildArch:	noarch}
+
+%description doc
+The %{name}-doc package contains some brief documentation for developing
+applications that use %{name}.
+
+
+%package -n python-%{name}
+Summary:	Python bindings for %{name}
+%{?el5:Group:	System Environment/Libraries}
+
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+
+%description  -n python-%{name}
+This package contains bindings for developing Python applications that
+use %{name}.
+
+For further information read "README.python" included in the
+%{name}-doc package.
+
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%package -n python3-%{name}
+Summary:	Python3 bindings for %{name}
+
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+
+%description  -n python3-%{name}
+This package contains bindings for developing Python3 applications that
+use %{name}.
+
+For further information read "README.python" included in the
+%{name}-doc package.
+%endif
+
+
+%prep
+%setup -q
+
+# pull in SourceX
+install -pm 0644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} .
+
+# remove bundled stuff
+rm -rf blas/ matlab/ windows/ Makefile.*
+
+# create dummy-configure
+echo '#!/bin/sh' > configure
+chmod +x ./configure
+
+# configure pkg-config file
+sed	-e 's!@url@!%{url}!g' \
+	-e 's!@version@!%{version}!g' \
+	-e 's!@prefix@!%{_prefix}!g' \
+	-e 's!@includedir@!%{_includedir}!g' \
+< %{name}.pc.in \
+> %{name}.pc
+
+# apply patches
+%patch0 -p1
+%patch1 -p1
+
+# rename python/README for inclusion in doc
+mv python/README README.python
+
+# remove hashbang from lib's files
+sed -i -e '/#!\//d' python/*.py
+
+
+%build
+%configure
+make %{?_smp_mflags}
+
+
+%install
+%{?el5:rm -rf %{buildroot}}
+
+# no install-target in Makefile
+mkdir -p	%{buildroot}%{_bindir} \
+		%{buildroot}%{_libdir}/pkgconfig \
+		%{buildroot}%{_includedir}/%{name} \
+		%{buildroot}%{python_sitearch} \
+		%{buildroot}%{python3_sitearch}
+
+install -pm 0755 predict %{buildroot}%{_bindir}/%{name}-predict
+install -pm 0755 train %{buildroot}%{_bindir}/%{name}-train
+install -pm 0755 %{name}.so.1 %{buildroot}%{_libdir}
+ln -s %{name}.so.1 %{buildroot}%{_libdir}/%{name}.so
+install -pm 0644 %{name}.pc %{buildroot}%{_libdir}/pkgconfig
+install -pm 0644 {linear,tron}.h %{buildroot}%{_includedir}/%{name}
+
+install -pm 0644 python/*.py %{buildroot}%{python_sitearch}
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+install -pm 0644 python/*.py %{buildroot}%{python3_sitearch}
+%endif
+
+
+%clean
+%{?el5:rm -rf %{buildroot}}
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%doc COPYRIGHT
+%{_libdir}/%{name}.so.*
+
+%files cli
+%doc heart_scale
+%{_bindir}/*
+
+%files devel
+%{_includedir}/*
+%{_libdir}/%{name}.so
+%{_libdir}/pkgconfig/%{name}.pc
+
+%files doc
+%doc COPYRIGHT README* {predict,train}.c *.html *.pdf
+
+%files -n python-%{name}
+%{python_sitearch}/*
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%files -n python3-%{name}
+%{python3_sitearch}/*
+%endif
+
+
+%changelog
+* Mon Aug 12 2013 Björn Esser <bjoern.esser at gmail.com> - 1.93-2
+- build arched python-plugins
+- nuke hashbang from python-plugins
+
+* Sun Aug 11 2013 Björn Esser <bjoern.esser at gmail.com> - 1.93-1
+- Initial rpm release (#995864)
diff --git a/sources b/sources
index e69de29..5942bf7 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,2 @@
+5ca3c8e9bb2ec5661aa77221b206e296  liblinear-1.93.tar.gz
+e59751acc930d6fbfad3f9a1bf2c6dd5  liblinear.pdf


More information about the scm-commits mailing list